@robono/messaging-react-native 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +157 -4
- package/RobonoMessagingRuntime.podspec +16 -0
- package/SBOM.spdx.json +2709 -813
- package/android/build.gradle +10 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/robono/messaging/RobonoBackupCrypto.java +27 -0
- package/android/src/main/java/com/robono/messaging/RobonoBackupGoogle.java +76 -0
- package/android/src/main/java/com/robono/messaging/RobonoHistoryStore.java +173 -0
- package/android/src/main/java/com/robono/messaging/RobonoMessagingPackage.java +11 -0
- package/app.plugin.cjs +22 -3
- package/cloudkit/backup-schema.ckdb +13 -0
- package/dist/account-pages.d.ts +51 -0
- package/dist/account-pages.js +65 -0
- package/dist/account.d.ts +6 -2
- package/dist/account.js +37 -11
- package/dist/attachment-preview.d.ts +11 -10
- package/dist/attachment-preview.js +15 -12
- package/dist/backup-background.d.ts +25 -0
- package/dist/backup-background.js +71 -0
- package/dist/backup-base64.d.ts +3 -0
- package/dist/backup-base64.js +41 -0
- package/dist/backup-google-authorization.d.ts +23 -0
- package/dist/backup-google-authorization.js +95 -0
- package/dist/backup.d.ts +24 -0
- package/dist/backup.js +202 -0
- package/dist/brand.js +4 -4
- package/dist/bubble-design.d.ts +1 -1
- package/dist/bubble-design.js +5 -3
- package/dist/cloudkit-backup.d.ts +14 -0
- package/dist/cloudkit-backup.js +193 -0
- package/dist/contact-directory.d.ts +3 -1
- package/dist/contact-directory.js +3 -3
- package/dist/conversation-details.js +2 -2
- package/dist/customization.d.ts +1 -0
- package/dist/delivery-bar.d.ts +3 -2
- package/dist/delivery-bar.js +7 -4
- package/dist/delivery-notice.d.ts +9 -0
- package/dist/delivery-notice.js +15 -0
- package/dist/directory-navigation.d.ts +25 -0
- package/dist/directory-navigation.js +69 -0
- package/dist/expo-backup-background.d.ts +17 -0
- package/dist/expo-backup-background.js +57 -0
- package/dist/expo-backup-cloudkit.d.ts +6 -0
- package/dist/expo-backup-cloudkit.js +11 -0
- package/dist/expo-backup-crypto.d.ts +3 -0
- package/dist/expo-backup-crypto.js +17 -0
- package/dist/expo-backup-google.d.ts +7 -0
- package/dist/expo-backup-google.js +16 -0
- package/dist/expo-backup-network.d.ts +8 -0
- package/dist/expo-backup-network.js +18 -0
- package/dist/expo-backup-passkeys.d.ts +14 -0
- package/dist/expo-backup-passkeys.js +46 -0
- package/dist/expo-backup-settings.d.ts +4 -0
- package/dist/expo-backup-settings.js +59 -0
- package/dist/expo-backup.d.ts +14 -0
- package/dist/expo-backup.js +22 -0
- package/dist/expo-bridge.d.ts +2 -0
- package/dist/expo-bridge.js +3 -1
- package/dist/expo-cache.js +20 -1
- package/dist/expo-device-history.d.ts +24 -0
- package/dist/expo-device-history.js +88 -0
- package/dist/expo-durable-history.d.ts +26 -0
- package/dist/expo-durable-history.js +56 -0
- package/dist/expo-history-backup.d.ts +3 -0
- package/dist/expo-history-backup.js +79 -0
- package/dist/expo-history-maintenance.d.ts +4 -0
- package/dist/expo-history-maintenance.js +23 -0
- package/dist/expo-history-previews.d.ts +5 -0
- package/dist/expo-history-previews.js +57 -0
- package/dist/expo-history.d.ts +1 -1
- package/dist/expo-history.js +2 -2
- package/dist/expo-inbox-preferences.d.ts +3 -0
- package/dist/expo-inbox-preferences.js +9 -0
- package/dist/expo-media.d.ts +2 -0
- package/dist/expo-media.js +18 -24
- package/dist/expo-messenger.d.ts +8 -0
- package/dist/expo-messenger.js +27 -11
- package/dist/expo-notifications.d.ts +17 -1
- package/dist/expo-notifications.js +36 -16
- package/dist/expo-outbox.d.ts +2 -0
- package/dist/expo-outbox.js +1 -1
- package/dist/expo-oversight.d.ts +15 -0
- package/dist/expo-oversight.js +15 -0
- package/dist/expo-reviews.d.ts +6 -0
- package/dist/expo-reviews.js +145 -0
- package/dist/expo-screen.js +62 -28
- package/dist/expo-thumbnails.d.ts +6 -2
- package/dist/expo-thumbnails.js +73 -8
- package/dist/expo.d.ts +14 -0
- package/dist/expo.js +12 -0
- package/dist/forward.js +2 -2
- package/dist/header-calls.js +1 -1
- package/dist/header-colors.d.ts +5 -0
- package/dist/header-colors.js +7 -0
- package/dist/inbox-search.d.ts +1 -1
- package/dist/inbox-search.js +7 -3
- package/dist/inbox.d.ts +6 -2
- package/dist/inbox.js +27 -55
- package/dist/index.d.ts +14 -6
- package/dist/index.js +195 -78
- package/dist/linked-apps.d.ts +45 -0
- package/dist/linked-apps.js +40 -0
- package/dist/loading-messages.d.ts +5 -0
- package/dist/loading-messages.js +10 -0
- package/dist/media-access.d.ts +8 -0
- package/dist/media-access.js +6 -1
- package/dist/media-controller.d.ts +2 -0
- package/dist/native-history-authorization.d.ts +4 -0
- package/dist/native-history-authorization.js +69 -0
- package/dist/native-history-backup.d.ts +16 -0
- package/dist/native-history-backup.js +144 -0
- package/dist/native-history.d.ts +14 -0
- package/dist/native-history.js +186 -0
- package/dist/native-outbox.d.ts +2 -0
- package/dist/oversight-session.d.ts +4 -0
- package/dist/oversight-session.js +14 -0
- package/dist/popup.d.ts +6 -3
- package/dist/popup.js +6 -6
- package/dist/preview-layout.d.ts +12 -0
- package/dist/preview-layout.js +102 -0
- package/dist/recent-media.js +2 -1
- package/dist/reviews.d.ts +19 -0
- package/dist/reviews.js +231 -0
- package/dist/scheduled.js +6 -6
- package/dist/search.js +18 -8
- package/ios/RobonoBackupCloudKit.m +96 -0
- package/ios/RobonoBackupCrypto.m +30 -0
- package/ios/RobonoHistoryStore.m +170 -0
- package/package.json +34 -7
- package/plugin/backup-expiration.cjs +23 -0
- package/plugin/prepare-native.cjs +12 -0
package/dist/expo-history.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MessagingHistoryCache } from '@robono/messaging';
|
|
2
|
-
/** App-private recent history; no
|
|
2
|
+
/** App-private recent history and bounded thumbnails; no originals or tokens. */
|
|
3
3
|
export declare function createExpoMessagingHistory(endpoint: string, userId: string, namespace?: string): MessagingHistoryCache;
|
package/dist/expo-history.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as FS from 'expo-file-system/legacy';
|
|
|
2
2
|
import * as Crypto from 'expo-crypto';
|
|
3
3
|
import { MessagingHistoryCache } from '@robono/messaging';
|
|
4
4
|
import { storageDigest as digest } from './expo-storage-digest.js';
|
|
5
|
-
/** App-private recent history; no
|
|
5
|
+
/** App-private recent history and bounded thumbnails; no originals or tokens. */
|
|
6
6
|
export function createExpoMessagingHistory(endpoint, userId, namespace = 'default') {
|
|
7
7
|
const directory = async () => {
|
|
8
8
|
if (!FS.documentDirectory)
|
|
@@ -16,7 +16,7 @@ export function createExpoMessagingHistory(endpoint, userId, namespace = 'defaul
|
|
|
16
16
|
if (!file)
|
|
17
17
|
return null;
|
|
18
18
|
const info = await FS.getInfoAsync(dir + file);
|
|
19
|
-
if (!info.exists || info.isDirectory || info.size >
|
|
19
|
+
if (!info.exists || info.isDirectory || info.size > 1048576) {
|
|
20
20
|
await FS.deleteAsync(dir + file, { idempotent: true });
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MessagingInboxPreferences } from '@robono/messaging';
|
|
2
|
+
/** A small account-scoped appearance preference; contains no messages or credentials. */
|
|
3
|
+
export declare function createExpoInboxPreferences(endpoint: string, userId: string, namespace?: string): MessagingInboxPreferences;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as FS from 'expo-file-system/legacy';
|
|
2
|
+
import { storageDigest } from './expo-storage-digest.js';
|
|
3
|
+
/** A small account-scoped appearance preference; contains no messages or credentials. */
|
|
4
|
+
export function createExpoInboxPreferences(endpoint, userId, namespace = 'default') {
|
|
5
|
+
const file = async () => { if (!FS.documentDirectory)
|
|
6
|
+
throw Error('Account settings storage is unavailable.'); return FS.documentDirectory + 'robono-inbox-' + await storageDigest(JSON.stringify([endpoint, namespace, userId])) + '.json'; };
|
|
7
|
+
return { async read() { const path = await file(); if (!(await FS.getInfoAsync(path)).exists)
|
|
8
|
+
return null; const value = JSON.parse(await FS.readAsStringAsync(path)); return typeof value.showSelf === 'boolean' ? value.showSelf : null; }, async write(showSelf) { await FS.writeAsStringAsync(await file(), JSON.stringify({ showSelf })); } };
|
|
9
|
+
}
|
package/dist/expo-media.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MessagingRequest } from '@robono/messaging';
|
|
1
2
|
import { type AudioMode } from 'expo-audio';
|
|
2
3
|
import type { LocalMessagingMedia, MessagingMediaDevice, MessagingMediaStorage } from './media-controller.js';
|
|
3
4
|
export interface MessagingAudioSession {
|
|
@@ -17,4 +18,5 @@ export declare function createExpoMessagingStorage(options: {
|
|
|
17
18
|
getAccessToken: () => Promise<string>;
|
|
18
19
|
streaming?: boolean;
|
|
19
20
|
fetch?: typeof fetch;
|
|
21
|
+
request?: MessagingRequest;
|
|
20
22
|
}): MessagingMediaStorage;
|
package/dist/expo-media.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { allocateMessagingCache, removeMessagingCacheUri } from './expo-cache.js';
|
|
2
|
-
import { MessagingError } from '@robono/messaging';
|
|
3
|
-
import { MessagingMediaAccess } from './media-access.js';
|
|
2
|
+
import { MessagingError, withMessagingDeadline } from '@robono/messaging';
|
|
3
|
+
import { MessagingMediaAccess, isRemoteMessagingAsset } from './media-access.js';
|
|
4
4
|
import { awaitMediaScreening } from './media-screening';
|
|
5
5
|
import { AppState } from 'react-native';
|
|
6
6
|
import { prepareRecordingPermission } from './recording-permission.js';
|
|
@@ -252,36 +252,30 @@ export function createExpoMessagingStorage(options) {
|
|
|
252
252
|
const endpoint = https(options.url);
|
|
253
253
|
const access = new MessagingMediaAccess();
|
|
254
254
|
async function request(operation, input, signal) {
|
|
255
|
-
const token = await options.getAccessToken();
|
|
256
|
-
if (!token)
|
|
257
|
-
throw new MessagingError('Sign in to continue.', 'authentication_required', 401);
|
|
258
|
-
const bounded = new AbortController();
|
|
259
|
-
const cancel = () => bounded.abort();
|
|
260
|
-
signal?.addEventListener('abort', cancel, { once: true });
|
|
261
|
-
if (signal?.aborted)
|
|
262
|
-
bounded.abort();
|
|
263
|
-
const timeout = setTimeout(cancel, operation === 'complete' ? 120000 : 15000);
|
|
264
255
|
try {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
256
|
+
return await withMessagingDeadline(async (bounded) => {
|
|
257
|
+
if (options.request)
|
|
258
|
+
return options.request(operation, input, { signal: bounded });
|
|
259
|
+
const token = await options.getAccessToken();
|
|
260
|
+
check(bounded);
|
|
261
|
+
if (!token)
|
|
262
|
+
throw new MessagingError('Sign in to continue.', 'authentication_required', 401);
|
|
263
|
+
const response = await (options.fetch ?? fetch)(endpoint, { method: 'POST', redirect: 'error', signal: bounded, headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: JSON.stringify({ ...input, operation }) });
|
|
264
|
+
const result = await response.json();
|
|
265
|
+
if (!response.ok || result?.error)
|
|
266
|
+
throw new MessagingError(result?.error?.message ?? 'The file could not be transferred. Try again.', result?.error?.code ?? 'media_unavailable', response.status);
|
|
267
|
+
return result;
|
|
268
|
+
}, { signal, timeoutMs: operation === 'complete' ? 120000 : 15000 });
|
|
271
269
|
}
|
|
272
270
|
catch (error) {
|
|
273
271
|
if (signal?.aborted)
|
|
274
272
|
throw error;
|
|
275
|
-
if (
|
|
273
|
+
if (error instanceof Error && error.name === 'TimeoutError')
|
|
276
274
|
throw new MessagingError('Connection timed out.', 'request_timeout');
|
|
277
275
|
if (error instanceof TypeError)
|
|
278
276
|
throw new MessagingError('Connect to send your attachment.', 'network_unavailable');
|
|
279
277
|
throw error;
|
|
280
278
|
}
|
|
281
|
-
finally {
|
|
282
|
-
clearTimeout(timeout);
|
|
283
|
-
signal?.removeEventListener('abort', cancel);
|
|
284
|
-
}
|
|
285
279
|
}
|
|
286
280
|
async function playbackPlan(message, signal, reauthorize = false) {
|
|
287
281
|
check(signal);
|
|
@@ -313,7 +307,7 @@ export function createExpoMessagingStorage(options) {
|
|
|
313
307
|
check(context.signal);
|
|
314
308
|
if (message.deleted)
|
|
315
309
|
throw Error('This attachment is no longer available.');
|
|
316
|
-
if (options.streaming === false || !['voice', 'video'].includes(message.kind) || !
|
|
310
|
+
if (options.streaming === false || !['voice', 'video'].includes(message.kind) || !isRemoteMessagingAsset(message.media?.assetId ?? ''))
|
|
317
311
|
return null;
|
|
318
312
|
const plan = await playbackPlan(message, context.signal);
|
|
319
313
|
// The native player requests byte ranges directly from the same private,
|
|
@@ -373,7 +367,7 @@ export function createExpoMessagingStorage(options) {
|
|
|
373
367
|
if (message.deleted)
|
|
374
368
|
throw Error('This attachment is no longer available.');
|
|
375
369
|
const grant = message.attachmentPreview;
|
|
376
|
-
const fresh = grant && grant.messageId === message.id && grant.conversationId === message.conversationId && grant.assetId === message.media?.assetId && Number.isFinite(grant.expiresAt) && grant.expiresAt > Date.now() + 5000 && grant.expiresAt <= Date.now() + 60000 && Number.isSafeInteger(grant.byteSize) && grant.byteSize > 0 && grant.byteSize <= 131072;
|
|
370
|
+
const fresh = grant && grant.messageId === message.id && grant.conversationId === message.conversationId && grant.assetId === message.media?.assetId && Number.isFinite(grant.expiresAt) && grant.expiresAt > Date.now() + 5000 && grant.expiresAt <= Date.now() + 60000 && Number.isSafeInteger(grant.byteSize) && grant.byteSize > 0 && grant.byteSize <= (message.media?.assetId.startsWith('bridge:') ? 204800 : 131072);
|
|
377
371
|
const plan = fresh ? { url: grant.url, media: { assetId: grant.assetId, mimeType: 'image/jpeg', fileName: 'preview.jpg', byteSize: grant.byteSize } } : await request('thumbnail', { conversationId: message.conversationId, messageId: message.id }, context.signal);
|
|
378
372
|
if (!plan)
|
|
379
373
|
return null;
|
package/dist/expo-messenger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MessageReviewNotificationOptions } from '@robono/messaging';
|
|
1
2
|
import type { MessagingDirectoryOptions } from './contact-directory.js';
|
|
2
3
|
import { createExpoMessengerCalling } from './expo-connected-calling.js';
|
|
3
4
|
import type { LocationWorkspace } from '@robono/location';
|
|
@@ -13,6 +14,9 @@ export declare function createExpoMessenger(options: {
|
|
|
13
14
|
fetch?: typeof fetch;
|
|
14
15
|
/** Host-authorized transcription/translation, including any credit checks. */
|
|
15
16
|
transformRequest?: import('@robono/messaging').MessagingRequest;
|
|
17
|
+
reviewNotifications?: MessageReviewNotificationOptions;
|
|
18
|
+
onNotificationRegistered?: import('./expo-notifications.js').ExpoMessagingNotificationOptions['onRegistered'];
|
|
19
|
+
onNotificationDiagnostic?: import('./expo-notifications.js').ExpoMessagingNotificationOptions['onDiagnostic'];
|
|
16
20
|
availability?: false;
|
|
17
21
|
notifications?: false;
|
|
18
22
|
extras?: false;
|
|
@@ -26,6 +30,9 @@ export declare function createExpoMessenger(options: {
|
|
|
26
30
|
namespace?: string;
|
|
27
31
|
audioSession?: MessagingAudioSession;
|
|
28
32
|
isCallActive?: () => boolean;
|
|
33
|
+
/** Show unexpired authorized local history immediately while refreshing access. */
|
|
34
|
+
historyAccess?: 'authorized-cache' | 'online';
|
|
35
|
+
deviceHistory?: import('@robono/messaging').MessagingDeviceHistory;
|
|
29
36
|
}): {
|
|
30
37
|
signOut(): Promise<void>;
|
|
31
38
|
dispose(): void;
|
|
@@ -129,6 +136,7 @@ export interface ExpoMessengerProps extends Omit<ExpoMessagingScreenProps, 'cont
|
|
|
129
136
|
contacts?: Record<string, {
|
|
130
137
|
name: string;
|
|
131
138
|
avatarUrl?: string;
|
|
139
|
+
networkName?: string;
|
|
132
140
|
phoneNumber?: string;
|
|
133
141
|
groupEligible?: boolean;
|
|
134
142
|
}>;
|
package/dist/expo-messenger.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createExpoInboxPreferences } from './expo-inbox-preferences.js';
|
|
3
|
+
import { withExpoDeviceHistoryStorage } from './expo-device-history.js';
|
|
4
|
+
import { useDirectoryNavigation, MessagingDirectoryConversation } from './directory-navigation.js';
|
|
2
5
|
import { renderNativeCallVideo } from '@robono/calling-react-native/native-video';
|
|
3
6
|
import { createInboxViewMemory } from './inbox-view.js';
|
|
4
7
|
import { MessagingPublicRooms } from './public-rooms.js';
|
|
@@ -36,8 +39,10 @@ export function createExpoMessenger(options) {
|
|
|
36
39
|
void availability?.stop(); };
|
|
37
40
|
const activitySubscription = availability ? AppState.addEventListener('change', activityChanged) : undefined;
|
|
38
41
|
activityChanged(AppState.currentState);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
42
|
+
const inboxRequest = createMessagingTransport({ ...options, url: endpoint.href });
|
|
43
|
+
const inbox = new MessagingInboxClient({ request: options.deviceHistory?.wrap(inboxRequest) ?? inboxRequest, userId: options.userId, preferences: options.persistence === false ? undefined : createExpoInboxPreferences(endpoint.href, options.userId, options.namespace) });
|
|
44
|
+
const remoteStorage = createExpoMessagingStorage({ url: media.href, getAccessToken: options.getAccessToken, ...(options.fetch ? { fetch: options.fetch } : {}) });
|
|
45
|
+
const storage = options.deviceHistory ? withExpoDeviceHistoryStorage(remoteStorage, client, options) : remoteStorage;
|
|
41
46
|
const outgoing = expoOutbox(client);
|
|
42
47
|
if (outgoing)
|
|
43
48
|
client.setRecoveryAdapter(worker => {
|
|
@@ -62,6 +67,10 @@ export function createExpoMessenger(options) {
|
|
|
62
67
|
} });
|
|
63
68
|
let connection = null, pending = null, closed = false;
|
|
64
69
|
let openNotification;
|
|
70
|
+
const diagnostic = (event) => { try {
|
|
71
|
+
options.onNotificationDiagnostic?.(event);
|
|
72
|
+
}
|
|
73
|
+
catch { } };
|
|
65
74
|
const notifications = options.notifications === false ? undefined : {
|
|
66
75
|
async start(open) {
|
|
67
76
|
openNotification = open;
|
|
@@ -73,14 +82,18 @@ export function createExpoMessenger(options) {
|
|
|
73
82
|
url.searchParams.set('service', 'notifications');
|
|
74
83
|
const request = createMessagingTransport({ ...options, url: endpoint.href });
|
|
75
84
|
pending = (async () => {
|
|
76
|
-
const n = await connectExpoMessagingNotifications({ url: url.href, userId: options.userId, getAccessToken: options.getAccessToken, ...(options.fetch ? { fetch: options.fetch } : {}),
|
|
85
|
+
const n = await connectExpoMessagingNotifications({ reviews: options.reviewNotifications, onRegistered: options.onNotificationRegistered, onDiagnostic: diagnostic, url: url.href, userId: options.userId, getAccessToken: options.getAccessToken, ...(options.fetch ? { fetch: options.fetch } : {}),
|
|
77
86
|
authorize: async (e) => { try {
|
|
78
|
-
|
|
87
|
+
const allowed = (await request('list', { conversationId: e.conversationId, messageIds: [e.messageId], notificationMessageId: e.messageId })).notificationAllowed === true;
|
|
88
|
+
diagnostic({ stage: 'authorization', accepted: allowed });
|
|
89
|
+
return allowed;
|
|
79
90
|
}
|
|
80
91
|
catch {
|
|
92
|
+
diagnostic({ stage: 'error' });
|
|
81
93
|
return false;
|
|
82
94
|
} },
|
|
83
|
-
onCall: calling?.notification, systemCalls: calling?.systemNotifications, open:
|
|
95
|
+
onCall: calling?.notification, systemCalls: calling?.systemNotifications, open: async (e) => { if (closed || !openNotification)
|
|
96
|
+
throw Error('The messenger is not available.'); await openNotification(e.conversationId, e.messageId); }, refresh: () => inbox.refresh().then(() => { }), onError: () => diagnostic({ stage: 'error' }),
|
|
84
97
|
});
|
|
85
98
|
if (closed) {
|
|
86
99
|
await n.signOut();
|
|
@@ -152,7 +165,8 @@ function ExpoMessengerContent({ inbox, contacts = emptyContacts, initialConversa
|
|
|
152
165
|
const selected = selectedConversation === undefined ? internal : selectedConversation;
|
|
153
166
|
// Declarative navigation loads the selected conversation itself. Internal open()
|
|
154
167
|
// changes the client synchronously, so this never opens it a second time.
|
|
155
|
-
useLayoutEffect(() => { if (
|
|
168
|
+
useLayoutEffect(() => { if (selected)
|
|
169
|
+
directoryNavigation.cancel(); if (!selected) {
|
|
156
170
|
props.client.stop();
|
|
157
171
|
return;
|
|
158
172
|
} if (props.client.getSnapshot().conversationId !== selected.id)
|
|
@@ -183,16 +197,18 @@ function ExpoMessengerContent({ inbox, contacts = emptyContacts, initialConversa
|
|
|
183
197
|
setSelected(null); },
|
|
184
198
|
} : props.conversationActions;
|
|
185
199
|
const open = (row, messageId) => {
|
|
200
|
+
directoryNavigation.cancel();
|
|
186
201
|
setShowMaps(false);
|
|
187
202
|
setSelected(row);
|
|
188
203
|
void props.client.open(row.id).then(async () => { if (messageId && props.client.getSnapshot().conversationId === row.id)
|
|
189
204
|
await props.client.focusMessage(messageId); }).catch(() => { });
|
|
190
205
|
};
|
|
191
|
-
|
|
192
|
-
|
|
206
|
+
const directoryNavigation = useDirectoryNavigation({ directory: props.directory, onOpenDirectoryContact: props.onOpenDirectoryContact, scope: inbox, userId: props.userId, active: props.active, onOpen: open });
|
|
207
|
+
useEffect(() => { void notifications?.start(async (id, message) => { await inbox.refresh(); const row = inbox.getSnapshot().conversations.find(c => c.id === id); if (!row)
|
|
208
|
+
throw Error('This conversation is not available.'); open(row, message); }).catch(() => { }); }, [notifications, inbox]);
|
|
193
209
|
const notificationAccount = notifications ? { name: props.account?.name ?? 'Your account', ...props.account, onEnableNotifications: () => notifications.enable() } : props.account;
|
|
194
210
|
const account = calling?.deviceCheck ? { name: 'Your account', ...notificationAccount, deviceCheck: calling.deviceCheck, renderCallPreview: (stream) => renderNativeCallVideo({ stream, local: true, style: { width: '100%', height: '100%' } }) } : notificationAccount;
|
|
195
|
-
const knownContact = contacts[selected?.contactId ?? ''];
|
|
196
|
-
const contact = useMemo(() => selected?.contactId === props.userId ? { name: '
|
|
197
|
-
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, { manageUpdates: false, 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 })] });
|
|
211
|
+
const knownContact = contacts[selected?.contactId ?? ''] ?? props.directory?.find(entry => entry.contactId === selected?.contactId);
|
|
212
|
+
const contact = useMemo(() => selected?.contactId === props.userId ? { name: 'Me', avatarUrl: props.account?.avatarUrl } : selected?.kind === 'group' ? { name: selected.name ?? 'Group' } : knownContact ?? { name: selected?.contactId ?? 'Chat' }, [selected?.contactId, selected?.kind, selected?.name, props.userId, knownContact, props.account?.avatarUrl]);
|
|
213
|
+
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, initialAppearance: props.initialAppearance ?? inboxState.appearance ?? undefined, 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 => directoryNavigation.selection ? _jsx(MessagingDirectoryConversation, { entry: directoryNavigation.selection, busy: directoryNavigation.busy, error: directoryNavigation.error, appearance: props.appearance ?? inboxState.appearance ?? defaultMessagingSettings().appearance, onBack: directoryNavigation.cancel, onRetry: () => void directoryNavigation.open(directoryNavigation.selection) }) : 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, { selfAvatarUrl: props.account?.avatarUrl, onNewConversation: props.onNewConversation, onDirectorySelect: entry => { props.client.stop(); setSelected(null); void directoryNavigation.open(entry); }, manageUpdates: false, 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, { inbox: inbox, 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 })] });
|
|
198
214
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as Notifications from 'expo-notifications';
|
|
2
2
|
import type { SystemCallNotifications } from '@robono/calling-react-native/system-calling';
|
|
3
|
-
import { type MessagingNotification } from '@robono/messaging';
|
|
3
|
+
import { type MessageReviewNotificationOptions, type MessagingNotification } from '@robono/messaging';
|
|
4
4
|
export interface ExpoMessagingNotificationOptions {
|
|
5
|
+
/** Optional content-free integration diagnostics. Never includes tokens or message contents. */
|
|
6
|
+
onDiagnostic?: (event: {
|
|
7
|
+
stage: 'response' | 'handled' | 'authorization' | 'error';
|
|
8
|
+
accepted?: boolean;
|
|
9
|
+
hasData?: boolean;
|
|
10
|
+
}) => void;
|
|
5
11
|
/** The combined server route, with service=notifications. */
|
|
6
12
|
url: string;
|
|
7
13
|
userId: string;
|
|
@@ -10,8 +16,18 @@ export interface ExpoMessagingNotificationOptions {
|
|
|
10
16
|
open: (event: MessagingNotification) => void | Promise<void>;
|
|
11
17
|
refresh: () => void | Promise<void>;
|
|
12
18
|
onError: (error: Error) => void;
|
|
19
|
+
/** Retire this installation's previous host alert registration only after the
|
|
20
|
+
* new authenticated registration succeeds. Failures retry on foreground. */
|
|
21
|
+
onRegistered?: (registration: {
|
|
22
|
+
deviceId: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
accountScope: string;
|
|
25
|
+
signal: AbortSignal;
|
|
26
|
+
}) => Promise<void>;
|
|
13
27
|
fetch?: typeof fetch;
|
|
14
28
|
onCall?: (data: unknown, opened: boolean) => Promise<boolean>;
|
|
29
|
+
/** Optional assigned-reviewer notifications, using the authenticated review client. */
|
|
30
|
+
reviews?: MessageReviewNotificationOptions;
|
|
15
31
|
systemCalls?: SystemCallNotifications;
|
|
16
32
|
}
|
|
17
33
|
/** One restored account. Never prompts on mount, replaces a global handler or opens an unverified call. */
|
|
@@ -4,15 +4,19 @@ import * as Crypto from 'expo-crypto';
|
|
|
4
4
|
import * as SecureStore from 'expo-secure-store';
|
|
5
5
|
import { Platform, AppState } from 'react-native';
|
|
6
6
|
import { notificationData, presentedNotificationData, dismissReadNotification, notificationWasRead, rememberNotificationAccount, registerNotificationCleanup } from './expo-notification-cleanup.js';
|
|
7
|
-
import { createMessagingNotificationRouter, parseMessagingNotification, parseMessagingReadNotification } from '@robono/messaging';
|
|
7
|
+
import { createMessageReviewNotificationRouter, parseMessageReviewNotification, withMessagingDeadline, createMessagingNotificationRouter, parseMessagingNotification, parseMessagingReadNotification } from '@robono/messaging';
|
|
8
8
|
/** One restored account. Never prompts on mount, replaces a global handler or opens an unverified call. */
|
|
9
9
|
export async function connectExpoMessagingNotifications(options) {
|
|
10
|
+
const diagnostic = (event) => { try {
|
|
11
|
+
options.onDiagnostic?.(event);
|
|
12
|
+
}
|
|
13
|
+
catch { } };
|
|
10
14
|
if (!['ios', 'android'].includes(Platform.OS))
|
|
11
15
|
throw Error('Mobile notification registration requires iPhone or Android.');
|
|
12
16
|
const endpoint = new URL(options.url);
|
|
13
17
|
if (endpoint.protocol !== 'https:' || endpoint.username || endpoint.password)
|
|
14
18
|
throw Error('Use your authenticated HTTPS notification endpoint.');
|
|
15
|
-
let disposed = false, closing = false, registerQueue = Promise.resolve(), accountScope, lastToken;
|
|
19
|
+
let disposed = false, closing = false, registerQueue = Promise.resolve(), accountScope, lastToken, cutoverPending = false;
|
|
16
20
|
const key = 'robono.messaging.device.' + await Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA256, endpoint.origin + endpoint.pathname);
|
|
17
21
|
let deviceId = await SecureStore.getItemAsync(key);
|
|
18
22
|
if (!deviceId) {
|
|
@@ -20,14 +24,16 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
20
24
|
await SecureStore.setItemAsync(key, deviceId);
|
|
21
25
|
}
|
|
22
26
|
async function request(input) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
return withMessagingDeadline(async (signal) => {
|
|
28
|
+
const token = await options.getAccessToken();
|
|
29
|
+
if (disposed || signal.aborted)
|
|
30
|
+
throw Error('Notification session has ended or timed out.');
|
|
31
|
+
const response = await (options.fetch ?? fetch)(endpoint.href, { method: 'POST', redirect: 'error', signal, headers: { authorization: 'Bearer ' + token, 'content-type': 'application/json' }, body: JSON.stringify({ ...input, ...(accountScope ? { accountScope } : {}) }) });
|
|
32
|
+
const data = await response.json();
|
|
33
|
+
if (!response.ok)
|
|
34
|
+
throw Error(data?.error?.message ?? 'Notification setup is unavailable. Check your app’s Apple/Google credentials.');
|
|
35
|
+
return data;
|
|
36
|
+
});
|
|
31
37
|
}
|
|
32
38
|
const status = await request({ operation: 'notification-status' });
|
|
33
39
|
if (status.userId !== options.userId || typeof status.accountScope !== 'string' || !/^[a-f\d]{64}$/.test(status.accountScope))
|
|
@@ -35,6 +41,7 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
35
41
|
accountScope = status.accountScope;
|
|
36
42
|
await rememberNotificationAccount(status.accountScope, true);
|
|
37
43
|
const router = createMessagingNotificationRouter({ accountScope: status.accountScope, authorize: options.authorize, open: options.open, refresh: options.refresh });
|
|
44
|
+
const reviewRouter = options.reviews ? createMessageReviewNotificationRouter({ ...options.reviews, accountScope: status.accountScope }) : undefined;
|
|
38
45
|
const register = (token) => {
|
|
39
46
|
lastToken = token;
|
|
40
47
|
const work = registerQueue.then(async () => {
|
|
@@ -47,6 +54,11 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
47
54
|
const data = await request({ operation: 'register-device', calling: !!options.onCall, ...system, ...(appleEnvironment ? { appleEnvironment } : {}), deviceId, provider: Platform.OS === 'ios' ? 'apns' : 'fcm', token: String(token.data) });
|
|
48
55
|
if (data.accountScope !== status.accountScope)
|
|
49
56
|
throw Error('The signed-in account changed. Reconnect notifications for the new account.');
|
|
57
|
+
if (options.onRegistered && !disposed && !closing) {
|
|
58
|
+
cutoverPending = true;
|
|
59
|
+
await withMessagingDeadline(signal => options.onRegistered({ deviceId: deviceId, userId: options.userId, accountScope: status.accountScope, signal }));
|
|
60
|
+
cutoverPending = false;
|
|
61
|
+
}
|
|
50
62
|
});
|
|
51
63
|
registerQueue = work.catch(() => { });
|
|
52
64
|
return work;
|
|
@@ -65,12 +77,17 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
65
77
|
await Promise.all(shown.filter(n => n.request.content.data?.accountScope === accountScope && n.request.content.data?.call_id === data.call_id).map(n => Notifications.dismissNotificationAsync(n.request.identifier)));
|
|
66
78
|
}
|
|
67
79
|
return options.onCall(data, opened);
|
|
68
|
-
}
|
|
80
|
+
} if (parseMessageReviewNotification(data))
|
|
81
|
+
return reviewRouter?.handle(data, opened) ?? false; return router.handle(data, opened); };
|
|
69
82
|
const received = Notifications.addNotificationReceivedListener(notification => { void handle(notification.request.content.data).catch(options.onError); });
|
|
70
83
|
const response = async (value) => {
|
|
84
|
+
if (value)
|
|
85
|
+
diagnostic({ stage: 'response', accepted: value.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER, hasData: !!notificationData(value.notification.request.content.data) });
|
|
71
86
|
if (disposed || closing || !value || value.actionIdentifier !== Notifications.DEFAULT_ACTION_IDENTIFIER)
|
|
72
87
|
return;
|
|
73
|
-
|
|
88
|
+
const handled = await handle(value.notification.request.content.data, true);
|
|
89
|
+
diagnostic({ stage: 'handled', accepted: handled });
|
|
90
|
+
if (handled) {
|
|
74
91
|
const last = await Notifications.getLastNotificationResponseAsync();
|
|
75
92
|
if (!disposed && last?.notification.request.identifier === value.notification.request.identifier)
|
|
76
93
|
await Notifications.clearLastNotificationResponseAsync();
|
|
@@ -91,8 +108,11 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
91
108
|
await Notifications.dismissNotificationAsync(n.id);
|
|
92
109
|
}
|
|
93
110
|
})().finally(() => { reconciling = undefined; });
|
|
94
|
-
const foreground = AppState.addEventListener('change', state => { if (state === 'active')
|
|
95
|
-
void reconcile().catch(options.onError);
|
|
111
|
+
const foreground = AppState.addEventListener('change', state => { if (state === 'active') {
|
|
112
|
+
void reconcile().catch(options.onError);
|
|
113
|
+
if (cutoverPending && lastToken && !disposed && !closing)
|
|
114
|
+
void register(lastToken).catch(options.onError);
|
|
115
|
+
} });
|
|
96
116
|
const ready = (async () => {
|
|
97
117
|
if (Platform.OS === 'android') {
|
|
98
118
|
await Notifications.setNotificationChannelAsync('robono-messages', { name: 'Messages', importance: Notifications.AndroidImportance.HIGH });
|
|
@@ -106,7 +126,7 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
106
126
|
await reconcile();
|
|
107
127
|
})();
|
|
108
128
|
void ready.catch(options.onError);
|
|
109
|
-
const dispose = () => { disposed = true; router.dispose(); tokenListener.remove(); received.remove(); opened.remove(); foreground.remove(); void options.systemCalls?.disconnect().catch(options.onError); };
|
|
129
|
+
const dispose = () => { disposed = true; router.dispose(); reviewRouter?.dispose(); tokenListener.remove(); received.remove(); opened.remove(); foreground.remove(); void options.systemCalls?.disconnect().catch(options.onError); };
|
|
110
130
|
return {
|
|
111
131
|
ready, reconcile,
|
|
112
132
|
/** Call only after the user chooses Enable notifications in your interface. */
|
|
@@ -114,7 +134,7 @@ export async function connectExpoMessagingNotifications(options) {
|
|
|
114
134
|
return false; const permission = await Notifications.requestPermissionsAsync(); if (!permission.granted)
|
|
115
135
|
return false; await register(await Notifications.getDevicePushTokenAsync()); return true; },
|
|
116
136
|
/** Await before revoking your login session, so the old account's token is removed. */
|
|
117
|
-
async signOut() { closing = true; router.dispose(); try {
|
|
137
|
+
async signOut() { closing = true; router.dispose(); reviewRouter?.dispose(); try {
|
|
118
138
|
await registerQueue;
|
|
119
139
|
await request({ operation: 'remove-device', deviceId });
|
|
120
140
|
}
|
package/dist/expo-outbox.d.ts
CHANGED
|
@@ -9,5 +9,7 @@ export declare function createExpoMessagingClient(options: {
|
|
|
9
9
|
fetch?: typeof fetch;
|
|
10
10
|
persistence?: false;
|
|
11
11
|
namespace?: string;
|
|
12
|
+
historyAccess?: 'authorized-cache' | 'online';
|
|
13
|
+
deviceHistory?: import('@robono/messaging').MessagingDeviceHistory;
|
|
12
14
|
transformRequest?: MessagingRequest;
|
|
13
15
|
}): MessagingClient;
|
package/dist/expo-outbox.js
CHANGED
|
@@ -94,7 +94,7 @@ const files = {
|
|
|
94
94
|
export function createExpoMessagingClient(options) {
|
|
95
95
|
const request = createMessagingTransport(options), store = options.persistence === false ? undefined : new NativeMessagingOutbox(options.url, options.userId, files, options.namespace);
|
|
96
96
|
const saved = store ? new ExpoSavedMessages(options.url, options.userId, options.namespace) : undefined;
|
|
97
|
-
const client = new MessagingClient({ request, userId: options.userId, createMessageId: Crypto.randomUUID, outbox: store, saved, historyCache: store ? createExpoMessagingHistory(options.url, options.userId, options.namespace) : undefined, transformRequest: options.transformRequest });
|
|
97
|
+
const client = new MessagingClient({ request, historyAccess: options.historyAccess, deviceHistory: options.deviceHistory, userId: options.userId, createMessageId: Crypto.randomUUID, outbox: store, saved, historyCache: store ? createExpoMessagingHistory(options.url, options.userId, options.namespace) : undefined, transformRequest: options.transformRequest });
|
|
98
98
|
if (store)
|
|
99
99
|
stores.set(client, store);
|
|
100
100
|
if (saved)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type MessagingRequest } from '@robono/messaging';
|
|
3
|
+
import { type ExpoMessagingScreenProps } from './expo-screen.js';
|
|
4
|
+
import { type MessagingAudioSession } from './expo-media.js';
|
|
5
|
+
export interface ExpoMessagingOversightProps extends Pick<ExpoMessagingScreenProps, 'contact' | 'participants' | 'appearance' | 'header' | 'interfaceLocale' | 'onBack' | 'style' | 'onDownloadAttachment' | 'mediaViewer' | 'linkHandling' | 'conversationMode' | 'keyboard'> {
|
|
6
|
+
endpoint: string;
|
|
7
|
+
request: MessagingRequest;
|
|
8
|
+
reviewerId: string;
|
|
9
|
+
subjectId: string;
|
|
10
|
+
conversationId: string;
|
|
11
|
+
audioSession: MessagingAudioSession;
|
|
12
|
+
}
|
|
13
|
+
/** Uses the shared image/video/document/voice viewers. Reviewer activity never
|
|
14
|
+
* calls the subject's read, consumed, presence or message-mutation endpoints. */
|
|
15
|
+
export declare function ExpoMessagingOversight({ endpoint, request, reviewerId, subjectId, conversationId, audioSession, mediaViewer, ...screen }: ExpoMessagingOversightProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { createMessagingOversightMediaRequest } from '@robono/messaging';
|
|
4
|
+
import { useMessagingOversightSession } from './oversight-session.js';
|
|
5
|
+
import { ExpoMessagingScreen } from './expo-screen.js';
|
|
6
|
+
import { createExpoMessagingStorage } from './expo-media.js';
|
|
7
|
+
/** Uses the shared image/video/document/voice viewers. Reviewer activity never
|
|
8
|
+
* calls the subject's read, consumed, presence or message-mutation endpoints. */
|
|
9
|
+
export function ExpoMessagingOversight({ endpoint, request, reviewerId, subjectId, conversationId, audioSession, mediaViewer, ...screen }) {
|
|
10
|
+
const client = useMessagingOversightSession(request, reviewerId, subjectId, conversationId);
|
|
11
|
+
const storage = useMemo(() => createExpoMessagingStorage({ url: endpoint, getAccessToken: async () => { throw Error('Use the authorized oversight request.'); }, request: createMessagingOversightMediaRequest({ request, subjectId }) }), [endpoint, request, subjectId]);
|
|
12
|
+
if (!client)
|
|
13
|
+
return null;
|
|
14
|
+
return _jsx(ExpoMessagingScreen, { ...screen, client: client, userId: subjectId, storage: storage, audioSession: audioSession, mediaViewer: { download: !!screen.onDownloadAttachment, share: false, open: false, ...mediaViewer, forward: false, delete: false }, preloadRecentMedia: false, languageTools: { translation: false, transcription: false, voiceOutput: false } });
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type MessagingAudioSession } from './expo-media.js';
|
|
3
|
+
import { type MessagingReviewInboxProps } from "./reviews.js";
|
|
4
|
+
export declare function ExpoMessageReviewInbox({ audioSession, ...props }: Omit<MessagingReviewInboxProps, "renderMedia"> & {
|
|
5
|
+
audioSession?: MessagingAudioSession;
|
|
6
|
+
}): React.JSX.Element;
|