@arbidocs/blocks 0.5.32 → 0.5.33
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/dist/{ConnectedNativeDocxComparison-X6NTNHHM.cjs → ConnectedNativeDocxComparison-H2OZMWHT.cjs} +7 -7
- package/dist/{ConnectedNativeDocxComparison-X6NTNHHM.cjs.map → ConnectedNativeDocxComparison-H2OZMWHT.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-4RHC6KCE.js → ConnectedNativeDocxComparison-RWKFPJPJ.js} +6 -6
- package/dist/{ConnectedNativeDocxComparison-4RHC6KCE.js.map → ConnectedNativeDocxComparison-RWKFPJPJ.js.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-S5AT2UAH.js → ConnectedNativeDocxEditor-43BI5LN6.js} +5 -5
- package/dist/{ConnectedNativeDocxEditor-S5AT2UAH.js.map → ConnectedNativeDocxEditor-43BI5LN6.js.map} +1 -1
- package/dist/{ConnectedNativeDocxEditor-U75VOJBC.cjs → ConnectedNativeDocxEditor-6DQEM6SD.cjs} +7 -7
- package/dist/{ConnectedNativeDocxEditor-U75VOJBC.cjs.map → ConnectedNativeDocxEditor-6DQEM6SD.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-QAZ5VQZS.cjs → ConnectedStreamedWordArtifact-3VKYIG6C.cjs} +7 -7
- package/dist/ConnectedStreamedWordArtifact-3VKYIG6C.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-7XU5RSX2.js → ConnectedStreamedWordArtifact-TEB332E3.js} +6 -6
- package/dist/{ConnectedStreamedWordArtifact-7XU5RSX2.js.map → ConnectedStreamedWordArtifact-TEB332E3.js.map} +1 -1
- package/dist/calls/index.cjs +32 -32
- package/dist/calls/index.js +4 -4
- package/dist/{chunk-2MCHQGVY.js → chunk-24H5WTGM.js} +4 -4
- package/dist/{chunk-2MCHQGVY.js.map → chunk-24H5WTGM.js.map} +1 -1
- package/dist/{chunk-D57MPMTZ.js → chunk-2YCCCXYV.js} +12 -3
- package/dist/chunk-2YCCCXYV.js.map +1 -0
- package/dist/{chunk-BNOP4REH.js → chunk-5JEM3BWT.js} +3 -3
- package/dist/{chunk-BNOP4REH.js.map → chunk-5JEM3BWT.js.map} +1 -1
- package/dist/{chunk-ZIURNTTS.cjs → chunk-BIWPXSGS.cjs} +7 -7
- package/dist/{chunk-ZIURNTTS.cjs.map → chunk-BIWPXSGS.cjs.map} +1 -1
- package/dist/{chunk-2RFXSBPD.cjs → chunk-BRYRZOS3.cjs} +4 -4
- package/dist/{chunk-2RFXSBPD.cjs.map → chunk-BRYRZOS3.cjs.map} +1 -1
- package/dist/{chunk-EPQ3364Q.cjs → chunk-C3YIVBTU.cjs} +6 -6
- package/dist/{chunk-EPQ3364Q.cjs.map → chunk-C3YIVBTU.cjs.map} +1 -1
- package/dist/{chunk-JBR3QNHC.cjs → chunk-EFSL4O3B.cjs} +4 -4
- package/dist/{chunk-JBR3QNHC.cjs.map → chunk-EFSL4O3B.cjs.map} +1 -1
- package/dist/{chunk-SBTRXXJF.cjs → chunk-JVXHVFUA.cjs} +11 -2
- package/dist/chunk-JVXHVFUA.cjs.map +1 -0
- package/dist/{chunk-XBY36SIJ.js → chunk-MLHOG7YH.js} +3 -3
- package/dist/{chunk-XBY36SIJ.js.map → chunk-MLHOG7YH.js.map} +1 -1
- package/dist/{chunk-B5G3AZ3O.js → chunk-N3HVTMQK.js} +3 -3
- package/dist/{chunk-B5G3AZ3O.js.map → chunk-N3HVTMQK.js.map} +1 -1
- package/dist/{chunk-3ES6VWRB.cjs → chunk-NOKTUWTN.cjs} +7 -7
- package/dist/{chunk-3ES6VWRB.cjs.map → chunk-NOKTUWTN.cjs.map} +1 -1
- package/dist/{chunk-EOLQ5YBP.js → chunk-NUV5F6MM.js} +3 -3
- package/dist/{chunk-EOLQ5YBP.js.map → chunk-NUV5F6MM.js.map} +1 -1
- package/dist/{chunk-NQWP5PWA.js → chunk-VKY4SQMH.js} +4 -4
- package/dist/{chunk-NQWP5PWA.js.map → chunk-VKY4SQMH.js.map} +1 -1
- package/dist/{chunk-ULA6YWWD.cjs → chunk-VMLEISRZ.cjs} +15 -15
- package/dist/{chunk-ULA6YWWD.cjs.map → chunk-VMLEISRZ.cjs.map} +1 -1
- package/dist/{chunk-DY2Z3DP7.js → chunk-VPWCARVO.js} +3 -3
- package/dist/{chunk-DY2Z3DP7.js.map → chunk-VPWCARVO.js.map} +1 -1
- package/dist/{chunk-L22MGRKB.cjs → chunk-XFSEPGF7.cjs} +4 -4
- package/dist/{chunk-L22MGRKB.cjs.map → chunk-XFSEPGF7.cjs.map} +1 -1
- package/dist/connect/docx.cjs +9 -9
- package/dist/connect/docx.js +5 -5
- package/dist/connect/index.cjs +129 -129
- package/dist/connect/index.js +11 -11
- package/dist/connect/viewer.cjs +24 -24
- package/dist/connect/viewer.js +7 -7
- package/dist/studio/index.cjs +4 -4
- package/dist/studio/index.js +2 -2
- package/dist/workflow-canvas/index.cjs +6 -6
- package/dist/workflow-canvas/index.js +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedStreamedWordArtifact-QAZ5VQZS.cjs.map +0 -1
- package/dist/chunk-D57MPMTZ.js.map +0 -1
- package/dist/chunk-SBTRXXJF.cjs.map +0 -1
package/dist/connect/index.js
CHANGED
|
@@ -9,11 +9,11 @@ import { HomeLoadError, HomeFrame, HomeMain, HomeCenteredScroll, HomeCenteredCol
|
|
|
9
9
|
import { ProjectBandTitle, PlainBandTitle } from '../chunk-RQKWYKZY.js';
|
|
10
10
|
import '../chunk-WZ63HE2C.js';
|
|
11
11
|
import { MessageJsonTree, DraggableHeader, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, DeleteAccountDialog, toDeleteBlockerViews, PremiumModelsFrame, ConnectionsLoading, ConnectionsError, ConnectionsEmpty, UsageToggle, SettingsPage, UsageSummary, AppearanceSettings, UsageLineChart, SyncDialogBody, SyncField, SyncSelect, SyncSmallNote, SyncLoading, SyncReconnectNotice, SyncNote, SyncTreeFrame, SyncLinkRow, SyncLinkButton, SyncOptions, SyncOptionToggle, SyncDialogFooter, InvoicesDialog, PlanDialogFrame, ProjectList, RenameDialog, SharedProjectsSection, SharedProjectRow, MoreInfo, MoreInfoList, UsagePanel, UsageQuotaHint, UsageSection, UsageLegend, UsageProportionBar, UsageActionButton, ProjectDetailHeader, PlanBadge, ProjectDetailSection, PlanStack, PlanNotice, PlanPickerCard, PlanPickerHeader, PricingToggle, PromoCodeInput, PlanActionButton, QuotaExceededDialogView, InviteContactsDialog, WelcomeDialog, applyTriStateFilters, PanelFrame, PanelAddButton, PanelFrameBody, PanelScroll, PanelActionsRow, applyInvertedIndexFilter, ConfigSwitcherBar, PanelNote, ProjectRow, QuotaMeter, FilterChip, buildInvertedIndex, serverConnectionView, ServerConnectionButton, ModelProviderLabel, SyncFolderRow, SyncFolderStatus, PlanTierOption, PlanActionRow, SubscriptionStatusView, DailyCapField, PlanInfoPopover, PlanCardGrid, ReferralRewardSummary, CheckoutDialogFrame, ConnectionCard, ReferralRewardNote } from '../chunk-ICCBNHPU.js';
|
|
12
|
-
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-
|
|
13
|
-
import { useConnectedWorkspaceRole, ConnectedWorkflowLauncher, useConnectedWorkflowScopeSource, ConnectedWorkflowDocumentsField, ConnectedNativeDocxEditor, toWorkflowFieldDocument } from '../chunk-
|
|
14
|
-
export { ConnectedWorkflowDocumentsField, ConnectedWorkflowLauncher, ConnectedWorkflowsTable, DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, toWorkflowFieldDocument, useConnectedAgentOptions, useConnectedWorkflowScopeSource, useConnectedWorkspaceRole, useDocxCommentTarget, useNativeDocxSupport } from '../chunk-
|
|
15
|
-
import { ConnectedMarkdown, InternalDocLink, ExternalLink, DocumentWorkspaceContext } from '../chunk-
|
|
16
|
-
export { ConnectedDocumentToolsProvider, ConnectedMarkdown, DocumentChip, DocumentWorkspaceContext, ExternalLink, InternalDocLink, MailChip, MermaidDiagram, WorkspaceDocumentReference, useDocumentViewerSupport, useDocumentWorkspace, useViewerDraftDocument, useViewerIsDetached, useViewerPassageCitation, useViewerStreamingDocument } from '../chunk-
|
|
12
|
+
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-N3HVTMQK.js';
|
|
13
|
+
import { useConnectedWorkspaceRole, ConnectedWorkflowLauncher, useConnectedWorkflowScopeSource, ConnectedWorkflowDocumentsField, ConnectedNativeDocxEditor, toWorkflowFieldDocument } from '../chunk-VKY4SQMH.js';
|
|
14
|
+
export { ConnectedWorkflowDocumentsField, ConnectedWorkflowLauncher, ConnectedWorkflowsTable, DEFAULT_CONNECTED_WORKFLOWS_TABLE_LABELS, toWorkflowFieldDocument, useConnectedAgentOptions, useConnectedWorkflowScopeSource, useConnectedWorkspaceRole, useDocxCommentTarget, useNativeDocxSupport } from '../chunk-VKY4SQMH.js';
|
|
15
|
+
import { ConnectedMarkdown, InternalDocLink, ExternalLink, DocumentWorkspaceContext } from '../chunk-VPWCARVO.js';
|
|
16
|
+
export { ConnectedDocumentToolsProvider, ConnectedMarkdown, DocumentChip, DocumentWorkspaceContext, ExternalLink, InternalDocLink, MailChip, MermaidDiagram, WorkspaceDocumentReference, useDocumentViewerSupport, useDocumentWorkspace, useViewerDraftDocument, useViewerIsDetached, useViewerPassageCitation, useViewerStreamingDocument } from '../chunk-VPWCARVO.js';
|
|
17
17
|
import { ExplorerFileTile, formatFolderSegment, hasFolderProviderIcon, FolderProviderIcon, ExplorerFolderTile, StatusPill, FailedStageIcon, DocumentNameCellFrame, DocumentRowMenu, visibilityToggleTooltip, FolderCell, FolderCommandList, RelatedDocsCell, FilterButton, DOCUMENTS_ROW_HEIGHT_INITIAL, searchExplorerDocuments, buildExplorerEntries, collectFolderDocs, joinFolderPath, getExplorerDisplayName, RECENTLY_DELETED_HINT, RECENTLY_DELETED_HINT_PLURAL, canDeleteDocument, ExplorerFrame, ExplorerStage, ExplorerScroller, ExplorerLoadingTiles, ExplorerEmpty, ExplorerMarquee, ExplorerDropOverlay, ExplorerDragPreview, CheckboxCell, TagColumnHeader, ExplorerFileTooltip, visibilityAudience, TagFormRoot, TagFormNameField, TagFormSelectField, TagFormNote, TagFormOptionsEditor, TagFormInstructionField, TagFormMeta, TagFormFooter, TagFormSharedToggle, FilesViewCenter, FilesFilterBar, TransferProgressView, TransferResumeBanner, ExportResultsReport, TransferScopeChooser, TransferKindsPicker, TransferReferencesChooser, ExportMethodChooser, ExportWorkspacePicker, TransferConflictChooser, TransferPlanSummary, ExportFooter, ExportModalTitle, ROW_MIN, rowHeightForLines, linesForRowHeight, RowDensityControl, VendorLogo, FolderFilterButton, FolderPickerRow, UploadFrame, UploadContainer, SelectedFilesList, RejectedFilesList, UploadErrorMessage, UploadProgress, PrivacyExplainerModal, MultiSelectCellEditor, DOCUMENT_TYPE_OPTIONS, DEFAULT_DOCUMENT_COLUMNS, shareStateOf, BulkActionsBar, shareTooltipFor, parseFolderSegments, AiReviewDialogView, MoveToFolderDialog, sortFields, filterFieldsByName, fieldsApplyBarCopy, FieldsEditorRoot, FieldsEditorToolbar, FieldsEditorList, FieldRow, FieldsEmptyState, fieldsEmptyText, FieldsApplyBar, FieldsManagerDefinition, FieldsManagerBody, FieldsManagerTitle, BulkTagEditorDialog, BulkReplaceDialog, FieldValue, FieldFolderSelect, FieldFolderValue, FieldNativeSelect, FieldWithAttribution, EMAIL_VIEW_COLUMNS, useGridViews, ViewSelectorMenu, FilesAddMenu, applyColumnLayout, applyViewColumns, sortExplorerFiles, FilesPage, UrlInputDialog, FilesPageHeader, FilesToolbar, ExplorerFileNavigator, NavigatorPickerBar, FilesPageMain, DocumentGrid, resolveDocumentGridLayout, FilesModalFooter, BulkLabelSelectView, confirmHideFromMembers, DocumentsFolderButton, FilesTagsButton, UploadSourceSection, UploadSourcePicker, UploadBrowseButtons, canEditDocumentFields, FieldLabelsSelect, ShareToggle, FieldAttribution, UploadDropArea, canChangeVisibility, UploadUrlButton } from '../chunk-P6MVDOCL.js';
|
|
18
18
|
import { ViewToggle, DocumentViewToggle } from '../chunk-JJA6GQKH.js';
|
|
19
19
|
import { ModalBreadcrumbHeader, ModalCrumbs } from '../chunk-RC6VTY2H.js';
|
|
@@ -62,13 +62,13 @@ import { PasswordStrengthInput } from '../chunk-P6OLZGQA.js';
|
|
|
62
62
|
import { attendeeKey, upcomingOf, conferenceUrl, isWebinarConference, canJoinEvent, calendarToListItem, buildGridEvents, pendingCreateToGrid, newEventDraft, MiniMonth, CalendarList, CalendarGrid, printCalendar, EventDetails, ScopeDialog, CalendarFormDialog, ProposeTimeDialog, isCalendarAttachment, parseIcsInvite, formatEventWhen, groupSlotsByDay, publicBookingMessage, formatSlotRange, zoneOptions, buildTimeChangeRequest, eventToDraft, needsScope, validateDraft, CALENDAR_DEFAULT_LABELS, buildCreateBody, buildDeleteTarget, EventEditor, toSettingsValue, CalendarSettingsForm, describeCalendarError, normalizeFeedUrl, parseOverlayLink, isAllDayDraft, draftRangeUtc, freeBusyToRows, SchedulingAssistant, applySuggestion, toSuggestionViews, bookingLink, defaultRoomWindow, bookingToForm, emptyBookingForm, slugify, WeeklyHoursEditor, validateBookingForm, formToBookingBody, WEEKDAY_NAMES, formatBusy, buildEditRequest } from '../chunk-AWVGKHJT.js';
|
|
63
63
|
import { detectTimeZone, utcToDate, formatPlainDate, formatInZone, safeZone, todayInZone, addDays, listTimeZones, wallToUtc } from '../chunk-OJIX5NBN.js';
|
|
64
64
|
import { DocumentPicker } from '../chunk-WNDIVNPT.js';
|
|
65
|
-
import { useTranscriptRuns, TranscriptEntry, ThreadCallLogCard, RecordingCard, useMeetingThreadMessages, threadTranscriptRuns, useProvisionalSpeakers, TranscriptRunsContext, ProvisionalSpeakers, CallConversationEmpty } from '../chunk-
|
|
66
|
-
export { useMeetingThreadMessages } from '../chunk-
|
|
65
|
+
import { useTranscriptRuns, TranscriptEntry, ThreadCallLogCard, RecordingCard, useMeetingThreadMessages, threadTranscriptRuns, useProvisionalSpeakers, TranscriptRunsContext, ProvisionalSpeakers, CallConversationEmpty } from '../chunk-24H5WTGM.js';
|
|
66
|
+
export { useMeetingThreadMessages } from '../chunk-24H5WTGM.js';
|
|
67
67
|
import { parseCallLogDetail } from '../chunk-S3YRRD54.js';
|
|
68
|
-
import { useDocumentFilter, useConnectedTags, useConnectedDocuments, useConnectedConversations, useListedDocuments, listedDocuments } from '../chunk-
|
|
69
|
-
export { isListedDocument, useConnectedConversations, useConnectedDocuments, useConnectedTags, useDocumentFilter, useListedDocuments } from '../chunk-
|
|
70
|
-
import { useConnectedWorkspace, useConnection, useOptionalConnection, ConnectionProvider } from '../chunk-
|
|
71
|
-
export { SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnectedWorkspace, useConnection } from '../chunk-
|
|
68
|
+
import { useDocumentFilter, useConnectedTags, useConnectedDocuments, useConnectedConversations, useListedDocuments, listedDocuments } from '../chunk-5JEM3BWT.js';
|
|
69
|
+
export { isListedDocument, useConnectedConversations, useConnectedDocuments, useConnectedTags, useDocumentFilter, useListedDocuments } from '../chunk-5JEM3BWT.js';
|
|
70
|
+
import { useConnectedWorkspace, useConnection, useOptionalConnection, ConnectionProvider } from '../chunk-2YCCCXYV.js';
|
|
71
|
+
export { SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnectedWorkspace, useConnection } from '../chunk-2YCCCXYV.js';
|
|
72
72
|
import { DmThreadHeader, DmInviteChip } from '../chunk-2S3LT5KE.js';
|
|
73
73
|
import { useHost, ArbiHost } from '../chunk-T4P237N6.js';
|
|
74
74
|
import { TabHeader } from '../chunk-ABEKUV6L.js';
|
package/dist/connect/viewer.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkEFSL4O3B_cjs = require('../chunk-EFSL4O3B.cjs');
|
|
5
5
|
var chunkWALADS2S_cjs = require('../chunk-WALADS2S.cjs');
|
|
6
6
|
require('../chunk-2WLXQGWC.cjs');
|
|
7
7
|
require('../chunk-223D4727.cjs');
|
|
@@ -26,8 +26,8 @@ require('../chunk-LKK52DEY.cjs');
|
|
|
26
26
|
var chunk2YV7FBLO_cjs = require('../chunk-2YV7FBLO.cjs');
|
|
27
27
|
require('../chunk-VG24E4JJ.cjs');
|
|
28
28
|
require('../chunk-QVBZESYQ.cjs');
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var chunkC3YIVBTU_cjs = require('../chunk-C3YIVBTU.cjs');
|
|
30
|
+
var chunkJVXHVFUA_cjs = require('../chunk-JVXHVFUA.cjs');
|
|
31
31
|
require('../chunk-MB3S2ETI.cjs');
|
|
32
32
|
var chunkMEMWZ72Y_cjs = require('../chunk-MEMWZ72Y.cjs');
|
|
33
33
|
require('../chunk-ZW6FPIFC.cjs');
|
|
@@ -150,13 +150,13 @@ function fileExtension(fileName) {
|
|
|
150
150
|
function useViewedDocument(documentId) {
|
|
151
151
|
const [webmHasVideoTrack, setWebmHasVideoTrack] = React.useState(null);
|
|
152
152
|
React.useEffect(() => setWebmHasVideoTrack(null), [documentId]);
|
|
153
|
-
const streamingDoc =
|
|
153
|
+
const streamingDoc = chunkEFSL4O3B_cjs.useViewerStreamingDocument(documentId);
|
|
154
154
|
const isStreaming = !!streamingDoc && !streamingDoc.isComplete;
|
|
155
|
-
const draftDoc =
|
|
155
|
+
const draftDoc = chunkEFSL4O3B_cjs.useViewerDraftDocument(documentId);
|
|
156
156
|
const isDraft = !!draftDoc;
|
|
157
157
|
const isCaptureDraft = draftDoc?.kind === "audio" || draftDoc?.kind === "photo" || draftDoc?.kind === "video";
|
|
158
158
|
const isTextDraft = draftDoc?.kind === "text";
|
|
159
|
-
const { workspaceId, live } =
|
|
159
|
+
const { workspaceId, live } = chunkJVXHVFUA_cjs.useConnectedWorkspace();
|
|
160
160
|
const { data: record } = react.useDocument(documentId, {
|
|
161
161
|
enabled: live && !!workspaceId && !isStreaming && !isDraft,
|
|
162
162
|
// A new version (Save version, a signed copy) is processed before its PDF exists: keep
|
|
@@ -164,7 +164,7 @@ function useViewedDocument(documentId) {
|
|
|
164
164
|
pollWhileProcessing: true
|
|
165
165
|
});
|
|
166
166
|
const documentData = record?.external_id === documentId ? record : void 0;
|
|
167
|
-
const { data: tags } =
|
|
167
|
+
const { data: tags } = chunkC3YIVBTU_cjs.useConnectedTags();
|
|
168
168
|
const labelSummaries = React.useMemo(
|
|
169
169
|
() => chunkWALADS2S_cjs.summariseDocTags(documentData?.doctags ?? [], tags.filter(chunkWALADS2S_cjs.isDocumentLabel)),
|
|
170
170
|
[documentData, tags]
|
|
@@ -421,7 +421,7 @@ function useViewerTabs(doc, isCompact, hasHistory = false) {
|
|
|
421
421
|
}
|
|
422
422
|
function useViewerVersions(docId) {
|
|
423
423
|
const plainId = docId ? artifacts.parseVersionRef(docId).docId : "";
|
|
424
|
-
const { data: documents } =
|
|
424
|
+
const { data: documents } = chunkC3YIVBTU_cjs.useConnectedDocuments();
|
|
425
425
|
const listed = React.useMemo(
|
|
426
426
|
() => plainId ? documents.find((d) => d.external_id === plainId) : void 0,
|
|
427
427
|
[documents, plainId]
|
|
@@ -592,10 +592,10 @@ function PassageTagPanel({
|
|
|
592
592
|
onClose,
|
|
593
593
|
onViewTaggedChunks
|
|
594
594
|
}) {
|
|
595
|
-
const { createTag } =
|
|
595
|
+
const { createTag } = chunkEFSL4O3B_cjs.useDocumentViewerSupport();
|
|
596
596
|
const [editingNoteTagId, setEditingNoteTagId] = React.useState(null);
|
|
597
597
|
const [noteValue, setNoteValue] = React.useState("");
|
|
598
|
-
const { data: allTags } =
|
|
598
|
+
const { data: allTags } = chunkC3YIVBTU_cjs.useConnectedTags();
|
|
599
599
|
const workspaceTags = React.useMemo(() => allTags.filter(isDocumentTag), [allTags]);
|
|
600
600
|
const { getChunkTagState, toggleChunkTag, updateChunkTagNote, isLoading } = useChunkTagging({
|
|
601
601
|
documentId,
|
|
@@ -836,7 +836,7 @@ var ParsedPassage = React.memo(function ParsedPassage2({
|
|
|
836
836
|
items: passageItems
|
|
837
837
|
}
|
|
838
838
|
) : void 0,
|
|
839
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
839
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkEFSL4O3B_cjs.ConnectedMarkdown, { children: chunk.content })
|
|
840
840
|
}
|
|
841
841
|
);
|
|
842
842
|
});
|
|
@@ -969,7 +969,7 @@ ${text}
|
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
971
|
function useDocumentLabels(documentId, doctags, orderedChunkIds) {
|
|
972
|
-
const { data: allTags } =
|
|
972
|
+
const { data: allTags } = chunkC3YIVBTU_cjs.useConnectedTags();
|
|
973
973
|
const workspaceTags = React.useMemo(() => allTags.filter(isDocumentTag), [allTags]);
|
|
974
974
|
const documentDoctags = React.useMemo(() => doctags ?? [], [doctags]);
|
|
975
975
|
const tagSummaries = React.useMemo(
|
|
@@ -1064,7 +1064,7 @@ function useCitationSelection({
|
|
|
1064
1064
|
orderedChunkIds,
|
|
1065
1065
|
pageOf
|
|
1066
1066
|
}) {
|
|
1067
|
-
const passageCitation =
|
|
1067
|
+
const passageCitation = chunkEFSL4O3B_cjs.useViewerPassageCitation();
|
|
1068
1068
|
const activeCitationContext = passageCitation?.active ?? null;
|
|
1069
1069
|
const setPendingPassagesForCitation = passageCitation?.pick ?? noop;
|
|
1070
1070
|
const setUnselectedPassagesForCitation = passageCitation?.unpick ?? noop;
|
|
@@ -1420,8 +1420,8 @@ function ParsedTextView({
|
|
|
1420
1420
|
zoom = 1,
|
|
1421
1421
|
onZoomChange
|
|
1422
1422
|
}) {
|
|
1423
|
-
const { workspaceId } =
|
|
1424
|
-
const { openInNavigator } =
|
|
1423
|
+
const { workspaceId } = chunkJVXHVFUA_cjs.useConnectedWorkspace();
|
|
1424
|
+
const { openInNavigator } = chunkEFSL4O3B_cjs.useDocumentViewerSupport();
|
|
1425
1425
|
const containerRef = React.useRef(null);
|
|
1426
1426
|
const { data: documentRecord } = react.useDocument(artifacts.parseVersionRef(documentId).docId, {
|
|
1427
1427
|
enabled: !!documentId && !!workspaceId
|
|
@@ -1584,7 +1584,7 @@ var GuidedSigningViewer = React.lazy(
|
|
|
1584
1584
|
function SessionPdfViewer(props) {
|
|
1585
1585
|
const session = react.useArbiSessionStore();
|
|
1586
1586
|
const viewingId = react.useArbiSessionState((s) => s.viewingDocument?.id);
|
|
1587
|
-
const isDetached =
|
|
1587
|
+
const isDetached = chunkEFSL4O3B_cjs.useViewerIsDetached();
|
|
1588
1588
|
const onPageChange = React.useCallback(
|
|
1589
1589
|
(page) => {
|
|
1590
1590
|
if (viewingId) session.setViewingDocument({ id: viewingId, page });
|
|
@@ -1718,17 +1718,17 @@ function ViewerPdfPane({
|
|
|
1718
1718
|
return /* @__PURE__ */ jsxRuntime.jsx(SessionPdfViewer, { ...viewerProps, file: pdfBlob });
|
|
1719
1719
|
}
|
|
1720
1720
|
var NativeDocxEditor = React.lazy(
|
|
1721
|
-
() => import('../ConnectedNativeDocxEditor-
|
|
1721
|
+
() => import('../ConnectedNativeDocxEditor-6DQEM6SD.cjs').then((m) => ({
|
|
1722
1722
|
default: m.ConnectedNativeDocxEditor
|
|
1723
1723
|
}))
|
|
1724
1724
|
);
|
|
1725
1725
|
var StreamedWordArtifact = React.lazy(
|
|
1726
|
-
() => import('../ConnectedStreamedWordArtifact-
|
|
1726
|
+
() => import('../ConnectedStreamedWordArtifact-3VKYIG6C.cjs').then((m) => ({
|
|
1727
1727
|
default: m.ConnectedStreamedWordArtifact
|
|
1728
1728
|
}))
|
|
1729
1729
|
);
|
|
1730
1730
|
var NativeDocxComparison = React.lazy(
|
|
1731
|
-
() => import('../ConnectedNativeDocxComparison-
|
|
1731
|
+
() => import('../ConnectedNativeDocxComparison-H2OZMWHT.cjs').then((m) => ({
|
|
1732
1732
|
default: m.ConnectedNativeDocxComparison
|
|
1733
1733
|
}))
|
|
1734
1734
|
);
|
|
@@ -1743,7 +1743,7 @@ function ConnectedDocumentViewer(props) {
|
|
|
1743
1743
|
resetKey: openedId,
|
|
1744
1744
|
labels: { title: "This document couldn't be displayed" },
|
|
1745
1745
|
testId: "document-viewer-error",
|
|
1746
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1746
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkEFSL4O3B_cjs.ConnectedDocumentToolsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(DocumentViewerContent, { ...props, openedId }) })
|
|
1747
1747
|
}
|
|
1748
1748
|
);
|
|
1749
1749
|
}
|
|
@@ -1754,11 +1754,11 @@ function DocumentViewerContent({
|
|
|
1754
1754
|
}) {
|
|
1755
1755
|
const arbi = react.useArbi();
|
|
1756
1756
|
const session = react.useArbiSessionStore();
|
|
1757
|
-
const support =
|
|
1757
|
+
const support = chunkEFSL4O3B_cjs.useDocumentViewerSupport();
|
|
1758
1758
|
const formatDate = support.formatDate ?? chunkUFEXJIEY_cjs.fmtDate;
|
|
1759
1759
|
const tools = documentTools.useDocumentTools();
|
|
1760
1760
|
const { openConversation, openNewConversation, notify } = chunkB3NYBMDR_cjs.useBlocksEnvironment();
|
|
1761
|
-
const { userId: currentUserId } =
|
|
1761
|
+
const { userId: currentUserId } = chunkJVXHVFUA_cjs.useConnectedWorkspace();
|
|
1762
1762
|
const documentId = artifacts.parseVersionRef(openedId).docId;
|
|
1763
1763
|
const [totalPages, setTotalPages] = React.useState(0);
|
|
1764
1764
|
const [isCompact, setIsCompact] = React.useState(false);
|
|
@@ -1784,7 +1784,7 @@ function DocumentViewerContent({
|
|
|
1784
1784
|
const setViewingDocumentId = (id) => session.setViewingDocument({ id });
|
|
1785
1785
|
const setActiveTab = (tab) => session.setDocumentViewer({ tab });
|
|
1786
1786
|
const setCompareDocumentId = (id) => session.setDocumentViewer({ compareId: id });
|
|
1787
|
-
const { data: conversations } =
|
|
1787
|
+
const { data: conversations } = chunkC3YIVBTU_cjs.useConnectedConversations();
|
|
1788
1788
|
const snapshotRef = artifacts.parseVersionRef(openedId).version ? openedId : null;
|
|
1789
1789
|
const { versions, translations } = useViewerVersions(documentId);
|
|
1790
1790
|
const currentVersionId = versions.find((v) => v.isCurrent)?.id ?? documentId;
|
|
@@ -2410,7 +2410,7 @@ function DocumentViewerContent({
|
|
|
2410
2410
|
|
|
2411
2411
|
Object.defineProperty(exports, "ConnectedDocumentToolsProvider", {
|
|
2412
2412
|
enumerable: true,
|
|
2413
|
-
get: function () { return
|
|
2413
|
+
get: function () { return chunkEFSL4O3B_cjs.ConnectedDocumentToolsProvider; }
|
|
2414
2414
|
});
|
|
2415
2415
|
exports.ConnectedDocumentViewer = ConnectedDocumentViewer;
|
|
2416
2416
|
//# sourceMappingURL=viewer.cjs.map
|
package/dist/connect/viewer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ConnectedMarkdown, ConnectedDocumentToolsProvider, useDocumentViewerSupport, useViewerStreamingDocument, useViewerDraftDocument, useViewerIsDetached, useViewerPassageCitation } from '../chunk-
|
|
3
|
-
export { ConnectedDocumentToolsProvider } from '../chunk-
|
|
2
|
+
import { ConnectedMarkdown, ConnectedDocumentToolsProvider, useDocumentViewerSupport, useViewerStreamingDocument, useViewerDraftDocument, useViewerIsDetached, useViewerPassageCitation } from '../chunk-VPWCARVO.js';
|
|
3
|
+
export { ConnectedDocumentToolsProvider } from '../chunk-VPWCARVO.js';
|
|
4
4
|
import { HtmlPassage, ViewerTitle, ViewerTabBar, ViewerImageActions, canChangeVisibility, ViewerFrame, ViewerMessage, DocumentLabelBar, ViewerControlBar, ViewerZoomControl, PdfPageNav, ViewerPageCounter, summariseDocTags, isDocumentLabel, ViewerPreviewUnavailable, ViewerLoadError, HtmlViewerRoot, CitedRunNav, HtmlViewerSurface, HtmlPage, HtmlViewerEmpty, TagPassagePanel } from '../chunk-P6MVDOCL.js';
|
|
5
5
|
import '../chunk-JJA6GQKH.js';
|
|
6
6
|
import '../chunk-RC6VTY2H.js';
|
|
@@ -25,8 +25,8 @@ import '../chunk-7F5Z4K5W.js';
|
|
|
25
25
|
import { ArtifactCompareBar, ArtifactPreview, ArtifactCodeView, VersionTimeline } from '../chunk-65S53MZK.js';
|
|
26
26
|
import '../chunk-NS4JD2VR.js';
|
|
27
27
|
import '../chunk-LOJVUGBJ.js';
|
|
28
|
-
import { useConnectedConversations, useConnectedDocuments, useConnectedTags } from '../chunk-
|
|
29
|
-
import { useConnectedWorkspace } from '../chunk-
|
|
28
|
+
import { useConnectedConversations, useConnectedDocuments, useConnectedTags } from '../chunk-5JEM3BWT.js';
|
|
29
|
+
import { useConnectedWorkspace } from '../chunk-2YCCCXYV.js';
|
|
30
30
|
import '../chunk-T4P237N6.js';
|
|
31
31
|
import { TabHeader } from '../chunk-ABEKUV6L.js';
|
|
32
32
|
import '../chunk-P6GHJSLR.js';
|
|
@@ -1713,17 +1713,17 @@ function ViewerPdfPane({
|
|
|
1713
1713
|
return /* @__PURE__ */ jsx(SessionPdfViewer, { ...viewerProps, file: pdfBlob });
|
|
1714
1714
|
}
|
|
1715
1715
|
var NativeDocxEditor = lazy(
|
|
1716
|
-
() => import('../ConnectedNativeDocxEditor-
|
|
1716
|
+
() => import('../ConnectedNativeDocxEditor-43BI5LN6.js').then((m) => ({
|
|
1717
1717
|
default: m.ConnectedNativeDocxEditor
|
|
1718
1718
|
}))
|
|
1719
1719
|
);
|
|
1720
1720
|
var StreamedWordArtifact = lazy(
|
|
1721
|
-
() => import('../ConnectedStreamedWordArtifact-
|
|
1721
|
+
() => import('../ConnectedStreamedWordArtifact-TEB332E3.js').then((m) => ({
|
|
1722
1722
|
default: m.ConnectedStreamedWordArtifact
|
|
1723
1723
|
}))
|
|
1724
1724
|
);
|
|
1725
1725
|
var NativeDocxComparison = lazy(
|
|
1726
|
-
() => import('../ConnectedNativeDocxComparison-
|
|
1726
|
+
() => import('../ConnectedNativeDocxComparison-RWKFPJPJ.js').then((m) => ({
|
|
1727
1727
|
default: m.ConnectedNativeDocxComparison
|
|
1728
1728
|
}))
|
|
1729
1729
|
);
|
package/dist/studio/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkNOKTUWTN_cjs = require('../chunk-NOKTUWTN.cjs');
|
|
5
5
|
var chunkFGVQIKOG_cjs = require('../chunk-FGVQIKOG.cjs');
|
|
6
6
|
var chunkKNRAKOCO_cjs = require('../chunk-KNRAKOCO.cjs');
|
|
7
7
|
var chunkELR74ME6_cjs = require('../chunk-ELR74ME6.cjs');
|
|
@@ -11,7 +11,7 @@ require('../chunk-VPPX5XUF.cjs');
|
|
|
11
11
|
var chunkPCB2BPN3_cjs = require('../chunk-PCB2BPN3.cjs');
|
|
12
12
|
require('../chunk-NWNVWO6L.cjs');
|
|
13
13
|
require('../chunk-X6MGM3LH.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkJVXHVFUA_cjs = require('../chunk-JVXHVFUA.cjs');
|
|
15
15
|
require('../chunk-MB3S2ETI.cjs');
|
|
16
16
|
var chunkZW6FPIFC_cjs = require('../chunk-ZW6FPIFC.cjs');
|
|
17
17
|
require('../chunk-LNYEYR7W.cjs');
|
|
@@ -66,7 +66,7 @@ function WidgetPlaceholder({
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
function useActiveWorkspaceId() {
|
|
69
|
-
const { workspaceId, fallbackWorkspaceId } =
|
|
69
|
+
const { workspaceId, fallbackWorkspaceId } = chunkJVXHVFUA_cjs.useConnection();
|
|
70
70
|
return workspaceId ?? fallbackWorkspaceId ?? void 0;
|
|
71
71
|
}
|
|
72
72
|
var METRIC_SOURCES = {
|
|
@@ -877,7 +877,7 @@ function latestImageDocId(artifacts) {
|
|
|
877
877
|
return null;
|
|
878
878
|
}
|
|
879
879
|
function useImageGen() {
|
|
880
|
-
const task =
|
|
880
|
+
const task = chunkNOKTUWTN_cjs.useConnectedAiTask();
|
|
881
881
|
const { run } = task;
|
|
882
882
|
const generate = react.useCallback(
|
|
883
883
|
async (prompt, referenceDocIds = []) => {
|
package/dist/studio/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useConnectedAiTask } from '../chunk-
|
|
2
|
+
import { useConnectedAiTask } from '../chunk-N3HVTMQK.js';
|
|
3
3
|
import { DataTableBlock, StatGroup } from '../chunk-ASY4F546.js';
|
|
4
4
|
import { assetRefId, applyStoredTheme, AssetResolverProvider, SectionHeading, PricingTable, Tabs as Tabs$1, Accordion, Gallery, VideoEmbed, ContactForm, Banner, MediaText, TeamGrid, Steps, TestimonialGrid, Columns, Spacer, Container, Hero, FeatureGrid, Testimonial, CTABanner, LogoCloud, FAQ, RichTextBlock, BlockImage, AvatarBlock, Navbar, Footer, ListBlock, isAssetRef, asAssetRef } from '../chunk-XXUPUXBF.js';
|
|
5
5
|
export { ASSET_REF_PREFIX, AssetResolverProvider, asAssetRef, assetRefId, isAssetRef, useAssetRenderer, useAssetResolverActive } from '../chunk-XXUPUXBF.js';
|
|
@@ -10,7 +10,7 @@ import '../chunk-4EZVCGRL.js';
|
|
|
10
10
|
import { Callout } from '../chunk-UJE32SST.js';
|
|
11
11
|
import '../chunk-NHZK64TQ.js';
|
|
12
12
|
import '../chunk-73DANGPH.js';
|
|
13
|
-
import { useConnection } from '../chunk-
|
|
13
|
+
import { useConnection } from '../chunk-2YCCCXYV.js';
|
|
14
14
|
import '../chunk-T4P237N6.js';
|
|
15
15
|
import { EmptyState } from '../chunk-P6GHJSLR.js';
|
|
16
16
|
import '../chunk-AL7EXOX5.js';
|
|
@@ -15,8 +15,8 @@ require('../chunk-2EI7NCUA.cjs');
|
|
|
15
15
|
require('../chunk-X6MGM3LH.cjs');
|
|
16
16
|
require('../chunk-LKK52DEY.cjs');
|
|
17
17
|
require('../chunk-VZOOGA47.cjs');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var chunkC3YIVBTU_cjs = require('../chunk-C3YIVBTU.cjs');
|
|
19
|
+
var chunkJVXHVFUA_cjs = require('../chunk-JVXHVFUA.cjs');
|
|
20
20
|
require('../chunk-MB3S2ETI.cjs');
|
|
21
21
|
require('../chunk-MEMWZ72Y.cjs');
|
|
22
22
|
require('../chunk-ZW6FPIFC.cjs');
|
|
@@ -2772,13 +2772,13 @@ function ConnectedWorkflowBuilder({
|
|
|
2772
2772
|
}) {
|
|
2773
2773
|
const l = { ...DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS, ...connectedLabels };
|
|
2774
2774
|
const { notify, openConversation } = chunkB3NYBMDR_cjs.useBlocksEnvironment();
|
|
2775
|
-
const { workspaceId, live, ensureWorkspaceOpen } =
|
|
2775
|
+
const { workspaceId, live, ensureWorkspaceOpen } = chunkJVXHVFUA_cjs.useConnectedWorkspace();
|
|
2776
2776
|
const members = react$2.useWorkspaceUsers(workspaceId ?? void 0, {
|
|
2777
2777
|
enabled: live && !!workspaceId,
|
|
2778
2778
|
beforeFetch: ensureWorkspaceOpen
|
|
2779
2779
|
});
|
|
2780
|
-
const { data: tagList } =
|
|
2781
|
-
const { data: docList } =
|
|
2780
|
+
const { data: tagList } = chunkC3YIVBTU_cjs.useConnectedTags();
|
|
2781
|
+
const { data: docList } = chunkC3YIVBTU_cjs.useListedDocuments();
|
|
2782
2782
|
const people = (members.data ?? []).map((m) => ({
|
|
2783
2783
|
value: m.user.external_id,
|
|
2784
2784
|
label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
|
|
@@ -2791,7 +2791,7 @@ function ConnectedWorkflowBuilder({
|
|
|
2791
2791
|
const saved = react$2.useWorkflows();
|
|
2792
2792
|
const skills = react$2.useSkills();
|
|
2793
2793
|
const agentsQuery = react$2.useAgents();
|
|
2794
|
-
const { data: conversations } =
|
|
2794
|
+
const { data: conversations } = chunkC3YIVBTU_cjs.useConnectedConversations();
|
|
2795
2795
|
const create = react$2.useCreateWorkflow();
|
|
2796
2796
|
const update = react$2.useUpdateWorkflow();
|
|
2797
2797
|
const run = react$2.useRunWorkflow();
|
|
@@ -13,8 +13,8 @@ import '../chunk-YU2KUMGE.js';
|
|
|
13
13
|
import '../chunk-73DANGPH.js';
|
|
14
14
|
import '../chunk-7F5Z4K5W.js';
|
|
15
15
|
import '../chunk-WNDIVNPT.js';
|
|
16
|
-
import { useConnectedTags, useListedDocuments, useConnectedConversations } from '../chunk-
|
|
17
|
-
import { useConnectedWorkspace } from '../chunk-
|
|
16
|
+
import { useConnectedTags, useListedDocuments, useConnectedConversations } from '../chunk-5JEM3BWT.js';
|
|
17
|
+
import { useConnectedWorkspace } from '../chunk-2YCCCXYV.js';
|
|
18
18
|
import '../chunk-T4P237N6.js';
|
|
19
19
|
import '../chunk-ABEKUV6L.js';
|
|
20
20
|
import '../chunk-P6GHJSLR.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/coedit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.33",
|
|
4
4
|
"description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/blocks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.33",
|
|
4
4
|
"description": "Composable, domain-neutral UI blocks for ARBI apps, organised by capability (retrieval, facts, agents, workspaces, citations, collaboration) plus shell, theme and site primitives, on top of @arbidocs/react.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -296,9 +296,9 @@
|
|
|
296
296
|
"example:test:e2e": "playwright test -c examples/custom-ui/playwright.config.ts"
|
|
297
297
|
},
|
|
298
298
|
"dependencies": {
|
|
299
|
-
"@arbidocs/client": "0.5.
|
|
300
|
-
"@arbidocs/coedit": "0.5.
|
|
301
|
-
"@arbidocs/sdk": "0.5.
|
|
299
|
+
"@arbidocs/client": "0.5.33",
|
|
300
|
+
"@arbidocs/coedit": "0.5.33",
|
|
301
|
+
"@arbidocs/sdk": "0.5.33",
|
|
302
302
|
"@auth0/auth0-react": "^2.19.0",
|
|
303
303
|
"@dnd-kit/core": "^6.3.1",
|
|
304
304
|
"@dnd-kit/sortable": "^10.0.0",
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
"y-protocols": "^1.0.6"
|
|
346
346
|
},
|
|
347
347
|
"peerDependencies": {
|
|
348
|
-
"@arbidocs/react": "0.5.
|
|
348
|
+
"@arbidocs/react": "0.5.33",
|
|
349
349
|
"@lexical/html": "0.35.0",
|
|
350
350
|
"@lexical/link": "0.35.0",
|
|
351
351
|
"@lexical/list": "0.35.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ConnectedStreamedWordArtifact-QAZ5VQZS.cjs"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/ConnectionProvider.tsx"],"names":["login"],"mappings":";;;;;;AA2EA,IAAM,iBAAA,GAAoB,cAAsC,IAAI,CAAA;AAQpE,IAAM,wBAAA,GAA2B,wBAAA;AACjC,IAAM,mBAAmB,CAAC,KAAA,KAAkB,KAAA,CAAM,IAAA,GAAO,WAAA,EAAY;AAG9D,IAAM,mBAAA,GAAsB,C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AA,EAAM,UAAA;AAAA,MACd,mBAAA,EAAqB,YAAY,mBAAA,IAAuB,cAAA;AAAA,MACxD,aAAA,EAAe,OAAO,WAAA,EAAqB,OAAA,KAAgC;AACzE,QAAA,IAAI,UAAA,EAAY,MAAM,UAAA,CAAW,YAAA,CAAa,WAAW,CAAA;AACzD,QAAA,aAAA,CAAc,aAAa,OAAO,CAAA;AAAA,MACpC;AAAA,KACF,CAAA;AAAA;AAAA;AAAA,IAGA,CAAC,UAAA,EAAY,kBAAA,EAAoB,IAAA,EAAM,SAAS,aAAa;AAAA,GAC/D;AACF","file":"chunk-D57MPMTZ.js","sourcesContent":["/**\n * The demo/live connection layer for a host app. Holds auth + workspace\n * selection state and exposes it via {@link useConnection}, so every surface\n * works identically whether it's talking to a live ARBI backend or the seeded\n * demo workspace. Host-specific values (backend URL, demo identity, default\n * workspace/assistant ids) arrive once through {@link ArbiConnectionConfig}.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport {\n arbiAccountClient,\n clearSealedDrafts,\n toProfileView,\n useArbi,\n useArbiSessionState,\n useArbiSessionStore,\n useSwitchWorkspace,\n type AccountClient,\n type LoginProfile,\n type ProfileView,\n} from '@arbidocs/react'\nimport type { ArbiMode, ArbiUser, ConnectionStatus, ArbiConnectionConfig } from './types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ArbiHost } from '../provider/host'\n\ninterface ConnectionValue {\n mode: ArbiMode\n status: ConnectionStatus\n user: ArbiUser | null\n /** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */\n workspaceId: string | null\n apiConfigured: boolean\n apiUrl: string\n /**\n * The deployment domain the user's keys are derived for (`arbi.getDeploymentDomain()`), for the\n * document tools' e-signing. `undefined` in demo mode.\n */\n deploymentDomain: string | undefined\n error: string | null\n /** Default assistant config ext_id (for the AI hooks). */\n assistantConfig?: string\n /**\n * The demo's workspace when none is selected. Never set signed in to a live backend: there the\n * selection is the only workspace (none while a switch is in flight), never a remembered one.\n */\n fallbackWorkspaceId?: string\n /** Authenticate. Live login when a backend is configured, otherwise the demo workspace. */\n login: (email: string, password: string) => Promise<void>\n /** One-click demo entry (no backend required). */\n enterDemo: () => void\n logout: () => void\n /**\n * Affirmatively select a workspace: opens it on the server (via the SDK),\n * updates the app-wide state, and persists the choice so it survives future\n * logins. This is the single entry point for \"the user is now in workspace X\".\n */\n setWorkspace: (id: string) => Promise<void>\n /**\n * Re-assert the selected workspace on the server session (idempotent `/open`).\n * Call before a workspace-scoped write when the session may have lost its open\n * workspace (token re-login, backend restart, session expiry) — the server\n * resolves the workspace from the session, so a dropped `/open` yields\n * \"No active workspace\" until it's re-opened.\n */\n ensureWorkspaceOpen: () => Promise<void>\n}\n\nconst ConnectionContext = createContext<ConnectionValue | null>(null)\n\n/**\n * Persist the affirmatively-selected workspace per backend AND per signed-in user, so a returning\n * user lands back in the workspace they last chose, while the next person on a shared browser\n * never starts from someone else's workspace id. Namespaced by apiUrl so distinct deployments\n * (and the demo workspace) don't clobber each other. Cleared on logout.\n */\nconst WORKSPACE_STORAGE_PREFIX = 'arbi:selectedWorkspace'\nconst normalizeUserKey = (email: string) => email.trim().toLowerCase()\n\n/** Exported for tests. */\nexport const workspaceStorageKey = (apiUrl: string, userKey: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}:${normalizeUserKey(userKey)}`\n\n/** The pre-isolation key (apiUrl only). Never read: removed so it cannot leak across users. */\nconst legacyWorkspaceStorageKey = (apiUrl: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}`\n\nfunction readPersistedWorkspace(apiUrl: string, userKey: string | null): string | null {\n if (!userKey) return null\n try {\n return window.localStorage.getItem(workspaceStorageKey(apiUrl, userKey))\n } catch {\n return null\n }\n}\n\nfunction persistWorkspace(apiUrl: string, userKey: string | null, id: string | null): void {\n if (!userKey) return\n try {\n if (id) window.localStorage.setItem(workspaceStorageKey(apiUrl, userKey), id)\n else window.localStorage.removeItem(workspaceStorageKey(apiUrl, userKey))\n window.localStorage.removeItem(legacyWorkspaceStorageKey(apiUrl))\n } catch {\n // Storage unavailable (private mode, SSR) — selection stays in-memory only.\n }\n}\n\n/** Shown on the sign-in screen after the session could not be recovered. */\nexport const SESSION_EXPIRED_MESSAGE = 'Your session expired. Sign in again.'\n\n/** The connection user for a profile: its full name, falling back to the email local part. */\nfunction userFromProfile(profile: LoginProfile, externalId?: string): ArbiUser {\n const fullName = [profile.givenName, profile.familyName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ')\n return {\n name: fullName || profile.email.split('@')[0],\n email: profile.email,\n externalId,\n picture: profile.picture,\n }\n}\n\n/**\n * The sign-in layer of a blocks-only site, mounted by its host (`defaultHost`): login, demo mode\n * and the selected workspace, over the host's session state (the selected workspace lives there,\n * so every block reads one value). Its account client is the host's `account` below it.\n */\nexport function ConnectionProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const arbi = useArbi()\n const session = useArbiSessionStore()\n const { switchWorkspace, openSelectedWorkspace, settled } = useSwitchWorkspace()\n const isLiveConfigured = config.apiUrl.length > 0\n const demoWorkspaceId = config.demoWorkspaceId ?? 'demo-workspace'\n\n const [status, setStatus] = useState<ConnectionStatus>(\n isLiveConfigured ? 'connecting' : 'disconnected'\n )\n const [user, setUser] = useState<ArbiUser | null>(null)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const selectWorkspaceId = session.setWorkspaceId\n const [mode, setMode] = useState<ArbiMode>('demo')\n const [error, setError] = useState<string | null>(null)\n // Who the persisted workspace belongs to; set at sign-in, cleared at logout.\n const storageUserRef = useRef<string | null>(null)\n // Moves at each logout: a sign-in still finishing from before it does not sign back in.\n const sessionRun = useRef(0)\n\n // The SDK could not recover the session (token refused, workspace not re-openable): drop to\n // 'disconnected' with a plain message, so the host's gate sends the user to sign in instead of\n // every call failing with a raw backend error. The remembered workspace is kept for next login.\n useEffect(\n () =>\n arbi.onSessionExpired?.(() => {\n storageUserRef.current = null\n setUser(null)\n selectWorkspaceId(null)\n setStatus('disconnected')\n setError(SESSION_EXPIRED_MESSAGE)\n }),\n [arbi, selectWorkspaceId]\n )\n\n // A saved name, picture or email reaches every surface reading `useConnection().user`.\n useEffect(\n () =>\n arbi.user.onProfileChange?.((profile) =>\n setUser((current) => (current ? userFromProfile(profile, current.externalId) : current))\n ),\n [arbi]\n )\n\n const enterDemo = useCallback(() => {\n setMode('demo')\n setStatus('demo')\n setError(null)\n setUser({ name: config.demoUser.name, email: config.demoUser.email })\n selectWorkspaceId(demoWorkspaceId)\n }, [config.demoUser.name, config.demoUser.email, demoWorkspaceId, selectWorkspaceId])\n\n /**\n * The session signed in, by whatever path (`login` below, a sign-in page on the host's `Arbi`,\n * a restored session): open the user's workspace and resolve who they are.\n */\n const completeSignIn = useCallback(\n async (email: string) => {\n const run = sessionRun.current\n const signedOut = () => run !== sessionRun.current\n setMode('live')\n setStatus('connecting')\n setError(null)\n try {\n storageUserRef.current = normalizeUserKey(email)\n const workspaces = await arbi.workspaces.list()\n if (workspaces?.length) {\n // Prefer the workspace the user last affirmatively selected (persisted),\n // then the configured workspace (there may be several — e.g. a\n // marketing/KM workspace), then whichever happens to be first. Ternary\n // (not `&&`) so an empty value can't leak `\"\"` into `target`.\n const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current)\n const preferred = persisted ?? config.workspaceId\n const target =\n (preferred ? workspaces.find((w) => w.external_id === preferred) : undefined) ??\n workspaces[0]\n selectWorkspaceId(target.external_id)\n if (!(await openSelectedWorkspace()))\n throw new Error('Could not open your workspace. Try signing in again.')\n persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id)\n }\n // The profile (name + avatar) comes with the login response. A session restored without\n // a login has none, so fall back to finding ourselves in the workspace roster; the email\n // local part is only the last resort, never the answer when a profile name exists.\n let resolved: ArbiUser = { name: email.split('@')[0], email }\n const me = arbi.user.identity()\n const profile = arbi.user.profile?.()\n if (profile) {\n resolved = userFromProfile(profile, me?.externalId)\n } else {\n try {\n const members = await arbi.workspaces.listUsers()\n const self = members.find((m) => m.user.external_id === me?.externalId)?.user\n if (self) {\n const fullName = [self.given_name, self.family_name].filter(Boolean).join(' ').trim()\n resolved = {\n name: fullName || email.split('@')[0],\n email: self.email || email,\n externalId: self.external_id,\n picture: self.picture ?? null,\n }\n } else if (me?.externalId) {\n resolved.externalId = me.externalId\n }\n } catch {\n // Roster not available (e.g. no workspace) — keep the fallback identity.\n }\n }\n if (signedOut()) return\n setUser(resolved)\n setStatus('authenticated')\n } catch (e) {\n if (signedOut()) return\n // Surface the real error — no silent fallback to a fake session.\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, config.workspaceId, config.apiUrl, selectWorkspaceId, openSelectedWorkspace]\n )\n\n // Every sign-in on the host's `Arbi` lands here, whichever page or kit made it.\n const signingIn = useRef<Promise<void>>(Promise.resolve())\n useEffect(\n () =>\n arbi.onSignedIn?.((login) => {\n signingIn.current = completeSignIn(\n login.profile?.email ??\n arbi.session?.getState().userEmail ??\n arbi.user.identity()?.email ??\n ''\n )\n }),\n [arbi, completeSignIn]\n )\n\n /** Authenticate: a live login when a backend is configured, otherwise the demo workspace. */\n const login = useCallback(\n async (email: string, password: string) => {\n setError(null)\n if (!isLiveConfigured) {\n enterDemo()\n return\n }\n setStatus('connecting')\n setMode('live')\n try {\n // Signed in: `completeSignIn` follows (onSignedIn); done once it is.\n await arbi.login(email, password)\n await signingIn.current\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, enterDemo, isLiveConfigured]\n )\n\n // The session kept on this device signs in again (no password; the key stays encrypted on the\n // device). Run once even under StrictMode.\n const restoreStarted = useRef(false)\n useEffect(() => {\n if (restoreStarted.current || !isLiveConfigured) return\n restoreStarted.current = true\n arbi\n .restore()\n .catch(() => false)\n .then(async (restored) => {\n if (restored) await signingIn.current\n else setStatus('disconnected')\n })\n }, [arbi, isLiveConfigured])\n\n const logout = useCallback(() => {\n sessionRun.current++\n // The SDK stops the session's work (requests, re-logins, opens, the queries in flight) before\n // the server revokes the token.\n if (mode === 'live') {\n void arbi.logout?.()\n }\n // What was typed never outlives the session (it is sealed, but kept for no one now).\n clearSealedDrafts()\n setUser(null)\n selectWorkspaceId(null)\n persistWorkspace(config.apiUrl, storageUserRef.current, null)\n storageUserRef.current = null\n setStatus('disconnected')\n setError(null)\n }, [arbi, mode, config.apiUrl, selectWorkspaceId])\n\n // Affirmative selection: the shared workspace switch (live), then remember it so the next\n // login lands there too. This provider IS the host's navigation, so it alone (with sign-in and\n // ensureWorkspaceOpen, which re-open the host's own selection) changes the workspace; kits reach\n // another workspace with `arbi.workspaces.open`.\n const setWorkspace = useCallback(\n async (id: string) => {\n if (mode === 'live' && arbi.isLoggedIn) {\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n } else {\n selectWorkspaceId(id)\n }\n persistWorkspace(config.apiUrl, storageUserRef.current, id)\n },\n [arbi, mode, config.apiUrl, selectWorkspaceId, switchWorkspace]\n )\n\n // Re-open the selected workspace on the session if the server may have dropped it. Idempotent.\n // A switch in flight is waited out first, then only the selection as of then is opened (none:\n // nothing). Never a remembered or configured workspace: kits call this before reading, and\n // opening another workspace than the selected one would leave the server session in it.\n const ensureWorkspaceOpen = useCallback(async () => {\n if (mode !== 'live' || !arbi.isLoggedIn) return\n await settled()\n if (!session.getState().workspaceId) return\n await openSelectedWorkspace()\n }, [arbi, session, mode, settled, openSelectedWorkspace])\n\n const value = useMemo<ConnectionValue>(\n () => ({\n mode,\n status,\n user,\n workspaceId,\n apiConfigured: isLiveConfigured,\n apiUrl: config.apiUrl,\n deploymentDomain: isLiveConfigured ? arbi.getDeploymentDomain() : undefined,\n error,\n assistantConfig: config.assistantConfig,\n fallbackWorkspaceId: mode === 'live' ? undefined : config.workspaceId,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n }),\n [\n mode,\n status,\n user,\n workspaceId,\n isLiveConfigured,\n config.apiUrl,\n arbi,\n config.assistantConfig,\n config.workspaceId,\n error,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n ]\n )\n\n const account = useConnectionAccount(arbi, user, logout)\n const authenticated = status === 'authenticated'\n const host = useMemo(\n () => ({ account: { client: account, useEnabled: () => authenticated } }),\n [account, authenticated]\n )\n\n return (\n <ConnectionContext.Provider value={value}>\n <ArbiHost config={host}>{children}</ArbiHost>\n </ConnectionContext.Provider>\n )\n}\n\n/**\n * The account client of the settings blocks below: the SDK's, with sign-out going through this\n * connection (so its state is cleared too) and, for a session restored without a login (no SDK\n * profile), the connection user as the profile.\n */\nfunction useConnectionAccount(\n arbi: ReturnType<typeof useArbi>,\n user: ArbiUser | null,\n logout: () => void\n): AccountClient {\n const userRef = useRef(user)\n const logoutRef = useRef(logout)\n logoutRef.current = logout\n const listeners = useRef(new Set<() => void>())\n useEffect(() => {\n userRef.current = user\n listeners.current.forEach((listener) => listener())\n }, [user])\n return useMemo(() => {\n const base = arbiAccountClient(arbi)\n return {\n ...base,\n profile: (): ProfileView | null => {\n const own = base.profile()\n const fallback = userRef.current\n if (own || !fallback) return own\n return {\n ...toProfileView({\n givenName: '',\n familyName: null,\n picture: fallback.picture ?? null,\n email: fallback.email,\n isSso: false,\n }),\n fullName: fallback.name,\n }\n },\n onProfileChange: (listener) => {\n listeners.current.add(listener)\n const off = base.onProfileChange(listener)\n return () => {\n listeners.current.delete(listener)\n off()\n }\n },\n signOut: async ({ everywhere } = {}) => {\n try {\n if (everywhere) await arbi.sessions.logoutAll()\n } finally {\n logoutRef.current()\n }\n },\n }\n }, [arbi])\n}\n\n/** The sign-in layer of `defaultHost`, or null under a host that keeps its own session. */\nexport function useOptionalConnection(): ConnectionValue | null {\n return useContext(ConnectionContext)\n}\n\nexport function useConnection(): ConnectionValue {\n const ctx = useContext(ConnectionContext)\n if (!ctx) throw new Error('useConnection needs the sign-in layer of `defaultHost` above it')\n return ctx\n}\n\nexport const isAuthenticated = (s: ConnectionStatus) => s === 'demo' || s === 'authenticated'\n\n/** The open workspace as the connected kits see it, whoever hosts them. */\nexport interface ConnectedWorkspace {\n /** The selected workspace (the session state's; with a connection, else its fallback). */\n workspaceId: string | null\n /** Signed in to a live backend: workspace-scoped queries may run. */\n live: boolean\n /** The signed-in user (their name and email, e.g. to sign a document). */\n user: ArbiUser | null\n /** The signed-in user's external id. */\n userId: string | undefined\n /** Re-assert the workspace on the server session before a workspace-scoped write. */\n ensureWorkspaceOpen: () => Promise<void>\n /**\n * Go into a workspace: select it (with a connection) and show it (`BlocksEnvironment.\n * openWorkspace`, where a host without a connection also switches its session).\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => Promise<void>\n}\n\nconst keptOpenByHost = async () => {}\n\n/** The signed-in user of a host's own session, from its login profile. */\nfunction sessionUser(arbi: ReturnType<typeof useArbi>): ArbiUser | null {\n if (!arbi.isLoggedIn) return null\n const me = arbi.user.identity()\n const profile = arbi.user.profile()\n if (!me) return null\n return profile\n ? userFromProfile(profile, me.externalId)\n : { name: (me.email ?? '').split('@')[0], email: me.email ?? '', externalId: me.externalId }\n}\n\n/**\n * The workspace for a connected kit: the sign-in layer's (`defaultHost`) when there is one, else the\n * host's own session (an app whose host config has its `arbi` and `session` and keeps its\n * workspace open itself). So a kit runs the same in Clarum and in the ARBI app.\n */\nexport function useConnectedWorkspace(): ConnectedWorkspace {\n const connection = useContext(ConnectionContext)\n const arbi = useArbi()\n const sessionWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const live = connection ? connection.status === 'authenticated' : arbi.isLoggedIn\n const user = connection ? connection.user : live ? sessionUser(arbi) : null\n const userKey = `${user?.externalId ?? ''}|${user?.name ?? ''}|${user?.email ?? ''}`\n const { openWorkspace: showWorkspace } = useBlocksEnvironment()\n return useMemo(\n () => ({\n workspaceId: connection\n ? (connection.workspaceId ?? connection.fallbackWorkspaceId ?? null)\n : sessionWorkspaceId,\n live,\n user,\n userId: user?.externalId,\n ensureWorkspaceOpen: connection?.ensureWorkspaceOpen ?? keptOpenByHost,\n openWorkspace: async (workspaceId: string, options?: { name?: string }) => {\n if (connection) await connection.setWorkspace(workspaceId)\n showWorkspace(workspaceId, options)\n },\n }),\n // `user` is rebuilt each render without a connection: its key says when it changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [connection, sessionWorkspaceId, live, userKey, showWorkspace]\n )\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/ConnectionProvider.tsx"],"names":["createContext","useArbi","useArbiSessionStore","useSwitchWorkspace","useState","useArbiSessionState","useRef","useEffect","useCallback","login","clearSealedDrafts","useMemo","jsx","ArbiHost","arbiAccountClient","toProfileView","useContext","useBlocksEnvironment"],"mappings":";;;;;;;;AA2EA,IAAM,iBAAA,GAAoBA,oBAAsC,IAAI,CAAA;AAQpE,IAAM,wBAAA,GAA2B,wBAAA;AACjC,IAAM,mBAAmB,CAAC,KAAA,KAAkB,KAAA,CAAM,IAAA,GAAO,WAAA,EAAY;AAG9D,IAAM,mBAAA,GAAsB,CAAC,MAAA,EAAgB,OAAA,KAClD,CAAA,EAAG,wBAAwB,CAAA,CAAA,EAAI,MAAA,IAAU,MAAM,CAAA,CAAA,EAAI,gBAAA,CAAiB,OAAO,CAAC,CAAA,CAAA;AAG9E,IAAM,4BAA4B,CAAC,MAAA,KACjC,GAAG,wBAAwB,CAAA,CAAA,EAAI,UAAU,MAAM,CAAA,CAAA;AAEjD,SAAS,sBAAA,CAAuB,QAAgB,OAAA,EAAuC;AACrF,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,YAAA,CAAa,OAAA,CAAQ,mBAAA,CAAoB,MAAA,EAAQ,OAAO,CAAC,CAAA;AAAA,EACzE,CAAA,CAAA,MAAQ;AACN,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Holds auth + workspace\n * selection state and exposes it via {@link useConnection}, so every surface\n * works identically whether it's talking to a live ARBI backend or the seeded\n * demo workspace. Host-specific values (backend URL, demo identity, default\n * workspace/assistant ids) arrive once through {@link ArbiConnectionConfig}.\n */\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport {\n arbiAccountClient,\n clearSealedDrafts,\n toProfileView,\n useArbi,\n useArbiSessionState,\n useArbiSessionStore,\n useSwitchWorkspace,\n type AccountClient,\n type LoginProfile,\n type ProfileView,\n} from '@arbidocs/react'\nimport type { ArbiMode, ArbiUser, ConnectionStatus, ArbiConnectionConfig } from './types'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ArbiHost } from '../provider/host'\n\ninterface ConnectionValue {\n mode: ArbiMode\n status: ConnectionStatus\n user: ArbiUser | null\n /** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */\n workspaceId: string | null\n apiConfigured: boolean\n apiUrl: string\n /**\n * The deployment domain the user's keys are derived for (`arbi.getDeploymentDomain()`), for the\n * document tools' e-signing. `undefined` in demo mode.\n */\n deploymentDomain: string | undefined\n error: string | null\n /** Default assistant config ext_id (for the AI hooks). */\n assistantConfig?: string\n /**\n * The demo's workspace when none is selected. Never set signed in to a live backend: there the\n * selection is the only workspace (none while a switch is in flight), never a remembered one.\n */\n fallbackWorkspaceId?: string\n /** Authenticate. Live login when a backend is configured, otherwise the demo workspace. */\n login: (email: string, password: string) => Promise<void>\n /** One-click demo entry (no backend required). */\n enterDemo: () => void\n logout: () => void\n /**\n * Affirmatively select a workspace: opens it on the server (via the SDK),\n * updates the app-wide state, and persists the choice so it survives future\n * logins. This is the single entry point for \"the user is now in workspace X\".\n */\n setWorkspace: (id: string) => Promise<void>\n /**\n * Re-assert the selected workspace on the server session (idempotent `/open`).\n * Call before a workspace-scoped write when the session may have lost its open\n * workspace (token re-login, backend restart, session expiry) — the server\n * resolves the workspace from the session, so a dropped `/open` yields\n * \"No active workspace\" until it's re-opened.\n */\n ensureWorkspaceOpen: () => Promise<void>\n}\n\nconst ConnectionContext = createContext<ConnectionValue | null>(null)\n\n/**\n * Persist the affirmatively-selected workspace per backend AND per signed-in user, so a returning\n * user lands back in the workspace they last chose, while the next person on a shared browser\n * never starts from someone else's workspace id. Namespaced by apiUrl so distinct deployments\n * (and the demo workspace) don't clobber each other. Cleared on logout.\n */\nconst WORKSPACE_STORAGE_PREFIX = 'arbi:selectedWorkspace'\nconst normalizeUserKey = (email: string) => email.trim().toLowerCase()\n\n/** Exported for tests. */\nexport const workspaceStorageKey = (apiUrl: string, userKey: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}:${normalizeUserKey(userKey)}`\n\n/** The pre-isolation key (apiUrl only). Never read: removed so it cannot leak across users. */\nconst legacyWorkspaceStorageKey = (apiUrl: string) =>\n `${WORKSPACE_STORAGE_PREFIX}:${apiUrl || 'demo'}`\n\nfunction readPersistedWorkspace(apiUrl: string, userKey: string | null): string | null {\n if (!userKey) return null\n try {\n return window.localStorage.getItem(workspaceStorageKey(apiUrl, userKey))\n } catch {\n return null\n }\n}\n\nfunction persistWorkspace(apiUrl: string, userKey: string | null, id: string | null): void {\n if (!userKey) return\n try {\n if (id) window.localStorage.setItem(workspaceStorageKey(apiUrl, userKey), id)\n else window.localStorage.removeItem(workspaceStorageKey(apiUrl, userKey))\n window.localStorage.removeItem(legacyWorkspaceStorageKey(apiUrl))\n } catch {\n // Storage unavailable (private mode, SSR) — selection stays in-memory only.\n }\n}\n\n/** Shown on the sign-in screen after the session could not be recovered. */\nexport const SESSION_EXPIRED_MESSAGE = 'Your session expired. Sign in again.'\n\n/** The connection user for a profile: its full name, falling back to the email local part. */\nfunction userFromProfile(profile: LoginProfile, externalId?: string): ArbiUser {\n const fullName = [profile.givenName, profile.familyName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ')\n return {\n name: fullName || profile.email.split('@')[0],\n email: profile.email,\n externalId,\n picture: profile.picture,\n }\n}\n\n/**\n * The sign-in layer of a blocks-only site, mounted by its host (`defaultHost`): login, demo mode\n * and the selected workspace, over the host's session state (the selected workspace lives there,\n * so every block reads one value). Its account client is the host's `account` below it.\n */\nexport function ConnectionProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const arbi = useArbi()\n const session = useArbiSessionStore()\n const { switchWorkspace, openSelectedWorkspace, settled } = useSwitchWorkspace()\n const isLiveConfigured = config.apiUrl.length > 0\n const demoWorkspaceId = config.demoWorkspaceId ?? 'demo-workspace'\n\n const [status, setStatus] = useState<ConnectionStatus>(\n isLiveConfigured ? 'connecting' : 'disconnected'\n )\n const [user, setUser] = useState<ArbiUser | null>(null)\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const selectWorkspaceId = session.setWorkspaceId\n const [mode, setMode] = useState<ArbiMode>('demo')\n const [error, setError] = useState<string | null>(null)\n // Who the persisted workspace belongs to; set at sign-in, cleared at logout.\n const storageUserRef = useRef<string | null>(null)\n // Moves at each logout: a sign-in still finishing from before it does not sign back in.\n const sessionRun = useRef(0)\n\n // The SDK could not recover the session (token refused, workspace not re-openable): drop to\n // 'disconnected' with a plain message, so the host's gate sends the user to sign in instead of\n // every call failing with a raw backend error. The remembered workspace is kept for next login.\n useEffect(\n () =>\n arbi.onSessionExpired?.(() => {\n storageUserRef.current = null\n setUser(null)\n selectWorkspaceId(null)\n setStatus('disconnected')\n setError(SESSION_EXPIRED_MESSAGE)\n }),\n [arbi, selectWorkspaceId]\n )\n\n // A saved name, picture or email reaches every surface reading `useConnection().user`.\n useEffect(\n () =>\n arbi.user.onProfileChange?.((profile) =>\n setUser((current) => (current ? userFromProfile(profile, current.externalId) : current))\n ),\n [arbi]\n )\n\n const enterDemo = useCallback(() => {\n setMode('demo')\n setStatus('demo')\n setError(null)\n setUser({ name: config.demoUser.name, email: config.demoUser.email })\n selectWorkspaceId(demoWorkspaceId)\n }, [config.demoUser.name, config.demoUser.email, demoWorkspaceId, selectWorkspaceId])\n\n /**\n * The session signed in, by whatever path (`login` below, a sign-in page on the host's `Arbi`,\n * a restored session): open the user's workspace and resolve who they are.\n */\n const completeSignIn = useCallback(\n async (email: string) => {\n const run = sessionRun.current\n const signedOut = () => run !== sessionRun.current\n setMode('live')\n setStatus('connecting')\n setError(null)\n try {\n storageUserRef.current = normalizeUserKey(email)\n const workspaces = await arbi.workspaces.list()\n if (workspaces?.length) {\n // Prefer the workspace the user last affirmatively selected (persisted),\n // then the configured workspace (there may be several — e.g. a\n // marketing/KM workspace), then whichever happens to be first. Ternary\n // (not `&&`) so an empty value can't leak `\"\"` into `target`.\n const persisted = readPersistedWorkspace(config.apiUrl, storageUserRef.current)\n const preferred = persisted ?? config.workspaceId\n const target =\n (preferred ? workspaces.find((w) => w.external_id === preferred) : undefined) ??\n workspaces[0]\n selectWorkspaceId(target.external_id)\n if (!(await openSelectedWorkspace()))\n throw new Error('Could not open your workspace. Try signing in again.')\n persistWorkspace(config.apiUrl, storageUserRef.current, target.external_id)\n }\n // The profile (name + avatar) comes with the login response. A session restored without\n // a login has none, so fall back to finding ourselves in the workspace roster; the email\n // local part is only the last resort, never the answer when a profile name exists.\n let resolved: ArbiUser = { name: email.split('@')[0], email }\n const me = arbi.user.identity()\n const profile = arbi.user.profile?.()\n if (profile) {\n resolved = userFromProfile(profile, me?.externalId)\n } else {\n try {\n const members = await arbi.workspaces.listUsers()\n const self = members.find((m) => m.user.external_id === me?.externalId)?.user\n if (self) {\n const fullName = [self.given_name, self.family_name].filter(Boolean).join(' ').trim()\n resolved = {\n name: fullName || email.split('@')[0],\n email: self.email || email,\n externalId: self.external_id,\n picture: self.picture ?? null,\n }\n } else if (me?.externalId) {\n resolved.externalId = me.externalId\n }\n } catch {\n // Roster not available (e.g. no workspace) — keep the fallback identity.\n }\n }\n if (signedOut()) return\n setUser(resolved)\n setStatus('authenticated')\n } catch (e) {\n if (signedOut()) return\n // Surface the real error — no silent fallback to a fake session.\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, config.workspaceId, config.apiUrl, selectWorkspaceId, openSelectedWorkspace]\n )\n\n // Every sign-in on the host's `Arbi` lands here, whichever page or kit made it.\n const signingIn = useRef<Promise<void>>(Promise.resolve())\n useEffect(\n () =>\n arbi.onSignedIn?.((login) => {\n signingIn.current = completeSignIn(\n login.profile?.email ??\n arbi.session?.getState().userEmail ??\n arbi.user.identity()?.email ??\n ''\n )\n }),\n [arbi, completeSignIn]\n )\n\n /** Authenticate: a live login when a backend is configured, otherwise the demo workspace. */\n const login = useCallback(\n async (email: string, password: string) => {\n setError(null)\n if (!isLiveConfigured) {\n enterDemo()\n return\n }\n setStatus('connecting')\n setMode('live')\n try {\n // Signed in: `completeSignIn` follows (onSignedIn); done once it is.\n await arbi.login(email, password)\n await signingIn.current\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Sign-in failed. Check your credentials.')\n setStatus('error')\n }\n },\n [arbi, enterDemo, isLiveConfigured]\n )\n\n // The session kept on this device signs in again (no password; the key stays encrypted on the\n // device). Run once even under StrictMode.\n const restoreStarted = useRef(false)\n useEffect(() => {\n if (restoreStarted.current || !isLiveConfigured) return\n restoreStarted.current = true\n arbi\n .restore()\n .catch(() => false)\n .then(async (restored) => {\n if (restored) await signingIn.current\n else setStatus('disconnected')\n })\n }, [arbi, isLiveConfigured])\n\n const logout = useCallback(() => {\n sessionRun.current++\n // The SDK stops the session's work (requests, re-logins, opens, the queries in flight) before\n // the server revokes the token.\n if (mode === 'live') {\n void arbi.logout?.()\n }\n // What was typed never outlives the session (it is sealed, but kept for no one now).\n clearSealedDrafts()\n setUser(null)\n selectWorkspaceId(null)\n persistWorkspace(config.apiUrl, storageUserRef.current, null)\n storageUserRef.current = null\n setStatus('disconnected')\n setError(null)\n }, [arbi, mode, config.apiUrl, selectWorkspaceId])\n\n // Affirmative selection: the shared workspace switch (live), then remember it so the next\n // login lands there too. This provider IS the host's navigation, so it alone (with sign-in and\n // ensureWorkspaceOpen, which re-open the host's own selection) changes the workspace; kits reach\n // another workspace with `arbi.workspaces.open`.\n const setWorkspace = useCallback(\n async (id: string) => {\n if (mode === 'live' && arbi.isLoggedIn) {\n if (!(await switchWorkspace({ id }))) throw new Error('Could not open the workspace')\n } else {\n selectWorkspaceId(id)\n }\n persistWorkspace(config.apiUrl, storageUserRef.current, id)\n },\n [arbi, mode, config.apiUrl, selectWorkspaceId, switchWorkspace]\n )\n\n // Re-open the selected workspace on the session if the server may have dropped it. Idempotent.\n // A switch in flight is waited out first, then only the selection as of then is opened (none:\n // nothing). Never a remembered or configured workspace: kits call this before reading, and\n // opening another workspace than the selected one would leave the server session in it.\n const ensureWorkspaceOpen = useCallback(async () => {\n if (mode !== 'live' || !arbi.isLoggedIn) return\n await settled()\n if (!session.getState().workspaceId) return\n await openSelectedWorkspace()\n }, [arbi, session, mode, settled, openSelectedWorkspace])\n\n const value = useMemo<ConnectionValue>(\n () => ({\n mode,\n status,\n user,\n workspaceId,\n apiConfigured: isLiveConfigured,\n apiUrl: config.apiUrl,\n deploymentDomain: isLiveConfigured ? arbi.getDeploymentDomain() : undefined,\n error,\n assistantConfig: config.assistantConfig,\n fallbackWorkspaceId: mode === 'live' ? undefined : config.workspaceId,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n }),\n [\n mode,\n status,\n user,\n workspaceId,\n isLiveConfigured,\n config.apiUrl,\n arbi,\n config.assistantConfig,\n config.workspaceId,\n error,\n login,\n enterDemo,\n logout,\n setWorkspace,\n ensureWorkspaceOpen,\n ]\n )\n\n const account = useConnectionAccount(arbi, user, logout)\n const authenticated = status === 'authenticated'\n const host = useMemo(\n () => ({ account: { client: account, useEnabled: () => authenticated } }),\n [account, authenticated]\n )\n\n return (\n <ConnectionContext.Provider value={value}>\n <ArbiHost config={host}>{children}</ArbiHost>\n </ConnectionContext.Provider>\n )\n}\n\n/**\n * The account client of the settings blocks below: the SDK's, with sign-out going through this\n * connection (so its state is cleared too) and, for a session restored without a login (no SDK\n * profile), the connection user as the profile.\n */\nfunction useConnectionAccount(\n arbi: ReturnType<typeof useArbi>,\n user: ArbiUser | null,\n logout: () => void\n): AccountClient {\n const userRef = useRef(user)\n const logoutRef = useRef(logout)\n logoutRef.current = logout\n const listeners = useRef(new Set<() => void>())\n useEffect(() => {\n userRef.current = user\n listeners.current.forEach((listener) => listener())\n }, [user])\n return useMemo(() => {\n const base = arbiAccountClient(arbi)\n return {\n ...base,\n profile: (): ProfileView | null => {\n const own = base.profile()\n const fallback = userRef.current\n if (own || !fallback) return own\n return {\n ...toProfileView({\n givenName: '',\n familyName: null,\n picture: fallback.picture ?? null,\n email: fallback.email,\n isSso: false,\n }),\n fullName: fallback.name,\n }\n },\n onProfileChange: (listener) => {\n listeners.current.add(listener)\n const off = base.onProfileChange(listener)\n return () => {\n listeners.current.delete(listener)\n off()\n }\n },\n signOut: async ({ everywhere } = {}) => {\n try {\n if (everywhere) await arbi.sessions.logoutAll()\n } finally {\n logoutRef.current()\n }\n },\n }\n }, [arbi])\n}\n\n/** The sign-in layer of `defaultHost`, or null under a host that keeps its own session. */\nexport function useOptionalConnection(): ConnectionValue | null {\n return useContext(ConnectionContext)\n}\n\nexport function useConnection(): ConnectionValue {\n const ctx = useContext(ConnectionContext)\n if (!ctx) throw new Error('useConnection needs the sign-in layer of `defaultHost` above it')\n return ctx\n}\n\nexport const isAuthenticated = (s: ConnectionStatus) => s === 'demo' || s === 'authenticated'\n\n/** The open workspace as the connected kits see it, whoever hosts them. */\nexport interface ConnectedWorkspace {\n /** The selected workspace (the session state's; with a connection, else its fallback). */\n workspaceId: string | null\n /** Signed in to a live backend: workspace-scoped queries may run. */\n live: boolean\n /** The signed-in user (their name and email, e.g. to sign a document). */\n user: ArbiUser | null\n /** The signed-in user's external id. */\n userId: string | undefined\n /** Re-assert the workspace on the server session before a workspace-scoped write. */\n ensureWorkspaceOpen: () => Promise<void>\n /**\n * Go into a workspace: select it (with a connection) and show it (`BlocksEnvironment.\n * openWorkspace`, where a host without a connection also switches its session).\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => Promise<void>\n}\n\nconst keptOpenByHost = async () => {}\n\n/** The signed-in user of a host's own session, from its login profile. */\nfunction sessionUser(arbi: ReturnType<typeof useArbi>): ArbiUser | null {\n if (!arbi.isLoggedIn) return null\n const me = arbi.user.identity()\n const profile = arbi.user.profile()\n if (!me) return null\n return profile\n ? userFromProfile(profile, me.externalId)\n : { name: (me.email ?? '').split('@')[0], email: me.email ?? '', externalId: me.externalId }\n}\n\n/**\n * The workspace for a connected kit: the sign-in layer's (`defaultHost`) when there is one, else the\n * host's own session (an app whose host config has its `arbi` and `session` and keeps its\n * workspace open itself). So a kit runs the same in Clarum and in the ARBI app.\n */\nexport function useConnectedWorkspace(): ConnectedWorkspace {\n const connection = useContext(ConnectionContext)\n const arbi = useArbi()\n const sessionWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const live = connection ? connection.status === 'authenticated' : arbi.isLoggedIn\n const user = connection ? connection.user : live ? sessionUser(arbi) : null\n const userKey = `${user?.externalId ?? ''}|${user?.name ?? ''}|${user?.email ?? ''}`\n const { openWorkspace: showWorkspace } = useBlocksEnvironment()\n return useMemo(\n () => ({\n workspaceId: connection\n ? (connection.workspaceId ?? connection.fallbackWorkspaceId ?? null)\n : sessionWorkspaceId,\n live,\n user,\n userId: user?.externalId,\n ensureWorkspaceOpen: connection?.ensureWorkspaceOpen ?? keptOpenByHost,\n openWorkspace: async (workspaceId: string, options?: { name?: string }) => {\n if (connection) await connection.setWorkspace(workspaceId)\n showWorkspace(workspaceId, options)\n },\n }),\n // `user` is rebuilt each render without a connection: its key says when it changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [connection, sessionWorkspaceId, live, userKey, showWorkspace]\n )\n}\n"]}
|