@arbidocs/blocks 0.4.21 → 0.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/agents/index.cjs +212 -212
  2. package/dist/agents/index.js +6 -6
  3. package/dist/chat/index.cjs +116 -115
  4. package/dist/chat/index.js +4 -3
  5. package/dist/chunk-5TRALRWN.js +42 -0
  6. package/dist/chunk-5TRALRWN.js.map +1 -0
  7. package/dist/{chunk-MLSRLLU7.cjs → chunk-6XQJTEBM.cjs} +6 -6
  8. package/dist/{chunk-MLSRLLU7.cjs.map → chunk-6XQJTEBM.cjs.map} +1 -1
  9. package/dist/chunk-7UTB4PHM.cjs +300 -0
  10. package/dist/chunk-7UTB4PHM.cjs.map +1 -0
  11. package/dist/chunk-AA3PT6KR.js +286 -0
  12. package/dist/chunk-AA3PT6KR.js.map +1 -0
  13. package/dist/{chunk-5LUI4G5R.js → chunk-BV7FEMSI.js} +3 -3
  14. package/dist/{chunk-5LUI4G5R.js.map → chunk-BV7FEMSI.js.map} +1 -1
  15. package/dist/{chunk-B6N5UXQX.js → chunk-CQ6CYPV4.js} +7 -281
  16. package/dist/chunk-CQ6CYPV4.js.map +1 -0
  17. package/dist/chunk-EUOGPUMJ.cjs +59 -0
  18. package/dist/chunk-EUOGPUMJ.cjs.map +1 -0
  19. package/dist/{chunk-BTDL4Q27.cjs → chunk-JCVZKCXC.cjs} +22 -69
  20. package/dist/chunk-JCVZKCXC.cjs.map +1 -0
  21. package/dist/chunk-NNH7N62N.cjs +876 -0
  22. package/dist/chunk-NNH7N62N.cjs.map +1 -0
  23. package/dist/{chunk-C7SMJ6GJ.js → chunk-PPZAAQZI.js} +6 -6
  24. package/dist/{chunk-C7SMJ6GJ.js.map → chunk-PPZAAQZI.js.map} +1 -1
  25. package/dist/{chunk-54WQYICJ.cjs → chunk-TL2DHSC5.cjs} +10 -296
  26. package/dist/chunk-TL2DHSC5.cjs.map +1 -0
  27. package/dist/chunk-UOLMFC5K.js +846 -0
  28. package/dist/chunk-UOLMFC5K.js.map +1 -0
  29. package/dist/{chunk-TO4FAMQP.cjs → chunk-XKSFJYOD.cjs} +3 -3
  30. package/dist/{chunk-TO4FAMQP.cjs.map → chunk-XKSFJYOD.cjs.map} +1 -1
  31. package/dist/{chunk-2T2ZMOA6.js → chunk-ZEIOREJY.js} +5 -36
  32. package/dist/chunk-ZEIOREJY.js.map +1 -0
  33. package/dist/connect/docx.cjs +86 -0
  34. package/dist/connect/docx.cjs.map +1 -0
  35. package/dist/connect/docx.d.ts +1 -0
  36. package/dist/connect/docx.js +84 -0
  37. package/dist/connect/docx.js.map +1 -0
  38. package/dist/connect/index.cjs +114 -47
  39. package/dist/connect/index.cjs.map +1 -1
  40. package/dist/connect/index.d.ts +1 -0
  41. package/dist/connect/index.js +89 -23
  42. package/dist/connect/index.js.map +1 -1
  43. package/dist/connection/ConnectedNativeDocxEditor.d.ts +5 -0
  44. package/dist/connection/useConnectedDocxNotifications.d.ts +9 -0
  45. package/dist/docx/DocxMentions.d.ts +17 -0
  46. package/dist/docx/NativeDocxComparison.d.ts +10 -0
  47. package/dist/docx/NativeDocxEditor.d.ts +50 -0
  48. package/dist/docx/export.d.ts +2 -0
  49. package/dist/docx/fonts.d.ts +2 -0
  50. package/dist/docx/index.cjs +116 -0
  51. package/dist/docx/index.cjs.map +1 -0
  52. package/dist/docx/index.d.ts +10 -0
  53. package/dist/docx/index.js +63 -0
  54. package/dist/docx/index.js.map +1 -0
  55. package/dist/docx/mentions.d.ts +8 -0
  56. package/dist/facts/index.cjs +2 -2
  57. package/dist/facts/index.js +2 -2
  58. package/dist/files/index.cjs +3 -3
  59. package/dist/files/index.js +3 -3
  60. package/dist/home/index.cjs +1 -1
  61. package/dist/home/index.js +1 -1
  62. package/dist/index.cjs +923 -922
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.js +17 -16
  65. package/dist/index.js.map +1 -1
  66. package/dist/settings/index.cjs +35 -35
  67. package/dist/settings/index.js +4 -4
  68. package/dist/shell/index.cjs +26 -26
  69. package/dist/shell/index.js +4 -4
  70. package/dist/studio/index.cjs +5 -4
  71. package/dist/studio/index.cjs.map +1 -1
  72. package/dist/studio/index.js +3 -2
  73. package/dist/studio/index.js.map +1 -1
  74. package/dist/workspaces/index.cjs +1 -1
  75. package/dist/workspaces/index.js +1 -1
  76. package/package.json +48 -7
  77. package/src/docx/README.md +68 -0
  78. package/src/docx/styles.css +36 -0
  79. package/dist/chunk-2T2ZMOA6.js.map +0 -1
  80. package/dist/chunk-54WQYICJ.cjs.map +0 -1
  81. package/dist/chunk-B6N5UXQX.js.map +0 -1
  82. package/dist/chunk-BTDL4Q27.cjs.map +0 -1
@@ -1,18 +1,19 @@
1
1
  "use client";
2
+ export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-5TRALRWN.js';
2
3
  import { SettingsSection, ProfileCard, AvatarPicker, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-JLOYWXRB.js';
3
- import { ConnectionProvider, useConnection } from '../chunk-2T2ZMOA6.js';
4
- export { ConnectedAssistantDock, ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useConnection, useSemanticSearch, useWorkspaceDocs } from '../chunk-2T2ZMOA6.js';
5
- import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
6
4
  import '../chunk-VILAPTCB.js';
5
+ import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
7
6
  import '../chunk-JLPYOPCX.js';
8
7
  import '../chunk-KZJAG7T3.js';
9
8
  import '../chunk-NPLYHR2E.js';
10
9
  import { initials } from '../chunk-OXF2IFXG.js';
11
10
  import '../chunk-TJMKFY5P.js';
11
+ import { ConnectionProvider, useConnection } from '../chunk-ZEIOREJY.js';
12
+ export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-ZEIOREJY.js';
12
13
  import '../chunk-7F6CBP3Z.js';
13
- import { lazy, useState, Suspense, useMemo } from 'react';
14
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
15
- import { ArbiProvider, ArtifactCanvas, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, ArbiWebSocketProvider } from '@arbidocs/react';
14
+ import { lazy, useState, Suspense, useMemo, useEffect } from 'react';
15
+ import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
16
+ import { ArbiProvider, ArtifactCanvas, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbi, useArbiWebSocket, notify, useNotify, ArbiWebSocketProvider } from '@arbidocs/react';
16
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
17
18
  import { useStreamedArtifact } from '@arbidocs/react/artifacts';
18
19
  import { UserCircle, KeyRound, Radio } from 'lucide-react';
@@ -126,7 +127,7 @@ var AVATAR_PROBLEMS = {
126
127
  "too-large": "Image must be 5 MB or smaller",
127
128
  unreadable: "Couldn't read that image \u2014 try a different file"
128
129
  };
129
- function ConnectedProfileCard({ notify, title = "Profile" }) {
130
+ function ConnectedProfileCard({ notify: notify2, title = "Profile" }) {
130
131
  const { data: profile } = useProfile();
131
132
  const updateProfile = useUpdateProfile();
132
133
  const requestEmailChange = useRequestEmailChange();
@@ -138,9 +139,9 @@ function ConnectedProfileCard({ notify, title = "Profile" }) {
138
139
  save: async (next) => {
139
140
  try {
140
141
  await updateProfile.mutateAsync(next);
141
- notify?.("Name updated", "success");
142
+ notify2?.("Name updated", "success");
142
143
  } catch (e) {
143
- notify?.("Failed to update name", "error");
144
+ notify2?.("Failed to update name", "error");
144
145
  throw e;
145
146
  }
146
147
  }
@@ -149,30 +150,30 @@ function ConnectedProfileCard({ notify, title = "Profile" }) {
149
150
  upload: async (picture) => {
150
151
  try {
151
152
  await updateProfile.mutateAsync({ picture });
152
- notify?.("Profile picture updated", "success");
153
+ notify2?.("Profile picture updated", "success");
153
154
  } catch (e) {
154
- notify?.("Failed to update picture", "error");
155
+ notify2?.("Failed to update picture", "error");
155
156
  throw e;
156
157
  }
157
158
  },
158
- onProblem: (problem) => notify?.(AVATAR_PROBLEMS[problem], "error")
159
+ onProblem: (problem) => notify2?.(AVATAR_PROBLEMS[problem], "error")
159
160
  });
160
161
  const email = useEmailChange({
161
162
  requestCode: async (address) => {
162
163
  try {
163
164
  await requestEmailChange.mutateAsync(address);
164
- notify?.("Verification code sent to your new email", "success");
165
+ notify2?.("Verification code sent to your new email", "success");
165
166
  } catch (e) {
166
- notify?.(errorText(e, "Failed to send verification code"), "error");
167
+ notify2?.(errorText(e, "Failed to send verification code"), "error");
167
168
  throw e;
168
169
  }
169
170
  },
170
171
  confirm: async (args) => {
171
172
  try {
172
173
  await confirmEmailChange.mutateAsync(args);
173
- notify?.("Email address updated", "success");
174
+ notify2?.("Email address updated", "success");
174
175
  } catch (e) {
175
- notify?.(errorText(e, "Invalid or expired verification code"), "error");
176
+ notify2?.(errorText(e, "Invalid or expired verification code"), "error");
176
177
  throw e;
177
178
  }
178
179
  }
@@ -223,7 +224,7 @@ function defaultUnmetPasswordRequirement(password) {
223
224
  return null;
224
225
  }
225
226
  function ConnectedSecuritySection({
226
- notify,
227
+ notify: notify2,
227
228
  getUnmetRequirement = defaultUnmetPasswordRequirement,
228
229
  renderRecoveryKey,
229
230
  children
@@ -236,7 +237,7 @@ function ConnectedSecuritySection({
236
237
  getUnmetRequirement,
237
238
  submit: async (vars) => {
238
239
  const result = await change.mutateAsync(vars);
239
- notify?.("Password changed successfully", "success");
240
+ notify2?.("Password changed successfully", "success");
240
241
  return result;
241
242
  },
242
243
  onClose: () => setOpen(false)
@@ -301,7 +302,7 @@ function ConnectedNotificationPreferences({
301
302
  ) }) });
302
303
  }
303
304
  function ConnectedSessionsRow({
304
- notify,
305
+ notify: notify2,
305
306
  confirm,
306
307
  renderSessionIcon
307
308
  }) {
@@ -355,7 +356,7 @@ function ConnectedSessionsRow({
355
356
  try {
356
357
  await terminate.mutateAsync(id);
357
358
  } catch {
358
- notify?.("Failed to end session. Please try again.", "error");
359
+ notify2?.("Failed to end session. Please try again.", "error");
359
360
  }
360
361
  })();
361
362
  }
@@ -392,7 +393,7 @@ function ConnectedLogoutDialog({
392
393
  }
393
394
  );
394
395
  }
395
- function ConnectedDangerZone({ notify, renderSubscriptionLink }) {
396
+ function ConnectedDangerZone({ notify: notify2, renderSubscriptionLink }) {
396
397
  const [zoneOpen, setZoneOpen] = useState(false);
397
398
  const [dialogOpen, setDialogOpen] = useState(false);
398
399
  const { user, logout } = useConnection();
@@ -402,7 +403,7 @@ function ConnectedDangerZone({ notify, renderSubscriptionLink }) {
402
403
  remove: () => remove.mutateAsync(),
403
404
  onClose: () => setDialogOpen(false),
404
405
  onDeleted: logout,
405
- onError: () => notify?.("Failed to delete account. Please try again.", "error")
406
+ onError: () => notify2?.("Failed to delete account. Please try again.", "error")
406
407
  });
407
408
  return /* @__PURE__ */ jsxs(Fragment, { children: [
408
409
  /* @__PURE__ */ jsx(
@@ -443,7 +444,72 @@ function ConnectedDangerZone({ notify, renderSubscriptionLink }) {
443
444
  )
444
445
  ] });
445
446
  }
447
+ function useConnectedDocxNotifications(onOpen) {
448
+ const arbi = useArbi();
449
+ const { status, user, apiUrl } = useConnection();
450
+ const queries = useQueryClient();
451
+ const source = `docx-mentions:${apiUrl}:${user?.externalId || ""}`;
452
+ const queryKey = ["docx-mentions", apiUrl, user?.externalId];
453
+ const { data = [] } = useQuery({
454
+ queryKey,
455
+ queryFn: () => arbi.notifications.list("docx_mention"),
456
+ enabled: status === "authenticated",
457
+ refetchInterval: 3e4
458
+ });
459
+ useArbiWebSocket((message) => {
460
+ if (message.type === "docx_mention") void queries.invalidateQueries({ queryKey });
461
+ });
462
+ useEffect(() => {
463
+ const items = [];
464
+ if (status === "authenticated")
465
+ for (const note of data) {
466
+ if (note.recipient.external_id !== user?.externalId || !note.workspace_ext_id) continue;
467
+ try {
468
+ const target = JSON.parse(note.content || "{}");
469
+ if (!target.document_id?.startsWith("doc-") || !target.comment_id) continue;
470
+ const documentId = target.document_id, commentId = target.comment_id, workspaceId = note.workspace_ext_id;
471
+ items.push({
472
+ id: `docx:${note.external_id}`,
473
+ title: "Mentioned you in a document comment",
474
+ description: [note.sender.given_name, note.sender.family_name].filter(Boolean).join(" "),
475
+ variant: "info",
476
+ ts: Date.parse(note.created_at),
477
+ read: note.read,
478
+ source,
479
+ onSelect: () => {
480
+ void Promise.resolve(onOpen({ documentId, commentId, workspaceId })).catch(
481
+ (error) => notify.error(
482
+ error instanceof Error ? error.message : "Could not open the document."
483
+ )
484
+ );
485
+ }
486
+ });
487
+ } catch {
488
+ }
489
+ }
490
+ useNotify.getState().syncSource(source, items);
491
+ return () => useNotify.getState().syncSource(source, []);
492
+ }, [data, status, user?.externalId, source, onOpen]);
493
+ const markRead = async (ids) => {
494
+ try {
495
+ await arbi.notifications.markRead(ids);
496
+ await queries.invalidateQueries({ queryKey });
497
+ } catch {
498
+ notify.error("Could not mark document mentions read.");
499
+ }
500
+ };
501
+ return {
502
+ onMarkRead: (id) => {
503
+ if (id.startsWith("docx:")) void markRead([id.slice(5)]);
504
+ },
505
+ onMarkAllRead: () => {
506
+ void markRead(
507
+ data.filter((note) => !note.read && note.recipient.external_id === user?.externalId).map((note) => note.external_id)
508
+ );
509
+ }
510
+ };
511
+ }
446
512
 
447
- export { ArbiAppProvider, ConnectedDangerZone, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedSecuritySection, ConnectedSessionsRow, StreamedArtifact, defaultUnmetPasswordRequirement, useConnectedShellWorkspaces };
513
+ export { ArbiAppProvider, ConnectedDangerZone, ConnectedLogoutDialog, ConnectedNotificationPreferences, ConnectedProfileCard, ConnectedSecuritySection, ConnectedSessionsRow, StreamedArtifact, defaultUnmetPasswordRequirement, useConnectedDocxNotifications, useConnectedShellWorkspaces };
448
514
  //# sourceMappingURL=index.js.map
449
515
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/connection/ArbiAppProvider.tsx","../../src/connection/StreamedArtifact.tsx","../../src/connection/useConnectedShellWorkspaces.ts","../../src/connection/ConnectedSettings.tsx"],"names":["jsx","useState","useWorkspaces"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAS,wBAAA,CAAyB,EAAE,QAAA,EAAS,EAA4B;AACvE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,aAAA,EAAc;AACjC,EAAA,uBACE,GAAA,CAAC,qBAAA,EAAA,EAAsB,OAAA,EAAS,MAAA,KAAW,iBAAkB,QAAA,EAAS,CAAA;AAE1E;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,MAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,CAAC,WAAW,CAAA,GAAI,QAAA;AAAA,IACpB,MACE,IAAI,WAAA,CAAY;AAAA,MACd,cAAA,EAAgB,EAAE,OAAA,EAAS,EAAE,SAAA,EAAW,KAAQ,KAAA,EAAO,CAAA,EAAG,oBAAA,EAAsB,KAAA,EAAM;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AA;AACjB,GAAA,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Composition root for a host app on the ARBI React SDK.\n *\n * QueryClientProvider → react-query cache shared with the SDK\n * ArbiProvider → the SDK's Arbi instance (no network until login)\n * ConnectionProvider → demo/live auth + workspace layer\n *\n * With no live `apiUrl`, ArbiProvider is still mounted (cheap, inert) against\n * `demoApiUrl` and the app runs entirely in seeded demo mode.\n */\nimport { useState, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { ArbiProvider, ArbiWebSocketProvider } from '@arbidocs/react'\nimport { ConnectionProvider, useConnection } from './ConnectionProvider'\nimport type { ArbiConnectionConfig } from './types'\n\n/**\n * Opens the shared SDK WebSocket once the app is live-authenticated (demo /\n * logged-out sessions have no backend, so they stay disconnected). Lives inside\n * ConnectionProvider so it can read the live status.\n */\nfunction ConnectionBoundWebSocket({ children }: { children: ReactNode }) {\n const { status } = useConnection()\n return (\n <ArbiWebSocketProvider enabled={status === 'authenticated'}>{children}</ArbiWebSocketProvider>\n )\n}\n\nexport function ArbiAppProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: { queries: { staleTime: 30_000, retry: 1, refetchOnWindowFocus: false } },\n })\n )\n\n const providerUrl = config.apiUrl || config.demoApiUrl || 'https://demo.arbi.local'\n\n return (\n <QueryClientProvider client={queryClient}>\n <ArbiProvider url={providerUrl}>\n <ConnectionProvider config={config}>\n <ConnectionBoundWebSocket>{children}</ConnectionBoundWebSocket>\n </ConnectionProvider>\n </ArbiProvider>\n </QueryClientProvider>\n )\n}\n","import { lazy, Suspense } from 'react'\nimport { ArtifactCanvas } from '@arbidocs/react'\nimport { useStreamedArtifact, type UseStreamedArtifactOptions } from '@arbidocs/react/artifacts'\nimport {\n StreamedArtifactFrame,\n type StreamedArtifactFrameLabels,\n type StreamedArtifactFrameTestIds,\n} from '../artifacts/StreamedArtifactFrame'\nimport type { ArtifactEvent } from './ai'\nimport type { StreamedArtifactEditorProps } from './StreamedArtifactEditor'\n\n// The editor (MDXEditor, Lexical) stays out of the bundle until a draft is ready to edit.\nconst StreamedArtifactEditor = lazy(() => import('./StreamedArtifactEditor'))\n\nexport interface StreamedArtifactProps\n extends\n Pick<UseStreamedArtifactOptions, 'configId' | 'parseRetry' | 'clean'>,\n Pick<\n StreamedArtifactEditorProps,\n 'editorProps' | 'onSaved' | 'onSaveError' | 'actions' | 'hideDefaultActions'\n > {\n /** The artifacts of the agent run (`useConnectedAiTask().artifacts`). */\n artifacts: ArtifactEvent[]\n workspaceId: string | undefined\n /** The agent is still working: show the live canvas. */\n busy: boolean\n /** The run failed; with no draft the canvas shows it. */\n error?: string | null\n stepCount?: number\n busyHint?: string\n emptyHint?: string\n className?: string\n /** Root test id of the editor; the preparing state is `${testId}-preparing`. */\n testId?: string\n labels?: Partial<StreamedArtifactFrameLabels>\n testIds?: Partial<StreamedArtifactFrameTestIds>\n}\n\n/**\n * An agent-drafted artifact from stream to editor, in one part. Pass the run's `artifacts` and\n * whether it is `busy`; it shows\n *\n * 1. the live `ArtifactCanvas` while the agent streams;\n * 2. \"Preparing editor...\" (the canvas stays readable underneath) while the finished draft is\n * cleaned (`cleanDraftMarkdown`), stored as version 1 of the artifact (`wpType: 'artifact'`)\n * and parsed by the backend, which can take up to about a minute;\n * 3. `ArtifactEditor` on the stored version (edit, save a new version, version list, compare\n * with track changes) when its text is ready;\n * 4. an error with Retry when storing or parsing fails.\n *\n * Needs `<ArbiProvider>` + React Query. The host imports the editor stylesheet\n * (`@mdxeditor/editor/style.css`) and defines the global `Prism` in a module it imports at app\n * start (see the Artifacts section of docs/design/blocks-package.md).\n *\n * ```tsx\n * const task = useConnectedAiTask()\n * <StreamedArtifact artifacts={task.artifacts} workspaceId={workspaceId} busy={task.status === 'running'} error={task.error} />\n * ```\n */\nexport function StreamedArtifact({\n artifacts,\n workspaceId,\n busy,\n error = null,\n stepCount,\n busyHint,\n emptyHint,\n className,\n testId = 'streamed-artifact',\n configId,\n parseRetry,\n clean,\n editorProps,\n onSaved,\n onSaveError,\n actions,\n hideDefaultActions,\n labels,\n testIds,\n}: StreamedArtifactProps) {\n const streamed = useStreamedArtifact({\n artifacts,\n workspaceId,\n settled: !busy && !error,\n configId,\n parseRetry,\n clean,\n })\n const canvas = (\n <ArtifactCanvas\n artifacts={artifacts}\n className={streamed.phase === 'streaming' ? className : undefined}\n busy={busy}\n busyHint={busyHint}\n stepCount={stepCount}\n error={error}\n emptyHint={emptyHint}\n />\n )\n return (\n <StreamedArtifactFrame\n phase={streamed.phase}\n canvas={canvas}\n className={className}\n error={streamed.error?.message}\n onRetry={streamed.retry}\n labels={labels}\n testIds={{ preparing: `${testId}-preparing`, error: `${testId}-error`, ...testIds }}\n >\n <Suspense fallback={canvas}>\n {streamed.docId && (\n <StreamedArtifactEditor\n key={streamed.docId}\n workspaceId={workspaceId}\n docId={streamed.docId}\n title={streamed.artifact?.title ?? 'Draft'}\n testId={testId}\n className={className}\n editorProps={editorProps}\n onSaved={onSaved}\n onSaveError={onSaveError}\n actions={actions}\n hideDefaultActions={hideDefaultActions}\n />\n )}\n </Suspense>\n </StreamedArtifactFrame>\n )\n}\n","import {\n useShellWorkspaces,\n useWorkspaces,\n type ShellWorkspaceSource,\n type UseShellWorkspacesOptions,\n type UseShellWorkspacesResult,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\n\nexport type UseConnectedShellWorkspacesOptions = Omit<\n UseShellWorkspacesOptions,\n 'workspaces' | 'isLoading' | 'loadError' | 'selectedId' | 'select'\n>\n\n/**\n * `useShellWorkspaces` wired to the connection layer: the account's live workspaces, the\n * connection's single selection as the active workspace, and `open` = `setWorkspace` (opens it on\n * the server, remembers it for the next login) then `onOpened`.\n *\n * ```tsx\n * const { active, recent, open } = useConnectedShellWorkspaces({\n * seed: { workspaces: demoWorkspaces, activeId: 'demo-1' },\n * onOpened: () => navigate('/app/documents'),\n * })\n * ```\n */\nexport function useConnectedShellWorkspaces(\n options: UseConnectedShellWorkspacesOptions = {}\n): UseShellWorkspacesResult {\n const { workspaceId, setWorkspace } = useConnection()\n const query = useWorkspaces()\n return useShellWorkspaces({\n ...options,\n workspaces: Array.isArray(query.data) ? (query.data as ShellWorkspaceSource[]) : undefined,\n isLoading: query.isLoading,\n loadError: query.error,\n selectedId: workspaceId,\n select: (workspace) => setWorkspace(workspace.id),\n })\n}\n","/**\n * The account area of a settings page, bound to the ARBI SDK: each section is a blocks part wired\n * to its `@arbidocs/react` hook, so a host drops them in a `SettingsPanel` and owns only the\n * layout (see the \"Settings page recipe\" in docs/design/blocks-package.md).\n *\n * Every section takes an optional `notify` for toasts and renders the default test ids of its\n * part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked\n * deletion, the password policy) is a prop.\n */\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { KeyRound, Radio, UserCircle } from 'lucide-react'\nimport {\n ImageCropModal,\n useAvatarCrop,\n useConfirmEmailChange,\n useCurrentSessionId,\n useDeleteAccount,\n useDeleteAccountFlow,\n useEmailChange,\n useLogoutAllSessions,\n useNameEditor,\n useNotificationPreferences,\n usePasswordChange,\n usePasswordChangeForm,\n useProfile,\n useRequestEmailChange,\n useSessions,\n useTerminateSession,\n useUpdateProfile,\n useWorkspaces,\n type AvatarFileProblem,\n type PasswordChangeResult,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { initials } from '../lib/format'\nimport { AvatarPicker } from '../settings/AvatarPicker'\nimport { ProfileCard } from '../settings/ProfileCard'\nimport {\n SettingsActionRow,\n SettingsCard,\n SettingsDangerZone,\n SettingsRow,\n SettingsSection,\n} from '../settings/SettingsPanel'\nimport { PasswordChangeDialog } from '../settings/PasswordChangeDialog'\nimport { ActiveSessionsDialog, DeleteAccountDialog } from '../settings/AccountDialogs'\nimport { LogoutDialog } from '../settings/LogoutDialog'\nimport { NotificationCategoryList } from '../settings/NotificationCategoryList'\nimport {\n EMAIL_NOTIFICATION_CATEGORIES,\n EMAIL_NOTIFICATION_KEYS,\n toActiveSessionViews,\n toDeleteBlockerViews,\n toLogoutSessionViews,\n toNotificationCategories,\n type EmailNotificationCategoryDef,\n} from '../settings/account-views'\nimport { useConnection } from './ConnectionProvider'\n\nexport type SettingsNotify = (message: string, kind: 'success' | 'error') => void\n\n/** The error text of a failed call: the backend `detail` when it sent one. */\nfunction errorText(error: unknown, fallback: string): string {\n const body = (error as { apiError?: { detail?: unknown } } | null)?.apiError\n return typeof body?.detail === 'string' ? body.detail : fallback\n}\n\nconst AVATAR_PROBLEMS: Record<AvatarFileProblem, string> = {\n 'not-image': 'Please choose an image file',\n 'too-large': 'Image must be 5 MB or smaller',\n unreadable: \"Couldn't read that image — try a different file\",\n}\n\n// ── Profile ─────────────────────────────────────────────────────────────────\n\nexport interface ConnectedProfileCardProps {\n notify?: SettingsNotify\n /** Section heading; default `Profile`. */\n title?: ReactNode\n}\n\n/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */\nexport function ConnectedProfileCard({ notify, title = 'Profile' }: ConnectedProfileCardProps) {\n const { data: profile } = useProfile()\n const updateProfile = useUpdateProfile()\n const requestEmailChange = useRequestEmailChange()\n const confirmEmailChange = useConfirmEmailChange()\n const { user } = useConnection()\n\n const name = useNameEditor({\n givenName: profile?.givenName,\n familyName: profile?.familyName,\n save: async (next) => {\n try {\n await updateProfile.mutateAsync(next)\n notify?.('Name updated', 'success')\n } catch (e) {\n notify?.('Failed to update name', 'error')\n throw e\n }\n },\n })\n const avatar = useAvatarCrop({\n upload: async (picture) => {\n try {\n await updateProfile.mutateAsync({ picture })\n notify?.('Profile picture updated', 'success')\n } catch (e) {\n notify?.('Failed to update picture', 'error')\n throw e\n }\n },\n onProblem: (problem) => notify?.(AVATAR_PROBLEMS[problem], 'error'),\n })\n const email = useEmailChange({\n requestCode: async (address) => {\n try {\n await requestEmailChange.mutateAsync(address)\n notify?.('Verification code sent to your new email', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Failed to send verification code'), 'error')\n throw e\n }\n },\n confirm: async (args) => {\n try {\n await confirmEmailChange.mutateAsync(args)\n notify?.('Email address updated', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Invalid or expired verification code'), 'error')\n throw e\n }\n },\n })\n\n const display = profile?.fullName || user?.name || 'Unnamed'\n return (\n <SettingsSection icon={<UserCircle />} title={title}>\n <ProfileCard\n avatar={\n <>\n <AvatarPicker\n pictureUrl={profile?.picture ?? user?.picture}\n initials={initials(display)}\n fallbackClassName=\"bg-primary text-primary-foreground\"\n isUploading={avatar.isUploading}\n onFileChosen={avatar.onFileChosen}\n />\n <ImageCropModal\n open={avatar.pendingImage !== null}\n image={avatar.pendingImage}\n title=\"Crop your photo\"\n aspect={1}\n cropShape=\"round\"\n output={{ maxSize: 128, mimeType: 'image/jpeg', quality: 0.85 }}\n onComplete={avatar.onCropComplete}\n onCancel={avatar.onCropCancel}\n />\n </>\n }\n name={{ ...name, display, isSaving: name.isSaving }}\n email={profile?.email ?? user?.email ?? ''}\n isSso={profile?.isSso ?? false}\n onStartEmailChange={email.onStart}\n emailChange={email.isOpen ? email : undefined}\n />\n </SettingsSection>\n )\n}\n\n// ── Security: password ──────────────────────────────────────────────────────\n\n/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */\nexport function defaultUnmetPasswordRequirement(password: string): string | null {\n if (password.length < 8) return 'Minimum 8 characters'\n if (!/[A-Z!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\n return 'At least one uppercase letter or special character'\n }\n if (!/[0-9]/.test(password)) return 'At least one number'\n return null\n}\n\nexport interface ConnectedSecuritySectionProps {\n notify?: SettingsNotify\n /** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */\n getUnmetRequirement?: (password: string) => string | null\n /** The recovery-key download for the key the new password produced (shown on success). */\n renderRecoveryKey?: (result: PasswordChangeResult) => ReactNode\n /** Extra rows under \"Change password\" (e.g. \"Save recovery key\"). */\n children?: ReactNode\n}\n\n/** The Security card: \"Change password\" and the dialog behind it (`PasswordChangeDialog`). */\nexport function ConnectedSecuritySection({\n notify,\n getUnmetRequirement = defaultUnmetPasswordRequirement,\n renderRecoveryKey,\n children,\n}: ConnectedSecuritySectionProps) {\n const [open, setOpen] = useState(false)\n const change = usePasswordChange()\n // Only workspaces the user belongs to are re-keyed.\n const { data: workspaces } = useWorkspaces({ enabled: open })\n const workspaceCount = (workspaces ?? []).filter((w) => w.is_member).length\n const form = usePasswordChangeForm<PasswordChangeResult>({\n getUnmetRequirement,\n submit: async (vars) => {\n const result = await change.mutateAsync(vars)\n notify?.('Password changed successfully', 'success')\n return result\n },\n onClose: () => setOpen(false),\n })\n\n return (\n <SettingsSection icon={<KeyRound />} title=\"Security\">\n <SettingsCard padding=\"sm\">\n <SettingsActionRow\n title=\"Change password\"\n description=\"Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.\"\n onClick={() => setOpen(true)}\n testId=\"change-password-button\"\n />\n {children}\n </SettingsCard>\n <PasswordChangeDialog\n open={open}\n onClose={form.onCancel}\n recoveryMode={false}\n currentPassword={form.currentPassword}\n onCurrentPasswordChange={form.onCurrentPasswordChange}\n newPassword={form.newPassword}\n onNewPasswordChange={form.onNewPasswordChange}\n confirmPassword={form.confirmPassword}\n onConfirmPasswordChange={form.onConfirmPasswordChange}\n getUnmetRequirement={getUnmetRequirement}\n workspaceCount={workspaceCount}\n error={form.error}\n isProcessing={form.isProcessing}\n isSubmitDisabled={form.isSubmitDisabled}\n onSubmit={form.onSubmit}\n success={form.result ? (renderRecoveryKey?.(form.result) ?? <></>) : null}\n onDone={form.onDone}\n />\n </SettingsSection>\n )\n}\n\n// ── Notifications ───────────────────────────────────────────────────────────\n\nexport interface ConnectedNotificationPreferencesProps {\n /** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */\n categories?: readonly EmailNotificationCategoryDef[]\n title?: ReactNode\n}\n\n/** The email-notification switches (`NotificationCategoryList`) over the user settings. */\nexport function ConnectedNotificationPreferences({\n categories = EMAIL_NOTIFICATION_CATEGORIES,\n title = 'Notifications',\n}: ConnectedNotificationPreferencesProps) {\n const keys = useMemo(\n () =>\n categories === EMAIL_NOTIFICATION_CATEGORIES\n ? EMAIL_NOTIFICATION_KEYS\n : categories.map((c) => c.key),\n [categories]\n )\n const prefs = useNotificationPreferences(keys)\n return (\n <SettingsSection title={title}>\n <SettingsCard className=\"space-y-0\">\n <NotificationCategoryList\n masterId=\"emailNotifications\"\n masterTitle=\"Email Notifications\"\n masterDescription=\"Email me about activity when I’m away\"\n masterChecked={prefs.masterChecked}\n onMasterChange={prefs.setAll}\n categories={toNotificationCategories(prefs.checked, categories)}\n onCategoryChange={prefs.setCategory}\n />\n </SettingsCard>\n </SettingsSection>\n )\n}\n\n// ── Sessions ────────────────────────────────────────────────────────────────\n\nexport interface ConnectedSessionsRowProps {\n notify?: SettingsNotify\n /** Ask before ending a session; resolve `false` to cancel. Default: end at once. */\n confirm?: (message: string) => Promise<boolean> | boolean\n /** Glyph per session status. */\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** \"Active sessions\" row with the manage dialog (`ActiveSessionsDialog`); end any but this device. */\nexport function ConnectedSessionsRow({\n notify,\n confirm,\n renderSessionIcon,\n}: ConnectedSessionsRowProps) {\n const [open, setOpen] = useState(false)\n const sessions = useSessions({ enabled: open })\n const currentSessionId = useCurrentSessionId()\n const terminate = useTerminateSession()\n const views = toActiveSessionViews(sessions.data ?? [], {\n currentSessionId,\n terminatingId: terminate.isPending ? terminate.variables : null,\n renderIcon: renderSessionIcon,\n })\n return (\n <>\n <SettingsRow\n label=\"Active sessions\"\n description=\"Devices and agents currently signed in to your account.\"\n >\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOpen(true)}\n className=\"flex items-center gap-2\"\n data-testid=\"active-sessions-button\"\n >\n <Radio className=\"h-4 w-4\" />\n Manage\n </Button>\n </SettingsRow>\n <ActiveSessionsDialog\n open={open}\n onOpenChange={setOpen}\n isLoading={sessions.isLoading}\n sessions={views}\n onTerminate={(id) => {\n void (async () => {\n const view = views.find((v) => v.id === id)\n const label = view?.detail.split(' · ')[0]\n const ok =\n (await confirm?.(\n `End the session on ${label}? It will be signed out immediately.`\n )) ?? true\n if (!ok) return\n try {\n await terminate.mutateAsync(id)\n } catch {\n notify?.('Failed to end session. Please try again.', 'error')\n }\n })()\n }}\n />\n </>\n )\n}\n\nexport interface ConnectedLogoutDialogProps {\n open: boolean\n onClose: () => void\n isOnline?: boolean\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. */\nexport function ConnectedLogoutDialog({\n open,\n onClose,\n isOnline = true,\n renderSessionIcon,\n}: ConnectedLogoutDialogProps) {\n const { logout } = useConnection()\n const sessions = useSessions({ enabled: open })\n const logoutAll = useLogoutAllSessions()\n return (\n <LogoutDialog\n open={open}\n onClose={onClose}\n onLogoutThis={() => {\n onClose()\n logout()\n }}\n onLogoutAll={() => {\n onClose()\n // The server drops every session first; the connection then forgets this one.\n void logoutAll.mutateAsync().finally(logout)\n }}\n canLogoutAll\n isOnline={isOnline}\n sessions={toLogoutSessionViews(sessions.data ?? [])}\n renderSessionIcon={renderSessionIcon}\n />\n )\n}\n\n// ── Danger zone ─────────────────────────────────────────────────────────────\n\nexport interface ConnectedDangerZoneProps {\n notify?: SettingsNotify\n /** Link to the billing page for a deletion blocked by an active subscription. */\n renderSubscriptionLink?: () => ReactNode\n}\n\n/** \"Delete your account\": the collapsed danger zone and the two-step dialog (`DeleteAccountDialog`). */\nexport function ConnectedDangerZone({ notify, renderSubscriptionLink }: ConnectedDangerZoneProps) {\n const [zoneOpen, setZoneOpen] = useState(false)\n const [dialogOpen, setDialogOpen] = useState(false)\n const { user, logout } = useConnection()\n const remove = useDeleteAccount()\n const flow = useDeleteAccountFlow({\n userEmail: user?.email ?? '',\n remove: () => remove.mutateAsync(),\n onClose: () => setDialogOpen(false),\n onDeleted: logout,\n onError: () => notify?.('Failed to delete account. Please try again.', 'error'),\n })\n return (\n <>\n <SettingsDangerZone\n isOpen={zoneOpen}\n onToggle={() => setZoneOpen((o) => !o)}\n title=\"Delete your account\"\n description=\"Once deleted, your account will be immediately closed and you will be logged out. This action cannot be undone.\"\n action={\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={!user?.email}\n onClick={() => setDialogOpen(true)}\n data-testid=\"delete-account-button\"\n >\n Delete Account\n </Button>\n }\n />\n <DeleteAccountDialog\n open={dialogOpen}\n onClose={flow.onClose}\n step={flow.step}\n blockers={toDeleteBlockerViews(flow.blockers, renderSubscriptionLink)}\n onContinue={flow.onContinue}\n onBack={flow.onBack}\n userEmail={user?.email ?? ''}\n confirmEmail={flow.confirmEmail}\n onConfirmEmailChange={flow.onConfirmEmailChange}\n isDeleting={flow.isDeleting}\n onSubmit={flow.onSubmit}\n />\n </>\n )\n}\n"]}
1
+ {"version":3,"sources":["../../src/connection/ArbiAppProvider.tsx","../../src/connection/StreamedArtifact.tsx","../../src/connection/useConnectedShellWorkspaces.ts","../../src/connection/ConnectedSettings.tsx","../../src/connection/useConnectedDocxNotifications.ts"],"names":["jsx","notify","useState","useWorkspaces"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,wBAAA,CAAyB,EAAE,QAAA,EAAS,EAA4B;AACvE,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,aAAA,EAAc;AACjC,EAAA,uBACE,GAAA,CAAC,qBAAA,EAAA,EAAsB,OAAA,EAAS,MAAA,KAAW,iBAAkB,QAAA,EAAS,CAAA;AAE1E;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,MAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,MAAM,CAAC,WAAW,CAAA,GAAI,QAAA;AAAA,IACpB,MACE,IAAI,WAAA,CAAY;AAAA,MACd,cAAA,EAAgB,EAAE,OAAA,EAAS,EAAE,SAAA,EAAW,KAA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,MAAA,EAAQ,MAAM,CAAC,CAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAO,GAAA,KAAkB;AACxC,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,CAAK,aAAA,CAAc,QAAA,CAAS,GAAG,CAAA;AACrC,MAAA,MAAM,OAAA,CAAQ,iBAAA,CAAkB,EAAE,QAAA,EAAU,CAAA;AAAA,IAC9C,CAAA,CAAA,MAAQ;AACN,MAAA,MAAA,CAAO,MAAM,wCAAwC,CAAA;AAAA,IACvD;AAAA,EACF,CAAA;AACA,EAAA,OAAO;AAAA,IACL,UAAA,EAAY,CAAC,EAAA,KAAe;AAC1B,MAAA,IAAI,EAAA,CAAG,UAAA,CAAW,OAAO,CAAA,EAAG,KAAK,QAAA,CAAS,CAAC,EAAA,CAAG,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAAA,IACzD,CAAA;AAAA,IACA,eAAe,MAAM;AACnB,MAAA,KAAK,QAAA;AAAA,QACH,KACG,MAAA,CAAO,CAAC,IAAA,KAAS,CAAC,KAAK,IAAA,IAAQ,IAAA,CAAK,SAAA,CAAU,WAAA,KAAgB,MAAM,UAAU,CAAA,CAC9E,IAAI,CAAC,IAAA,KAAS,KAAK,WAAW;AAAA,OACnC;AAAA,IACF;AAAA,GACF;AACF","file":"index.js","sourcesContent":["/**\n * Composition root for a host app on the ARBI React SDK.\n *\n * QueryClientProvider → react-query cache shared with the SDK\n * ArbiProvider → the SDK's Arbi instance (no network until login)\n * ConnectionProvider → demo/live auth + workspace layer\n *\n * With no live `apiUrl`, ArbiProvider is still mounted (cheap, inert) against\n * `demoApiUrl` and the app runs entirely in seeded demo mode.\n */\nimport { useState, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { ArbiProvider, ArbiWebSocketProvider } from '@arbidocs/react'\nimport { ConnectionProvider, useConnection } from './ConnectionProvider'\nimport type { ArbiConnectionConfig } from './types'\n\n/**\n * Opens the shared SDK WebSocket once the app is live-authenticated (demo /\n * logged-out sessions have no backend, so they stay disconnected). Lives inside\n * ConnectionProvider so it can read the live status.\n */\nfunction ConnectionBoundWebSocket({ children }: { children: ReactNode }) {\n const { status } = useConnection()\n return (\n <ArbiWebSocketProvider enabled={status === 'authenticated'}>{children}</ArbiWebSocketProvider>\n )\n}\n\nexport function ArbiAppProvider({\n config,\n children,\n}: {\n config: ArbiConnectionConfig\n children: ReactNode\n}) {\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: { queries: { staleTime: 30_000, retry: 1, refetchOnWindowFocus: false } },\n })\n )\n\n const providerUrl = config.apiUrl || config.demoApiUrl || 'https://demo.arbi.local'\n\n return (\n <QueryClientProvider client={queryClient}>\n <ArbiProvider url={providerUrl}>\n <ConnectionProvider config={config}>\n <ConnectionBoundWebSocket>{children}</ConnectionBoundWebSocket>\n </ConnectionProvider>\n </ArbiProvider>\n </QueryClientProvider>\n )\n}\n","import { lazy, Suspense } from 'react'\nimport { ArtifactCanvas } from '@arbidocs/react'\nimport { useStreamedArtifact, type UseStreamedArtifactOptions } from '@arbidocs/react/artifacts'\nimport {\n StreamedArtifactFrame,\n type StreamedArtifactFrameLabels,\n type StreamedArtifactFrameTestIds,\n} from '../artifacts/StreamedArtifactFrame'\nimport type { ArtifactEvent } from './ai'\nimport type { StreamedArtifactEditorProps } from './StreamedArtifactEditor'\n\n// The editor (MDXEditor, Lexical) stays out of the bundle until a draft is ready to edit.\nconst StreamedArtifactEditor = lazy(() => import('./StreamedArtifactEditor'))\n\nexport interface StreamedArtifactProps\n extends\n Pick<UseStreamedArtifactOptions, 'configId' | 'parseRetry' | 'clean'>,\n Pick<\n StreamedArtifactEditorProps,\n 'editorProps' | 'onSaved' | 'onSaveError' | 'actions' | 'hideDefaultActions'\n > {\n /** The artifacts of the agent run (`useConnectedAiTask().artifacts`). */\n artifacts: ArtifactEvent[]\n workspaceId: string | undefined\n /** The agent is still working: show the live canvas. */\n busy: boolean\n /** The run failed; with no draft the canvas shows it. */\n error?: string | null\n stepCount?: number\n busyHint?: string\n emptyHint?: string\n className?: string\n /** Root test id of the editor; the preparing state is `${testId}-preparing`. */\n testId?: string\n labels?: Partial<StreamedArtifactFrameLabels>\n testIds?: Partial<StreamedArtifactFrameTestIds>\n}\n\n/**\n * An agent-drafted artifact from stream to editor, in one part. Pass the run's `artifacts` and\n * whether it is `busy`; it shows\n *\n * 1. the live `ArtifactCanvas` while the agent streams;\n * 2. \"Preparing editor...\" (the canvas stays readable underneath) while the finished draft is\n * cleaned (`cleanDraftMarkdown`), stored as version 1 of the artifact (`wpType: 'artifact'`)\n * and parsed by the backend, which can take up to about a minute;\n * 3. `ArtifactEditor` on the stored version (edit, save a new version, version list, compare\n * with track changes) when its text is ready;\n * 4. an error with Retry when storing or parsing fails.\n *\n * Needs `<ArbiProvider>` + React Query. The host imports the editor stylesheet\n * (`@mdxeditor/editor/style.css`) and defines the global `Prism` in a module it imports at app\n * start (see the Artifacts section of docs/design/blocks-package.md).\n *\n * ```tsx\n * const task = useConnectedAiTask()\n * <StreamedArtifact artifacts={task.artifacts} workspaceId={workspaceId} busy={task.status === 'running'} error={task.error} />\n * ```\n */\nexport function StreamedArtifact({\n artifacts,\n workspaceId,\n busy,\n error = null,\n stepCount,\n busyHint,\n emptyHint,\n className,\n testId = 'streamed-artifact',\n configId,\n parseRetry,\n clean,\n editorProps,\n onSaved,\n onSaveError,\n actions,\n hideDefaultActions,\n labels,\n testIds,\n}: StreamedArtifactProps) {\n const streamed = useStreamedArtifact({\n artifacts,\n workspaceId,\n settled: !busy && !error,\n configId,\n parseRetry,\n clean,\n })\n const canvas = (\n <ArtifactCanvas\n artifacts={artifacts}\n className={streamed.phase === 'streaming' ? className : undefined}\n busy={busy}\n busyHint={busyHint}\n stepCount={stepCount}\n error={error}\n emptyHint={emptyHint}\n />\n )\n return (\n <StreamedArtifactFrame\n phase={streamed.phase}\n canvas={canvas}\n className={className}\n error={streamed.error?.message}\n onRetry={streamed.retry}\n labels={labels}\n testIds={{ preparing: `${testId}-preparing`, error: `${testId}-error`, ...testIds }}\n >\n <Suspense fallback={canvas}>\n {streamed.docId && (\n <StreamedArtifactEditor\n key={streamed.docId}\n workspaceId={workspaceId}\n docId={streamed.docId}\n title={streamed.artifact?.title ?? 'Draft'}\n testId={testId}\n className={className}\n editorProps={editorProps}\n onSaved={onSaved}\n onSaveError={onSaveError}\n actions={actions}\n hideDefaultActions={hideDefaultActions}\n />\n )}\n </Suspense>\n </StreamedArtifactFrame>\n )\n}\n","import {\n useShellWorkspaces,\n useWorkspaces,\n type ShellWorkspaceSource,\n type UseShellWorkspacesOptions,\n type UseShellWorkspacesResult,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\n\nexport type UseConnectedShellWorkspacesOptions = Omit<\n UseShellWorkspacesOptions,\n 'workspaces' | 'isLoading' | 'loadError' | 'selectedId' | 'select'\n>\n\n/**\n * `useShellWorkspaces` wired to the connection layer: the account's live workspaces, the\n * connection's single selection as the active workspace, and `open` = `setWorkspace` (opens it on\n * the server, remembers it for the next login) then `onOpened`.\n *\n * ```tsx\n * const { active, recent, open } = useConnectedShellWorkspaces({\n * seed: { workspaces: demoWorkspaces, activeId: 'demo-1' },\n * onOpened: () => navigate('/app/documents'),\n * })\n * ```\n */\nexport function useConnectedShellWorkspaces(\n options: UseConnectedShellWorkspacesOptions = {}\n): UseShellWorkspacesResult {\n const { workspaceId, setWorkspace } = useConnection()\n const query = useWorkspaces()\n return useShellWorkspaces({\n ...options,\n workspaces: Array.isArray(query.data) ? (query.data as ShellWorkspaceSource[]) : undefined,\n isLoading: query.isLoading,\n loadError: query.error,\n selectedId: workspaceId,\n select: (workspace) => setWorkspace(workspace.id),\n })\n}\n","/**\n * The account area of a settings page, bound to the ARBI SDK: each section is a blocks part wired\n * to its `@arbidocs/react` hook, so a host drops them in a `SettingsPanel` and owns only the\n * layout (see the \"Settings page recipe\" in docs/design/blocks-package.md).\n *\n * Every section takes an optional `notify` for toasts and renders the default test ids of its\n * part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked\n * deletion, the password policy) is a prop.\n */\nimport { useMemo, useState, type ReactNode } from 'react'\nimport { KeyRound, Radio, UserCircle } from 'lucide-react'\nimport {\n ImageCropModal,\n useAvatarCrop,\n useConfirmEmailChange,\n useCurrentSessionId,\n useDeleteAccount,\n useDeleteAccountFlow,\n useEmailChange,\n useLogoutAllSessions,\n useNameEditor,\n useNotificationPreferences,\n usePasswordChange,\n usePasswordChangeForm,\n useProfile,\n useRequestEmailChange,\n useSessions,\n useTerminateSession,\n useUpdateProfile,\n useWorkspaces,\n type AvatarFileProblem,\n type PasswordChangeResult,\n} from '@arbidocs/react'\nimport { Button } from '@arbidocs/react/ui'\nimport { initials } from '../lib/format'\nimport { AvatarPicker } from '../settings/AvatarPicker'\nimport { ProfileCard } from '../settings/ProfileCard'\nimport {\n SettingsActionRow,\n SettingsCard,\n SettingsDangerZone,\n SettingsRow,\n SettingsSection,\n} from '../settings/SettingsPanel'\nimport { PasswordChangeDialog } from '../settings/PasswordChangeDialog'\nimport { ActiveSessionsDialog, DeleteAccountDialog } from '../settings/AccountDialogs'\nimport { LogoutDialog } from '../settings/LogoutDialog'\nimport { NotificationCategoryList } from '../settings/NotificationCategoryList'\nimport {\n EMAIL_NOTIFICATION_CATEGORIES,\n EMAIL_NOTIFICATION_KEYS,\n toActiveSessionViews,\n toDeleteBlockerViews,\n toLogoutSessionViews,\n toNotificationCategories,\n type EmailNotificationCategoryDef,\n} from '../settings/account-views'\nimport { useConnection } from './ConnectionProvider'\n\nexport type SettingsNotify = (message: string, kind: 'success' | 'error') => void\n\n/** The error text of a failed call: the backend `detail` when it sent one. */\nfunction errorText(error: unknown, fallback: string): string {\n const body = (error as { apiError?: { detail?: unknown } } | null)?.apiError\n return typeof body?.detail === 'string' ? body.detail : fallback\n}\n\nconst AVATAR_PROBLEMS: Record<AvatarFileProblem, string> = {\n 'not-image': 'Please choose an image file',\n 'too-large': 'Image must be 5 MB or smaller',\n unreadable: \"Couldn't read that image — try a different file\",\n}\n\n// ── Profile ─────────────────────────────────────────────────────────────────\n\nexport interface ConnectedProfileCardProps {\n notify?: SettingsNotify\n /** Section heading; default `Profile`. */\n title?: ReactNode\n}\n\n/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */\nexport function ConnectedProfileCard({ notify, title = 'Profile' }: ConnectedProfileCardProps) {\n const { data: profile } = useProfile()\n const updateProfile = useUpdateProfile()\n const requestEmailChange = useRequestEmailChange()\n const confirmEmailChange = useConfirmEmailChange()\n const { user } = useConnection()\n\n const name = useNameEditor({\n givenName: profile?.givenName,\n familyName: profile?.familyName,\n save: async (next) => {\n try {\n await updateProfile.mutateAsync(next)\n notify?.('Name updated', 'success')\n } catch (e) {\n notify?.('Failed to update name', 'error')\n throw e\n }\n },\n })\n const avatar = useAvatarCrop({\n upload: async (picture) => {\n try {\n await updateProfile.mutateAsync({ picture })\n notify?.('Profile picture updated', 'success')\n } catch (e) {\n notify?.('Failed to update picture', 'error')\n throw e\n }\n },\n onProblem: (problem) => notify?.(AVATAR_PROBLEMS[problem], 'error'),\n })\n const email = useEmailChange({\n requestCode: async (address) => {\n try {\n await requestEmailChange.mutateAsync(address)\n notify?.('Verification code sent to your new email', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Failed to send verification code'), 'error')\n throw e\n }\n },\n confirm: async (args) => {\n try {\n await confirmEmailChange.mutateAsync(args)\n notify?.('Email address updated', 'success')\n } catch (e) {\n notify?.(errorText(e, 'Invalid or expired verification code'), 'error')\n throw e\n }\n },\n })\n\n const display = profile?.fullName || user?.name || 'Unnamed'\n return (\n <SettingsSection icon={<UserCircle />} title={title}>\n <ProfileCard\n avatar={\n <>\n <AvatarPicker\n pictureUrl={profile?.picture ?? user?.picture}\n initials={initials(display)}\n fallbackClassName=\"bg-primary text-primary-foreground\"\n isUploading={avatar.isUploading}\n onFileChosen={avatar.onFileChosen}\n />\n <ImageCropModal\n open={avatar.pendingImage !== null}\n image={avatar.pendingImage}\n title=\"Crop your photo\"\n aspect={1}\n cropShape=\"round\"\n output={{ maxSize: 128, mimeType: 'image/jpeg', quality: 0.85 }}\n onComplete={avatar.onCropComplete}\n onCancel={avatar.onCropCancel}\n />\n </>\n }\n name={{ ...name, display, isSaving: name.isSaving }}\n email={profile?.email ?? user?.email ?? ''}\n isSso={profile?.isSso ?? false}\n onStartEmailChange={email.onStart}\n emailChange={email.isOpen ? email : undefined}\n />\n </SettingsSection>\n )\n}\n\n// ── Security: password ──────────────────────────────────────────────────────\n\n/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */\nexport function defaultUnmetPasswordRequirement(password: string): string | null {\n if (password.length < 8) return 'Minimum 8 characters'\n if (!/[A-Z!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password)) {\n return 'At least one uppercase letter or special character'\n }\n if (!/[0-9]/.test(password)) return 'At least one number'\n return null\n}\n\nexport interface ConnectedSecuritySectionProps {\n notify?: SettingsNotify\n /** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */\n getUnmetRequirement?: (password: string) => string | null\n /** The recovery-key download for the key the new password produced (shown on success). */\n renderRecoveryKey?: (result: PasswordChangeResult) => ReactNode\n /** Extra rows under \"Change password\" (e.g. \"Save recovery key\"). */\n children?: ReactNode\n}\n\n/** The Security card: \"Change password\" and the dialog behind it (`PasswordChangeDialog`). */\nexport function ConnectedSecuritySection({\n notify,\n getUnmetRequirement = defaultUnmetPasswordRequirement,\n renderRecoveryKey,\n children,\n}: ConnectedSecuritySectionProps) {\n const [open, setOpen] = useState(false)\n const change = usePasswordChange()\n // Only workspaces the user belongs to are re-keyed.\n const { data: workspaces } = useWorkspaces({ enabled: open })\n const workspaceCount = (workspaces ?? []).filter((w) => w.is_member).length\n const form = usePasswordChangeForm<PasswordChangeResult>({\n getUnmetRequirement,\n submit: async (vars) => {\n const result = await change.mutateAsync(vars)\n notify?.('Password changed successfully', 'success')\n return result\n },\n onClose: () => setOpen(false),\n })\n\n return (\n <SettingsSection icon={<KeyRound />} title=\"Security\">\n <SettingsCard padding=\"sm\">\n <SettingsActionRow\n title=\"Change password\"\n description=\"Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.\"\n onClick={() => setOpen(true)}\n testId=\"change-password-button\"\n />\n {children}\n </SettingsCard>\n <PasswordChangeDialog\n open={open}\n onClose={form.onCancel}\n recoveryMode={false}\n currentPassword={form.currentPassword}\n onCurrentPasswordChange={form.onCurrentPasswordChange}\n newPassword={form.newPassword}\n onNewPasswordChange={form.onNewPasswordChange}\n confirmPassword={form.confirmPassword}\n onConfirmPasswordChange={form.onConfirmPasswordChange}\n getUnmetRequirement={getUnmetRequirement}\n workspaceCount={workspaceCount}\n error={form.error}\n isProcessing={form.isProcessing}\n isSubmitDisabled={form.isSubmitDisabled}\n onSubmit={form.onSubmit}\n success={form.result ? (renderRecoveryKey?.(form.result) ?? <></>) : null}\n onDone={form.onDone}\n />\n </SettingsSection>\n )\n}\n\n// ── Notifications ───────────────────────────────────────────────────────────\n\nexport interface ConnectedNotificationPreferencesProps {\n /** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */\n categories?: readonly EmailNotificationCategoryDef[]\n title?: ReactNode\n}\n\n/** The email-notification switches (`NotificationCategoryList`) over the user settings. */\nexport function ConnectedNotificationPreferences({\n categories = EMAIL_NOTIFICATION_CATEGORIES,\n title = 'Notifications',\n}: ConnectedNotificationPreferencesProps) {\n const keys = useMemo(\n () =>\n categories === EMAIL_NOTIFICATION_CATEGORIES\n ? EMAIL_NOTIFICATION_KEYS\n : categories.map((c) => c.key),\n [categories]\n )\n const prefs = useNotificationPreferences(keys)\n return (\n <SettingsSection title={title}>\n <SettingsCard className=\"space-y-0\">\n <NotificationCategoryList\n masterId=\"emailNotifications\"\n masterTitle=\"Email Notifications\"\n masterDescription=\"Email me about activity when I’m away\"\n masterChecked={prefs.masterChecked}\n onMasterChange={prefs.setAll}\n categories={toNotificationCategories(prefs.checked, categories)}\n onCategoryChange={prefs.setCategory}\n />\n </SettingsCard>\n </SettingsSection>\n )\n}\n\n// ── Sessions ────────────────────────────────────────────────────────────────\n\nexport interface ConnectedSessionsRowProps {\n notify?: SettingsNotify\n /** Ask before ending a session; resolve `false` to cancel. Default: end at once. */\n confirm?: (message: string) => Promise<boolean> | boolean\n /** Glyph per session status. */\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** \"Active sessions\" row with the manage dialog (`ActiveSessionsDialog`); end any but this device. */\nexport function ConnectedSessionsRow({\n notify,\n confirm,\n renderSessionIcon,\n}: ConnectedSessionsRowProps) {\n const [open, setOpen] = useState(false)\n const sessions = useSessions({ enabled: open })\n const currentSessionId = useCurrentSessionId()\n const terminate = useTerminateSession()\n const views = toActiveSessionViews(sessions.data ?? [], {\n currentSessionId,\n terminatingId: terminate.isPending ? terminate.variables : null,\n renderIcon: renderSessionIcon,\n })\n return (\n <>\n <SettingsRow\n label=\"Active sessions\"\n description=\"Devices and agents currently signed in to your account.\"\n >\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setOpen(true)}\n className=\"flex items-center gap-2\"\n data-testid=\"active-sessions-button\"\n >\n <Radio className=\"h-4 w-4\" />\n Manage\n </Button>\n </SettingsRow>\n <ActiveSessionsDialog\n open={open}\n onOpenChange={setOpen}\n isLoading={sessions.isLoading}\n sessions={views}\n onTerminate={(id) => {\n void (async () => {\n const view = views.find((v) => v.id === id)\n const label = view?.detail.split(' · ')[0]\n const ok =\n (await confirm?.(\n `End the session on ${label}? It will be signed out immediately.`\n )) ?? true\n if (!ok) return\n try {\n await terminate.mutateAsync(id)\n } catch {\n notify?.('Failed to end session. Please try again.', 'error')\n }\n })()\n }}\n />\n </>\n )\n}\n\nexport interface ConnectedLogoutDialogProps {\n open: boolean\n onClose: () => void\n isOnline?: boolean\n renderSessionIcon?: (status: string) => ReactNode\n}\n\n/** Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. */\nexport function ConnectedLogoutDialog({\n open,\n onClose,\n isOnline = true,\n renderSessionIcon,\n}: ConnectedLogoutDialogProps) {\n const { logout } = useConnection()\n const sessions = useSessions({ enabled: open })\n const logoutAll = useLogoutAllSessions()\n return (\n <LogoutDialog\n open={open}\n onClose={onClose}\n onLogoutThis={() => {\n onClose()\n logout()\n }}\n onLogoutAll={() => {\n onClose()\n // The server drops every session first; the connection then forgets this one.\n void logoutAll.mutateAsync().finally(logout)\n }}\n canLogoutAll\n isOnline={isOnline}\n sessions={toLogoutSessionViews(sessions.data ?? [])}\n renderSessionIcon={renderSessionIcon}\n />\n )\n}\n\n// ── Danger zone ─────────────────────────────────────────────────────────────\n\nexport interface ConnectedDangerZoneProps {\n notify?: SettingsNotify\n /** Link to the billing page for a deletion blocked by an active subscription. */\n renderSubscriptionLink?: () => ReactNode\n}\n\n/** \"Delete your account\": the collapsed danger zone and the two-step dialog (`DeleteAccountDialog`). */\nexport function ConnectedDangerZone({ notify, renderSubscriptionLink }: ConnectedDangerZoneProps) {\n const [zoneOpen, setZoneOpen] = useState(false)\n const [dialogOpen, setDialogOpen] = useState(false)\n const { user, logout } = useConnection()\n const remove = useDeleteAccount()\n const flow = useDeleteAccountFlow({\n userEmail: user?.email ?? '',\n remove: () => remove.mutateAsync(),\n onClose: () => setDialogOpen(false),\n onDeleted: logout,\n onError: () => notify?.('Failed to delete account. Please try again.', 'error'),\n })\n return (\n <>\n <SettingsDangerZone\n isOpen={zoneOpen}\n onToggle={() => setZoneOpen((o) => !o)}\n title=\"Delete your account\"\n description=\"Once deleted, your account will be immediately closed and you will be logged out. This action cannot be undone.\"\n action={\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={!user?.email}\n onClick={() => setDialogOpen(true)}\n data-testid=\"delete-account-button\"\n >\n Delete Account\n </Button>\n }\n />\n <DeleteAccountDialog\n open={dialogOpen}\n onClose={flow.onClose}\n step={flow.step}\n blockers={toDeleteBlockerViews(flow.blockers, renderSubscriptionLink)}\n onContinue={flow.onContinue}\n onBack={flow.onBack}\n userEmail={user?.email ?? ''}\n confirmEmail={flow.confirmEmail}\n onConfirmEmailChange={flow.onConfirmEmailChange}\n isDeleting={flow.isDeleting}\n onSubmit={flow.onSubmit}\n />\n </>\n )\n}\n","import { useEffect } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, useArbiWebSocket, useNotify, notify, type AppNotification } from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\n\n/** Bridge persisted document mentions to the shared bell; hosts own routing. */\nexport function useConnectedDocxNotifications(\n onOpen: (target: {\n workspaceId: string\n documentId: string\n commentId: string\n }) => void | Promise<void>\n) {\n const arbi = useArbi()\n const { status, user, apiUrl } = useConnection()\n const queries = useQueryClient()\n const source = `docx-mentions:${apiUrl}:${user?.externalId || ''}`\n const queryKey = ['docx-mentions', apiUrl, user?.externalId]\n const { data = [] } = useQuery({\n queryKey,\n queryFn: () => arbi.notifications.list('docx_mention'),\n enabled: status === 'authenticated',\n refetchInterval: 30_000,\n })\n useArbiWebSocket((message) => {\n if (message.type === 'docx_mention') void queries.invalidateQueries({ queryKey })\n })\n useEffect(() => {\n const items: AppNotification[] = []\n if (status === 'authenticated')\n for (const note of data) {\n if (note.recipient.external_id !== user?.externalId || !note.workspace_ext_id) continue\n try {\n const target = JSON.parse(note.content || '{}') as {\n document_id?: string\n comment_id?: string\n }\n if (!target.document_id?.startsWith('doc-') || !target.comment_id) continue\n const documentId = target.document_id,\n commentId = target.comment_id,\n workspaceId = note.workspace_ext_id\n items.push({\n id: `docx:${note.external_id}`,\n title: 'Mentioned you in a document comment',\n description: [note.sender.given_name, note.sender.family_name]\n .filter(Boolean)\n .join(' '),\n variant: 'info',\n ts: Date.parse(note.created_at),\n read: note.read,\n source,\n onSelect: () => {\n void Promise.resolve(onOpen({ documentId, commentId, workspaceId })).catch((error) =>\n notify.error(\n error instanceof Error ? error.message : 'Could not open the document.'\n )\n )\n },\n })\n } catch {\n /* Ignore invalid legacy payloads. */\n }\n }\n useNotify.getState().syncSource(source, items)\n return () => useNotify.getState().syncSource(source, [])\n }, [data, status, user?.externalId, source, onOpen])\n const markRead = async (ids: string[]) => {\n try {\n await arbi.notifications.markRead(ids)\n await queries.invalidateQueries({ queryKey })\n } catch {\n notify.error('Could not mark document mentions read.')\n }\n }\n return {\n onMarkRead: (id: string) => {\n if (id.startsWith('docx:')) void markRead([id.slice(5)])\n },\n onMarkAllRead: () => {\n void markRead(\n data\n .filter((note) => !note.read && note.recipient.external_id === user?.externalId)\n .map((note) => note.external_id)\n )\n },\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { type NativeDocxEditorProps } from '../docx/NativeDocxEditor';
2
+ /** Native Word widget bound to the standard blocks connection and SDK session. */
3
+ export declare function ConnectedNativeDocxEditor({ fontBaseUrl, ...props }: Omit<NativeDocxEditorProps, 'adapter'> & {
4
+ fontBaseUrl?: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ /** Bridge persisted document mentions to the shared bell; hosts own routing. */
2
+ export declare function useConnectedDocxNotifications(onOpen: (target: {
3
+ workspaceId: string;
4
+ documentId: string;
5
+ commentId: string;
6
+ }) => void | Promise<void>): {
7
+ onMarkRead: (id: string) => void;
8
+ onMarkAllRead: () => void;
9
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type DocxMention } from './mentions';
3
+ export type { DocxMention } from './mentions';
4
+ export interface DocxAgentCommentRequest {
5
+ commentId: string;
6
+ instruction: string;
7
+ requestId: string;
8
+ recipientIds: string[];
9
+ }
10
+ /** Adds mentions to the upstream comment inputs without replacing its review layout. */
11
+ export declare function DocxMentions({ children, mentions, initialCommentId, requestAgent, notify, }: {
12
+ children: React.ReactNode;
13
+ mentions?: readonly DocxMention[];
14
+ initialCommentId?: string;
15
+ requestAgent?: (request: DocxAgentCommentRequest) => Promise<void>;
16
+ notify?: (message: string, kind: 'success' | 'error') => void;
17
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { type NativeDocxAdapter } from './NativeDocxEditor';
2
+ export interface NativeDocxComparisonProps {
3
+ adapter: NativeDocxAdapter;
4
+ baseId: string;
5
+ revisedId: string;
6
+ title: string;
7
+ onCompared?: (documentId: string) => void | Promise<void>;
8
+ }
9
+ /** Word comparison through the host's authenticated transport and LibreOffice service. */
10
+ export declare function NativeDocxComparison({ adapter, baseId, revisedId, title, onCompared, }: NativeDocxComparisonProps): import("react").JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { type DocxMention, type DocxAgentCommentRequest } from './DocxMentions';
2
+ import React from 'react';
3
+ import { type FontConfiguration } from '@docx-editor.dev/react';
4
+ import { type DocumentCollaborationSession } from '@docx-editor.dev/pro/collaboration';
5
+ /** Host integration: no application store, router, or authentication singleton is required. */
6
+ export interface NativeDocxAdapter {
7
+ request: (path: string, options?: RequestInit) => Promise<Response>;
8
+ open: (documentId: string) => Promise<{
9
+ room_id: string;
10
+ token: string;
11
+ websocket_path: string;
12
+ can_edit: boolean;
13
+ identity: {
14
+ actorId: string;
15
+ name: string;
16
+ role: 'human' | 'agent';
17
+ };
18
+ filename: string;
19
+ }>;
20
+ save: (documentId: string, state?: string) => Promise<{
21
+ document_ext_id: string;
22
+ unchanged?: boolean;
23
+ }>;
24
+ loadFonts: () => Promise<FontConfiguration>;
25
+ baseUrl?: string;
26
+ author?: string;
27
+ subscribeTokenChanges?: (listener: () => void) => () => void;
28
+ onDirtyChange?: (dirty: boolean) => void;
29
+ onVersionSaved?: (documentId: string) => void | Promise<void>;
30
+ notify?: (message: string, kind: 'success' | 'error') => void;
31
+ mentions?: readonly DocxMention[];
32
+ requestAgent?: (documentId: string, request: DocxAgentCommentRequest) => Promise<void>;
33
+ }
34
+ export interface NativeDocxEditorProps {
35
+ adapter: NativeDocxAdapter;
36
+ documentId: string;
37
+ title: string;
38
+ draftContent?: string;
39
+ initialCommentId?: string;
40
+ /** Immutable history/compare snapshots must not join the live editing room. */
41
+ snapshot?: boolean;
42
+ onSaved?: (id: string) => void;
43
+ }
44
+ export declare function DocxParticipants({ session }: {
45
+ session?: DocumentCollaborationSession;
46
+ }): React.JSX.Element;
47
+ export declare function DocxRibbon({ onSave }: {
48
+ onSave: () => void;
49
+ }): React.JSX.Element;
50
+ export declare function NativeDocxEditor({ documentId, title, draftContent, initialCommentId, snapshot, onSaved, adapter, }: NativeDocxEditorProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** Repair Word package declarations and duplicate fragment revision IDs on export. */
2
+ export declare function normalizeDocxExport(data: ArrayBuffer): ArrayBuffer;
@@ -0,0 +1,2 @@
1
+ import { type FontConfiguration } from '@docx-editor.dev/react';
2
+ export declare function loadDocxFonts(baseUrl?: string): Promise<FontConfiguration>;
@@ -0,0 +1,116 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkNNH7N62N_cjs = require('../chunk-NNH7N62N.cjs');
5
+ require('../chunk-7UTB4PHM.cjs');
6
+ require('../chunk-MHVNT4J3.cjs');
7
+ var react = require('@docx-editor.dev/react');
8
+ var react$1 = require('@docx-editor.dev/pro/react');
9
+ var hocuspocus = require('@docx-editor.dev/pro/collaboration/hocuspocus');
10
+ var react$2 = require('react');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+
13
+ function NativeDocxComparison({
14
+ adapter,
15
+ baseId,
16
+ revisedId,
17
+ title,
18
+ onCompared
19
+ }) {
20
+ const host = react$2.useRef({ adapter, onCompared });
21
+ host.current = { adapter, onCompared };
22
+ const [documentId, setDocumentId] = react$2.useState("");
23
+ const [error, setError] = react$2.useState("");
24
+ const [attempt, setAttempt] = react$2.useState(0);
25
+ react$2.useEffect(() => {
26
+ let cancelled = false;
27
+ setDocumentId("");
28
+ setError("");
29
+ const query = new URLSearchParams({ base_ext_id: baseId, revised_ext_id: revisedId });
30
+ void host.current.adapter.request(`/redline?${query}`, { method: "POST" }).then((response) => response.json()).then((result) => {
31
+ if (!result.document_ext_id) throw new Error("Comparison did not return a Word document.");
32
+ if (!cancelled) {
33
+ setDocumentId(result.document_ext_id);
34
+ void Promise.resolve(host.current.onCompared?.(result.document_ext_id)).catch(() => {
35
+ });
36
+ }
37
+ }).catch((error2) => {
38
+ if (!cancelled) setError(error2 instanceof Error ? error2.message : String(error2));
39
+ });
40
+ return () => {
41
+ cancelled = true;
42
+ };
43
+ }, [baseId, revisedId, attempt]);
44
+ if (error)
45
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "native-docx-error", role: "alert", children: [
46
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: error }),
47
+ /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setAttempt((value) => value + 1), children: "Retry comparison" })
48
+ ] });
49
+ if (!documentId)
50
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
51
+ return /* @__PURE__ */ jsxRuntime.jsx(
52
+ chunkNNH7N62N_cjs.NativeDocxEditor,
53
+ {
54
+ adapter,
55
+ documentId,
56
+ title: `${title.replace(/\.[^.]+$/, "")} (redline).docx`
57
+ },
58
+ documentId
59
+ );
60
+ }
61
+
62
+ Object.defineProperty(exports, "DocxMentions", {
63
+ enumerable: true,
64
+ get: function () { return chunkNNH7N62N_cjs.DocxMentions; }
65
+ });
66
+ Object.defineProperty(exports, "DocxParticipants", {
67
+ enumerable: true,
68
+ get: function () { return chunkNNH7N62N_cjs.DocxParticipants; }
69
+ });
70
+ Object.defineProperty(exports, "DocxRibbon", {
71
+ enumerable: true,
72
+ get: function () { return chunkNNH7N62N_cjs.DocxRibbon; }
73
+ });
74
+ Object.defineProperty(exports, "NativeDocxEditor", {
75
+ enumerable: true,
76
+ get: function () { return chunkNNH7N62N_cjs.NativeDocxEditor; }
77
+ });
78
+ Object.defineProperty(exports, "loadDocxFonts", {
79
+ enumerable: true,
80
+ get: function () { return chunkNNH7N62N_cjs.loadDocxFonts; }
81
+ });
82
+ Object.defineProperty(exports, "normalizeDocxExport", {
83
+ enumerable: true,
84
+ get: function () { return chunkNNH7N62N_cjs.normalizeDocxExport; }
85
+ });
86
+ Object.defineProperty(exports, "DocxEditor", {
87
+ enumerable: true,
88
+ get: function () { return react.DocxEditor; }
89
+ });
90
+ Object.defineProperty(exports, "useDocxEditor", {
91
+ enumerable: true,
92
+ get: function () { return react.useDocxEditor; }
93
+ });
94
+ Object.defineProperty(exports, "useEditorState", {
95
+ enumerable: true,
96
+ get: function () { return react.useEditorState; }
97
+ });
98
+ Object.defineProperty(exports, "DocxEditorReview", {
99
+ enumerable: true,
100
+ get: function () { return react$1.DocxEditorReview; }
101
+ });
102
+ Object.defineProperty(exports, "useReview", {
103
+ enumerable: true,
104
+ get: function () { return react$1.useReview; }
105
+ });
106
+ Object.defineProperty(exports, "useReviewItem", {
107
+ enumerable: true,
108
+ get: function () { return react$1.useReviewItem; }
109
+ });
110
+ Object.defineProperty(exports, "createHocuspocusCollaboration", {
111
+ enumerable: true,
112
+ get: function () { return hocuspocus.createHocuspocusCollaboration; }
113
+ });
114
+ exports.NativeDocxComparison = NativeDocxComparison;
115
+ //# sourceMappingURL=index.cjs.map
116
+ //# sourceMappingURL=index.cjs.map