@arbidocs/react 0.5.53 → 0.5.55
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/README.md +15 -0
- package/dist/artifacts/index.cjs +9 -9
- package/dist/artifacts/index.js +3 -3
- package/dist/calls/livekit/index.cjs +48 -48
- package/dist/calls/livekit/index.js +3 -3
- package/dist/{chunk-ME4TS33T.cjs → chunk-2JQ7QNOO.cjs} +31 -31
- package/dist/{chunk-ME4TS33T.cjs.map → chunk-2JQ7QNOO.cjs.map} +1 -1
- package/dist/{chunk-W7DQJT4T.cjs → chunk-3CVY5SGY.cjs} +159 -22
- package/dist/chunk-3CVY5SGY.cjs.map +1 -0
- package/dist/{chunk-KOLCL4KV.js → chunk-4TKNUJKD.js} +3 -3
- package/dist/{chunk-KOLCL4KV.js.map → chunk-4TKNUJKD.js.map} +1 -1
- package/dist/{chunk-MB34NKBZ.js → chunk-DFZECLD3.js} +2 -2
- package/dist/chunk-DFZECLD3.js.map +1 -0
- package/dist/{chunk-G3GPVSTA.js → chunk-JFL7BBZ6.js} +3 -3
- package/dist/{chunk-G3GPVSTA.js.map → chunk-JFL7BBZ6.js.map} +1 -1
- package/dist/{chunk-BIHGAW4G.js → chunk-PVUZULHI.js} +3 -3
- package/dist/{chunk-BIHGAW4G.js.map → chunk-PVUZULHI.js.map} +1 -1
- package/dist/{chunk-ODGIOGH5.cjs → chunk-UKEUDTOE.cjs} +16 -16
- package/dist/{chunk-ODGIOGH5.cjs.map → chunk-UKEUDTOE.cjs.map} +1 -1
- package/dist/{chunk-ONGNP4JM.cjs → chunk-V64EETLS.cjs} +4 -4
- package/dist/{chunk-ONGNP4JM.cjs.map → chunk-V64EETLS.cjs.map} +1 -1
- package/dist/{chunk-JQSHGBNI.js → chunk-WRMA2JYX.js} +139 -8
- package/dist/chunk-WRMA2JYX.js.map +1 -0
- package/dist/{chunk-YIUUTRMQ.cjs → chunk-YRY6DGRU.cjs} +2 -2
- package/dist/chunk-YRY6DGRU.cjs.map +1 -0
- package/dist/document-tools/index.cjs +41 -41
- package/dist/document-tools/index.js +3 -3
- package/dist/index.cjs +797 -780
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -122
- package/dist/index.d.ts +202 -122
- package/dist/index.js +37 -43
- package/dist/index.js.map +1 -1
- package/dist/viewers/index.cjs +2 -2
- package/dist/viewers/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-JQSHGBNI.js.map +0 -1
- package/dist/chunk-MB34NKBZ.js.map +0 -1
- package/dist/chunk-W7DQJT4T.cjs.map +0 -1
- package/dist/chunk-YIUUTRMQ.cjs.map +0 -1
|
@@ -1,13 +1,144 @@
|
|
|
1
|
-
import { clearSealedDrafts, useWorkspaces } from './chunk-
|
|
1
|
+
import { clearSealedDrafts, useWorkspaces } from './chunk-PVUZULHI.js';
|
|
2
2
|
import { arbiQueryKeys, callQueryKeys } from './chunk-PBXJFMES.js';
|
|
3
3
|
import { notify } from './chunk-5HDC43MF.js';
|
|
4
4
|
import { getUserDisplayName, DEFAULT_SEGMENTER_CONFIG, INITIAL_SEGMENTER_STATE, flushSegmenter, stepSegmenter, levelFromRms } from './chunk-APZZQZ6P.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useArbi, useArbiHost } from './chunk-DFZECLD3.js';
|
|
6
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
7
7
|
import { useSyncExternalStore, useEffect, useState, useCallback, useMemo } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { chats, calls, ArbiApiError, CallApiError, documents, continuityPrompt } from '@arbidocs/sdk/browser';
|
|
9
9
|
import { generateChatKey, sealCallKey, sealChatKey, decryptCallTitle, encryptWithChatKey, decryptWithChatKey, initSodium, bytesToBase64, encryptFile, decryptFile, base64ToBytes, buildCallLink, encryptCallTitle } from '@arbidocs/client';
|
|
10
10
|
|
|
11
|
+
function useUserSettings(options) {
|
|
12
|
+
const arbi = useArbi();
|
|
13
|
+
return useQuery({
|
|
14
|
+
queryKey: arbiQueryKeys.userSettings(),
|
|
15
|
+
queryFn: () => arbi.settings.get(),
|
|
16
|
+
// Edited about once a month, and every write here patches the cache: no refetch on each mount.
|
|
17
|
+
staleTime: 30 * 60 * 1e3,
|
|
18
|
+
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function useUpdateUserSettings() {
|
|
22
|
+
const arbi = useArbi();
|
|
23
|
+
const qc = useQueryClient();
|
|
24
|
+
return useMutation({
|
|
25
|
+
mutationFn: (patch) => arbi.settings.update(patch),
|
|
26
|
+
onMutate: async (patch) => {
|
|
27
|
+
await qc.cancelQueries({ queryKey: arbiQueryKeys.userSettings() });
|
|
28
|
+
const previous = qc.getQueryData(arbiQueryKeys.userSettings());
|
|
29
|
+
qc.setQueryData(
|
|
30
|
+
arbiQueryKeys.userSettings(),
|
|
31
|
+
(old) => old ? { ...old, ...patch } : old
|
|
32
|
+
);
|
|
33
|
+
return { previous };
|
|
34
|
+
},
|
|
35
|
+
onError: (_err, _patch, context) => {
|
|
36
|
+
qc.setQueryData(arbiQueryKeys.userSettings(), context?.previous);
|
|
37
|
+
},
|
|
38
|
+
onSettled: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() })
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var ALWAYS_ON = { on: true, set: () => {
|
|
42
|
+
} };
|
|
43
|
+
function useUnlisted() {
|
|
44
|
+
return ALWAYS_ON;
|
|
45
|
+
}
|
|
46
|
+
function useUserSettingSwitch(source) {
|
|
47
|
+
const { userSetting, default: fallback } = source;
|
|
48
|
+
const { data } = useUserSettings();
|
|
49
|
+
const { mutate } = useUpdateUserSettings();
|
|
50
|
+
const saved = data?.[userSetting];
|
|
51
|
+
const set = useCallback((on) => mutate({ [userSetting]: on }), [mutate, userSetting]);
|
|
52
|
+
return { on: saved ?? fallback, set };
|
|
53
|
+
}
|
|
54
|
+
function useLocalSwitch(source, feature) {
|
|
55
|
+
const { local, default: fallback } = source;
|
|
56
|
+
const saved = useSyncExternalStore(local.subscribe, () => local.get(feature));
|
|
57
|
+
const set = useCallback((on) => local.set(feature, on), [local, feature]);
|
|
58
|
+
return { on: saved ?? fallback, set };
|
|
59
|
+
}
|
|
60
|
+
function useFeatureSwitch(feature) {
|
|
61
|
+
const source = useArbiHost().features?.[feature];
|
|
62
|
+
const useSource = !source ? useUnlisted : "userSetting" in source ? useUserSettingSwitch : useLocalSwitch;
|
|
63
|
+
return useSource(source, feature);
|
|
64
|
+
}
|
|
65
|
+
function useFeature(feature) {
|
|
66
|
+
return useFeatureSwitch(feature).on;
|
|
67
|
+
}
|
|
68
|
+
function readLocalFeature(features, feature) {
|
|
69
|
+
const source = features[feature];
|
|
70
|
+
if (!source) return true;
|
|
71
|
+
if ("local" in source) return source.local.get(feature) ?? source.default;
|
|
72
|
+
return source.default;
|
|
73
|
+
}
|
|
74
|
+
function defaultStorage() {
|
|
75
|
+
try {
|
|
76
|
+
return typeof localStorage === "undefined" ? null : localStorage;
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function parseValues(raw) {
|
|
82
|
+
if (raw === null) return null;
|
|
83
|
+
try {
|
|
84
|
+
const parsed = JSON.parse(raw);
|
|
85
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {};
|
|
86
|
+
return Object.fromEntries(
|
|
87
|
+
Object.entries(parsed).filter(([, value]) => typeof value === "boolean")
|
|
88
|
+
);
|
|
89
|
+
} catch {
|
|
90
|
+
return {};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function createLocalFeatureStore({
|
|
94
|
+
key,
|
|
95
|
+
storage = defaultStorage(),
|
|
96
|
+
migrate
|
|
97
|
+
}) {
|
|
98
|
+
const listeners3 = /* @__PURE__ */ new Set();
|
|
99
|
+
const read = () => {
|
|
100
|
+
try {
|
|
101
|
+
return storage?.getItem(key) ?? null;
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const write = () => {
|
|
107
|
+
try {
|
|
108
|
+
storage?.setItem(key, JSON.stringify(values));
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const notify2 = () => listeners3.forEach((listener) => listener());
|
|
113
|
+
const saved = parseValues(read());
|
|
114
|
+
let values = saved ?? {};
|
|
115
|
+
let hydrated = saved !== null || !migrate;
|
|
116
|
+
const ready = hydrated ? Promise.resolve() : migrate().catch((error) => {
|
|
117
|
+
console.warn(`[features] The saved ${key} could not be brought in`, error);
|
|
118
|
+
return null;
|
|
119
|
+
}).then((earlier) => {
|
|
120
|
+
values = { ...earlier ?? {}, ...values };
|
|
121
|
+
write();
|
|
122
|
+
hydrated = true;
|
|
123
|
+
notify2();
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
get: (feature) => values[feature],
|
|
127
|
+
set(feature, on) {
|
|
128
|
+
if (values[feature] === on) return;
|
|
129
|
+
values = { ...values, [feature]: on };
|
|
130
|
+
write();
|
|
131
|
+
notify2();
|
|
132
|
+
},
|
|
133
|
+
subscribe(listener) {
|
|
134
|
+
listeners3.add(listener);
|
|
135
|
+
return () => listeners3.delete(listener);
|
|
136
|
+
},
|
|
137
|
+
isHydrated: () => hydrated,
|
|
138
|
+
hydrated: () => ready
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
11
142
|
// src/conversation-list.ts
|
|
12
143
|
function isConversationListKey(queryKey) {
|
|
13
144
|
return queryKey.length === 3 && queryKey[0] === "arbi" && queryKey[1] === "conversations";
|
|
@@ -2313,7 +2444,7 @@ function useMeetingReadOnly(lockedWorkspaceExtId) {
|
|
|
2313
2444
|
function useCallsEnabled() {
|
|
2314
2445
|
const serverEnabled = useServerCallsEnabled();
|
|
2315
2446
|
const experimental = useServerCallsExperimental();
|
|
2316
|
-
const switchedOn =
|
|
2447
|
+
const switchedOn = useFeature("calls");
|
|
2317
2448
|
return serverEnabled && (switchedOn || !experimental);
|
|
2318
2449
|
}
|
|
2319
2450
|
function useCanHostCalls() {
|
|
@@ -2341,6 +2472,6 @@ function useOpenCallMeetingChat() {
|
|
|
2341
2472
|
);
|
|
2342
2473
|
}
|
|
2343
2474
|
|
|
2344
|
-
export { AUDIENCE_CHOICES, CALL_CAPTION_TOPIC, CALL_CHAT_MAX_CHARS, CALL_CHAT_TOPIC, CALL_MODERATION_TOPIC, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, CALL_WEBINAR_TOPIC, CAPTION_MAX_CHARS, COMPOSITE_AUDIO_BITS_PER_SECOND, COMPOSITE_VIDEO_BITS_PER_SECOND, DEFAULT_JOIN_CHOICES, EMPTY_CALL_SESSION, EXPORT_SAMPLE_RATE, HISTORY_LIMIT, LIVE_SEGMENTER, MAX_AVATAR_FILE_BYTES, MUTED_DEDUPE_MS, PLAYBACK_LOOKAHEAD_MS, READ_ONLY_MEETING_TEXT, RECORDING_CHUNK_MS, RECORDING_SEGMENTER, SEGMENT_FRAME_MS, SEGMENT_ID_PATTERN, SEGMENT_PRE_ROLL_MS, SHORT_PIECE_MERGE_GAP_MS, SPEAKER_AUDIO_BITS_PER_SECOND, TrackUploader, UPLOAD_ATTEMPTS, UPLOAD_BACKOFF_MS, acceptRing, addConversationToList, appendToThread, applyAgentDmStatus, applyCallEvent, applyChatEvent, applyChatMessage, applyChatRead, applyChatUpdated, arbiAccountClient, buildMeetingChatBody, cachedChat, cachedChats, callLink, callMemberKeys, callSession, chatByExtId, chatHasLiveCall, chatLiveCallId, chatTranscriptRef, clearMeetingChatCache, clearTrackUploaders, clockTime, compositeFiles, compositeTrack, conversationKeyForCall, createMutedNotifier, createTrackCutter, cutAtPauses, declineRing, decodeCallChatPacket, decodeCaptionPacket, decodeMono16k, decryptPart, deleteChatMessage, dropFromThread, encodeCallChatPacket, encodeCaptionPacket, encodeWav, encryptPart, ensureMeetingChat, entitlementRefusal, extensionFor, fetchPart, fileSafe, findConversation, floatToWav, formatTranscriptMarkdown, getOpenChat, hasRecordingTranscript, invalidateCall, invalidateConversationDetails, invalidateConversationLists, isConversationListKey, isConversationShared, isKnownSoloConversation, isRecordingOver, isRecordingSegmentId, isRetryable, isWorkspaceGuestOf, joinFromPreJoin, knownMeetingChat, loadMeetingHistory, markRejoining, meetingChatRefFrom, meetingRefForCall, mergeChatLines, mutedNoticeFromEvent, mutedNoticeFromPacket, mutedNoticeText, myChatId, newPacketId, newSegmentId, newTrackKey, nextSeqAfter, onCallEvent, openCall, openQuestion, openRecording, parseWebinarPacket, partKey, partOffsetMs, partsDue, patchConversation, patchConversationList, persistMeetingMessage, persistTranscriptSegment, playheadAt, postRecordingDocsToThread, postTranscriptToThread, recordingFiles, recordingWindowsOf, rejoinAsAudience, removeChat, removeConversationFromLists, resetCallSession, resolveMeetingChat, saveRecordingFilesToThread, schedulePart, sealQuestionText, serverCallsExperimental, setOpenChat, sortTranscriptMessages, sortedParts, speakerTracks, speakerWav, splitIntoFiles, standalone, startChatCall, startContactsCall, startDmCall, startThreadCall, startsMediaFile, storeTranscriptSegment, stripSpeakerPrefix, supersedeLiveTranscript, supersededTranscriptLines, threadHasLiveCall, threadLiveCallId, threadTranscriptLines, threadTranscriptRef, threadTranscriptText, timelineDurationMs, timelineOf, toProfileView, trackUploaderFor, transcribeRecording, transcriptPersistRole, transcriptSegmentOf, unwrapTrackKey, upsertChat, useAccountClient, useAvatarCrop, useCall, useCallInviteLinks, useCallRecording, useCallRecordings, useCallSession, useCallTranscriptionAvailable, useCallsConfig, useCallsEnabled, useCanHostCalls, useEntitlements, useIsEntitled, useMeetingReadOnly, useNameEditor, useOpenCallMeetingChat, useProfile, useRecordingActions, useRecordingWindows, useRevokeCallInviteLink, useSaveToThread, useServerCallsEnabled, useServerCallsExperimental, useUpdateProfile, wrapTrackKey, writeSamples };
|
|
2345
|
-
//# sourceMappingURL=chunk-
|
|
2346
|
-
//# sourceMappingURL=chunk-
|
|
2475
|
+
export { AUDIENCE_CHOICES, CALL_CAPTION_TOPIC, CALL_CHAT_MAX_CHARS, CALL_CHAT_TOPIC, CALL_MODERATION_TOPIC, CALL_RECORDING_TOPIC, CALL_TRANSCRIPTION_TOPIC, CALL_WEBINAR_TOPIC, CAPTION_MAX_CHARS, COMPOSITE_AUDIO_BITS_PER_SECOND, COMPOSITE_VIDEO_BITS_PER_SECOND, DEFAULT_JOIN_CHOICES, EMPTY_CALL_SESSION, EXPORT_SAMPLE_RATE, HISTORY_LIMIT, LIVE_SEGMENTER, MAX_AVATAR_FILE_BYTES, MUTED_DEDUPE_MS, PLAYBACK_LOOKAHEAD_MS, READ_ONLY_MEETING_TEXT, RECORDING_CHUNK_MS, RECORDING_SEGMENTER, SEGMENT_FRAME_MS, SEGMENT_ID_PATTERN, SEGMENT_PRE_ROLL_MS, SHORT_PIECE_MERGE_GAP_MS, SPEAKER_AUDIO_BITS_PER_SECOND, TrackUploader, UPLOAD_ATTEMPTS, UPLOAD_BACKOFF_MS, acceptRing, addConversationToList, appendToThread, applyAgentDmStatus, applyCallEvent, applyChatEvent, applyChatMessage, applyChatRead, applyChatUpdated, arbiAccountClient, buildMeetingChatBody, cachedChat, cachedChats, callLink, callMemberKeys, callSession, chatByExtId, chatHasLiveCall, chatLiveCallId, chatTranscriptRef, clearMeetingChatCache, clearTrackUploaders, clockTime, compositeFiles, compositeTrack, conversationKeyForCall, createLocalFeatureStore, createMutedNotifier, createTrackCutter, cutAtPauses, declineRing, decodeCallChatPacket, decodeCaptionPacket, decodeMono16k, decryptPart, deleteChatMessage, dropFromThread, encodeCallChatPacket, encodeCaptionPacket, encodeWav, encryptPart, ensureMeetingChat, entitlementRefusal, extensionFor, fetchPart, fileSafe, findConversation, floatToWav, formatTranscriptMarkdown, getOpenChat, hasRecordingTranscript, invalidateCall, invalidateConversationDetails, invalidateConversationLists, isConversationListKey, isConversationShared, isKnownSoloConversation, isRecordingOver, isRecordingSegmentId, isRetryable, isWorkspaceGuestOf, joinFromPreJoin, knownMeetingChat, loadMeetingHistory, markRejoining, meetingChatRefFrom, meetingRefForCall, mergeChatLines, mutedNoticeFromEvent, mutedNoticeFromPacket, mutedNoticeText, myChatId, newPacketId, newSegmentId, newTrackKey, nextSeqAfter, onCallEvent, openCall, openQuestion, openRecording, parseWebinarPacket, partKey, partOffsetMs, partsDue, patchConversation, patchConversationList, persistMeetingMessage, persistTranscriptSegment, playheadAt, postRecordingDocsToThread, postTranscriptToThread, readLocalFeature, recordingFiles, recordingWindowsOf, rejoinAsAudience, removeChat, removeConversationFromLists, resetCallSession, resolveMeetingChat, saveRecordingFilesToThread, schedulePart, sealQuestionText, serverCallsExperimental, setOpenChat, sortTranscriptMessages, sortedParts, speakerTracks, speakerWav, splitIntoFiles, standalone, startChatCall, startContactsCall, startDmCall, startThreadCall, startsMediaFile, storeTranscriptSegment, stripSpeakerPrefix, supersedeLiveTranscript, supersededTranscriptLines, threadHasLiveCall, threadLiveCallId, threadTranscriptLines, threadTranscriptRef, threadTranscriptText, timelineDurationMs, timelineOf, toProfileView, trackUploaderFor, transcribeRecording, transcriptPersistRole, transcriptSegmentOf, unwrapTrackKey, upsertChat, useAccountClient, useAvatarCrop, useCall, useCallInviteLinks, useCallRecording, useCallRecordings, useCallSession, useCallTranscriptionAvailable, useCallsConfig, useCallsEnabled, useCanHostCalls, useEntitlements, useFeature, useFeatureSwitch, useIsEntitled, useMeetingReadOnly, useNameEditor, useOpenCallMeetingChat, useProfile, useRecordingActions, useRecordingWindows, useRevokeCallInviteLink, useSaveToThread, useServerCallsEnabled, useServerCallsExperimental, useUpdateProfile, useUpdateUserSettings, useUserSettings, wrapTrackKey, writeSamples };
|
|
2476
|
+
//# sourceMappingURL=chunk-WRMA2JYX.js.map
|
|
2477
|
+
//# sourceMappingURL=chunk-WRMA2JYX.js.map
|