@arbidocs/react 0.4.167 → 0.4.169
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/artifacts/index.cjs +15 -12
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.js +6 -3
- package/dist/artifacts/index.js.map +1 -1
- package/dist/calls/livekit/index.cjs +977 -0
- package/dist/calls/livekit/index.cjs.map +1 -0
- package/dist/calls/livekit/index.d.cts +280 -0
- package/dist/calls/livekit/index.d.ts +280 -0
- package/dist/calls/livekit/index.js +961 -0
- package/dist/calls/livekit/index.js.map +1 -0
- package/dist/{chunk-ON4PL6DQ.cjs → chunk-2M4B4FFA.cjs} +48 -4
- package/dist/chunk-2M4B4FFA.cjs.map +1 -0
- package/dist/chunk-3NVSUYUV.js +528 -0
- package/dist/chunk-3NVSUYUV.js.map +1 -0
- package/dist/{chunk-QJHCVQ6C.js → chunk-3WIBD44F.js} +4734 -4673
- package/dist/chunk-3WIBD44F.js.map +1 -0
- package/dist/chunk-5HDC43MF.js +145 -0
- package/dist/chunk-5HDC43MF.js.map +1 -0
- package/dist/{chunk-D66JCVBB.cjs → chunk-7NHOKV7N.cjs} +4093 -4040
- package/dist/chunk-7NHOKV7N.cjs.map +1 -0
- package/dist/chunk-7NY2J3TR.js +986 -0
- package/dist/chunk-7NY2J3TR.js.map +1 -0
- package/dist/chunk-APZZQZ6P.js +147 -0
- package/dist/chunk-APZZQZ6P.js.map +1 -0
- package/dist/{chunk-I5ZBQ63Y.js → chunk-DGMK3EUN.js} +188 -181
- package/dist/chunk-DGMK3EUN.js.map +1 -0
- package/dist/chunk-DPYBZDJB.js +18 -0
- package/dist/chunk-DPYBZDJB.js.map +1 -0
- package/dist/chunk-EEIYXVM4.cjs +181 -0
- package/dist/chunk-EEIYXVM4.cjs.map +1 -0
- package/dist/chunk-GGYCK5A6.cjs +1035 -0
- package/dist/chunk-GGYCK5A6.cjs.map +1 -0
- package/dist/{chunk-JSSKEXRR.js → chunk-KGCGA452.js} +2 -2
- package/dist/chunk-KGCGA452.js.map +1 -0
- package/dist/chunk-N73IMVFF.cjs +21 -0
- package/dist/chunk-N73IMVFF.cjs.map +1 -0
- package/dist/chunk-NVAIVJID.js +298 -0
- package/dist/chunk-NVAIVJID.js.map +1 -0
- package/dist/{chunk-GTJ667CP.cjs → chunk-QQ7SCJRY.cjs} +2 -2
- package/dist/chunk-QQ7SCJRY.cjs.map +1 -0
- package/dist/chunk-S4PCA3ES.cjs +572 -0
- package/dist/chunk-S4PCA3ES.cjs.map +1 -0
- package/dist/chunk-VAMPYLQ4.cjs +157 -0
- package/dist/chunk-VAMPYLQ4.cjs.map +1 -0
- package/dist/chunk-VLK52VXC.cjs +307 -0
- package/dist/chunk-VLK52VXC.cjs.map +1 -0
- package/dist/chunk-VPKFUYGW.cjs +2551 -0
- package/dist/chunk-VPKFUYGW.cjs.map +1 -0
- package/dist/chunk-W6DYNLA2.js +2362 -0
- package/dist/chunk-W6DYNLA2.js.map +1 -0
- package/dist/{chunk-SVHGCX25.js → chunk-YWYCEEBF.js} +43 -4
- package/dist/chunk-YWYCEEBF.js.map +1 -0
- package/dist/{chunk-EUC2BTNS.cjs → chunk-ZI2VJOID.cjs} +206 -199
- package/dist/chunk-ZI2VJOID.cjs.map +1 -0
- package/dist/document-tools/index.cjs +79 -107
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +4 -5
- package/dist/document-tools/index.d.ts +4 -5
- package/dist/document-tools/index.js +23 -68
- package/dist/document-tools/index.js.map +1 -1
- package/dist/index.cjs +12650 -9452
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-DfCFKora.d.cts → index.d-Bvp6rKNo.d.cts} +139 -1
- package/dist/{index.d-DfCFKora.d.ts → index.d-Bvp6rKNo.d.ts} +139 -1
- package/dist/{index.d-DCjYj7YK.d.ts → index.d-Dx9sGkW2.d.cts} +20 -8
- package/dist/{index.d-DCjYj7YK.d.cts → index.d-Dx9sGkW2.d.ts} +20 -8
- package/dist/index.d.cts +5465 -2291
- package/dist/index.d.ts +5465 -2291
- package/dist/index.js +11047 -8858
- package/dist/index.js.map +1 -1
- package/dist/query-keys.d-Kw0JMoff.d.cts +308 -0
- package/dist/query-keys.d-Kw0JMoff.d.ts +308 -0
- package/dist/shell/index.cjs +78 -21
- package/dist/shell/index.d.cts +1 -1
- package/dist/shell/index.d.ts +1 -1
- package/dist/shell/index.js +6 -1
- package/dist/ui/index.cjs +191 -186
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -2
- package/dist/useAudioRecorder.d-CWFDsb_S.d.cts +778 -0
- package/dist/useAudioRecorder.d-CWFDsb_S.d.ts +778 -0
- package/dist/viewers/index.cjs +22 -13
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.js +21 -12
- package/dist/viewers/index.js.map +1 -1
- package/package.json +13 -3
- package/dist/chunk-6MTKKT2O.cjs +0 -999
- package/dist/chunk-6MTKKT2O.cjs.map +0 -1
- package/dist/chunk-CEZCFQ47.js +0 -932
- package/dist/chunk-CEZCFQ47.js.map +0 -1
- package/dist/chunk-D66JCVBB.cjs.map +0 -1
- package/dist/chunk-EUC2BTNS.cjs.map +0 -1
- package/dist/chunk-GTJ667CP.cjs.map +0 -1
- package/dist/chunk-I5ZBQ63Y.js.map +0 -1
- package/dist/chunk-JSSKEXRR.js.map +0 -1
- package/dist/chunk-ON4PL6DQ.cjs.map +0 -1
- package/dist/chunk-QJHCVQ6C.js.map +0 -1
- package/dist/chunk-SVHGCX25.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search/session.ts","../src/notifications/Toaster.tsx","../src/lib/format-relative-time.ts","../src/notifications/NotificationBell.tsx","../src/host/ArbiHost.tsx","../src/chat/mentions.ts","../src/chat/open-document.ts"],"names":["createStore","jsx","Sonner","CheckCircle2","XCircle","AlertTriangle","Info","useState","useNotify","selectUnread","DEFAULT_NOTIFY_TONE","jsxs","DropdownMenu","DropdownMenuTrigger","Bell","DropdownMenuContent","CheckCheck","cn","BellOff","DropdownMenuItem","X","ScrollArea","useContext","ArbiHostContext","useMemo","mergeHostConfig","OWN_SESSION_SLOT","useRef","useEffect","useSyncExternalStore","parseVersionRef"],"mappings":";;;;;;;;;;;;;;;AA8BA,IAAM,KAAA,GAAyD;AAAA,EAC7D,KAAA,EAAO,EAAA;AAAA,EACP,SAAS,EAAC;AAAA,EACV,QAAA,EAAU,KAAA;AAAA,EACV,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,IAAA;AAAA,EACP,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,mBAAA,GAAqC;AACnD,EAAA,OAAOA,mBAAA,CAAgC,OAAO,EAAE,GAAG,OAAO,WAAA,EAAa,IAAA,EAAM,GAAA,EAAK,CAAA,EAAE,CAAE,CAAA;AACxF;AAGO,IAAM,sBAAqC,mBAAA;AAG3C,SAAS,kBAAA,CACd,WAAA,EACA,OAAA,GAAyB,mBAAA,EACnB;AACN,EAAA,OAAA,CAAQ,QAAA,CAAS,CAAC,CAAA,MAAO;AAAA,IACvB,GAAG,KAAA;AAAA,IACH,WAAA,EAAa,WAAA,KAAgB,MAAA,GAAY,CAAA,CAAE,WAAA,GAAc,WAAA;AAAA,IACzD,GAAA,EAAK,EAAE,GAAA,GAAM;AAAA,GACf,CAAE,CAAA;AACJ;AAMO,SAAS,aAAA,CACd,KAAA,EACA,WAAA,EACA,OAAA,GAAyB,mBAAA,EACnB;AACN,EAAA,kBAAA,CAAmB,aAAa,OAAO,CAAA;AACvC,EAAA,OAAA,CAAQ,QAAA,CAAS,EAAE,KAAA,EAAO,OAAA,EAAS,OAAO,CAAA;AAC5C;AAGO,SAAS,iBAAA,CAAkB,UAAyB,mBAAA,EAAoC;AAC7F,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,OAAA,CAAQ,QAAA,EAAS;AACrC,EAAA,IAAI,YAA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AACnB,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,WAAA,EAAY,GAAI,MAAM,OAAA,EAAQ;AACzD,EAAA,IAAI,SAAS,WAAA,IAAe,WAAA,IAAe,OAAA,CAAQ,WAAA,KAAgB,aAAa,OAAO,IAAA;AACvF,EAAA,IACE,OAAA,IACA,YAAY,KAAA,CAAM,UAAA,IAClBC,kCAAgB,OAAO,CAAA,CAAE,UAAU,KAAA,CAAM,UAAA;AAEzC,IAAA,QAAA,IAAW;AACb,EAAA,OAAO,KAAA,CAAM,UAAA;AACf","file":"chunk-ZI2VJOID.cjs","sourcesContent":["/**\n * A search's state outside any component: the query last searched, its passages, and whether it\n * is running. A page that shows the shared session (`sharedSearchSession`) keeps its results when\n * it is left and opened again, another surface can hand it a query to run on arrival\n * ({@link requestSearch}), and {@link persistSearchSession} keeps the last query across reloads.\n */\nimport { createStore, type StoreApi } from 'zustand/vanilla'\nimport type { SearchChunk } from '@arbidocs/sdk/browser'\n\nexport type SearchStatus = 'idle' | 'running' | 'done' | 'error'\n\nexport interface SearchSessionState {\n /** The workspace the query and results belong to. */\n workspaceId: string | null\n /** The query last searched, or handed over to run. */\n query: string\n /** The last search's passages, best first. */\n results: SearchChunk[]\n /** A search has finished with results to show (cleared by {@link clearSearchSession}). */\n searched: boolean\n status: SearchStatus\n error: string | null\n /** A query handed over by {@link requestSearch}, run once by the page that shows the session. */\n pending: string | null\n /** Counts searches, so the reply to an older one never overwrites a newer one. */\n run: number\n}\n\nexport type SearchSession = StoreApi<SearchSessionState>\n\nconst EMPTY: Omit<SearchSessionState, 'workspaceId' | 'run'> = {\n query: '',\n results: [],\n searched: false,\n status: 'idle',\n error: null,\n pending: null,\n}\n\nexport function createSearchSession(): SearchSession {\n return createStore<SearchSessionState>(() => ({ ...EMPTY, workspaceId: null, run: 0 }))\n}\n\n/** The session a host's search page shows. */\nexport const sharedSearchSession: SearchSession = createSearchSession()\n\n/** Back to nothing searched (in `workspaceId` when given); a running search's reply is dropped. */\nexport function clearSearchSession(\n workspaceId?: string | null,\n session: SearchSession = sharedSearchSession\n): void {\n session.setState((s) => ({\n ...EMPTY,\n workspaceId: workspaceId === undefined ? s.workspaceId : workspaceId,\n run: s.run + 1,\n }))\n}\n\n/**\n * Hand a query to the search page, which runs it when it shows the session (the user already\n * asked once; the page must not wait for a second Enter).\n */\nexport function requestSearch(\n query: string,\n workspaceId: string | null,\n session: SearchSession = sharedSearchSession\n): void {\n clearSearchSession(workspaceId, session)\n session.setState({ query, pending: query })\n}\n\n/** The handed-over query, once: the next call returns null. */\nexport function takePendingSearch(session: SearchSession = sharedSearchSession): string | null {\n const { pending } = session.getState()\n if (pending !== null) session.setState({ pending: null })\n return pending\n}\n\ninterface SavedSearch {\n query?: string\n workspaceId?: string | null\n}\n\n/**\n * Keep the last query (and its workspace) in `storage` under `key`, so the search box shows it\n * after a reload. Results are not kept. Returns the unsubscribe.\n */\nexport function persistSearchSession(\n key: string,\n storage: Pick<Storage, 'getItem' | 'setItem'> | undefined = globalThis.localStorage,\n session: SearchSession = sharedSearchSession\n): () => void {\n if (!storage) return () => {}\n try {\n const saved = JSON.parse(storage.getItem(key) ?? 'null') as SavedSearch | null\n if (saved && typeof saved.query === 'string' && !session.getState().query)\n session.setState({ query: saved.query, workspaceId: saved.workspaceId ?? null })\n } catch {\n // Unreadable: start empty.\n }\n let last = ''\n return session.subscribe(({ query, workspaceId }) => {\n const next = JSON.stringify({ query, workspaceId })\n if (next === last) return\n last = next\n try {\n storage.setItem(key, next)\n } catch {\n // Storage full or blocked: the query is simply not kept.\n }\n })\n}\n","/**\n * Toaster — the one shared toast surface, built on sonner (the mature engine:\n * stacking, swipe-to-dismiss, a11y, timing). Mount once near the app root; any\n * code then calls `notify.*(...)` (or the re-exported `toast`) from anywhere.\n *\n * Firm-agnostic: every sonner `ToasterProps` passes through, so a consumer sets\n * its own `position` / `theme` / `toastOptions`. The defaults give a neutral\n * shadcn-token card that both apps can override.\n */\nimport { Toaster as Sonner, type ToasterProps } from 'sonner'\n\nexport type { ToasterProps }\n\nconst DEFAULT_TOAST_OPTIONS: ToasterProps['toastOptions'] = {\n classNames: {\n toast:\n 'group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg',\n description: 'group-[.toast]:text-muted-foreground',\n actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',\n cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',\n },\n}\n\nexport function Toaster({ toastOptions, ...props }: ToasterProps) {\n return (\n <Sonner\n className=\"toaster group\"\n toastOptions={toastOptions ?? DEFAULT_TOAST_OPTIONS}\n {...props}\n />\n )\n}\n","/** Relative-time formatting shared by the notification bell, the DM kit and the app's thread lists\n * (no type imports, so the SDK-free `/shell` entry can use it). */\n\nconst FORMATTERS = new Map<Intl.RelativeTimeFormatStyle, Intl.RelativeTimeFormat>()\nconst DIVISIONS: Array<{ amount: number; unit: Intl.RelativeTimeFormatUnit }> = [\n { amount: 60, unit: 'seconds' },\n { amount: 60, unit: 'minutes' },\n { amount: 24, unit: 'hours' },\n { amount: 7, unit: 'days' },\n { amount: 4.34524, unit: 'weeks' },\n { amount: 12, unit: 'months' },\n { amount: Number.POSITIVE_INFINITY, unit: 'years' },\n]\n\nfunction formatter(style: Intl.RelativeTimeFormatStyle): Intl.RelativeTimeFormat {\n let f = FORMATTERS.get(style)\n if (!f) {\n f = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto', style })\n FORMATTERS.set(style, f)\n }\n return f\n}\n\nexport interface FormatRelativeTimeOptions {\n /** The reference instant in epoch milliseconds (default: now). */\n now?: number\n /** `long` (default): \"2 hours ago\"; `short`: \"2 hr. ago\", for tight rows. */\n style?: Intl.RelativeTimeFormatStyle\n}\n\n/** Relative time of an ISO timestamp, past or future: \"2 hours ago\", \"in 3 days\", \"just now\".\n * Empty for an unparseable timestamp. */\nexport function formatRelativeTime(iso: string, options: FormatRelativeTimeOptions = {}): string {\n const then = Date.parse(iso)\n if (Number.isNaN(then)) return ''\n let duration = (then - (options.now ?? Date.now())) / 1000\n if (Math.abs(duration) < 45) return 'just now'\n for (const division of DIVISIONS) {\n if (Math.abs(duration) < division.amount) {\n return formatter(options.style ?? 'long').format(Math.round(duration), division.unit)\n }\n duration /= division.amount\n }\n return ''\n}\n","/**\n * NotificationBell — the topbar notification centre: a bell with an unread badge\n * that opens a dropdown of recorded entries (newest first) with an unread dot,\n * relative time and optional deep-link. \"Mark all read\" clears the badge. Backed\n * by the shared {@link useNotify} store (the same one the <Toaster/> renders).\n *\n * Firm-agnostic: navigation is a callback (`onNavigate`), styling tracks semantic\n * tokens, and per-variant glyph colours are overridable via `toneClassNames`.\n */\nimport { useState, type ReactElement } from 'react'\nimport {\n Bell,\n BellOff,\n CheckCheck,\n CheckCircle2,\n AlertTriangle,\n XCircle,\n Info,\n X,\n} from 'lucide-react'\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n} from '../ui/dropdown-menu'\nimport { ScrollArea } from '../ui/scroll-area'\nimport { cn } from '../lib/utils'\nimport { formatRelativeTime } from '../lib/format-relative-time'\nimport {\n useNotify,\n selectUnread,\n DEFAULT_NOTIFY_TONE,\n type NotifyVariant,\n type AppNotification,\n} from './notify-store'\n\nconst GLYPH: Record<NotifyVariant, typeof Info> = {\n success: CheckCircle2,\n error: XCircle,\n warning: AlertTriangle,\n info: Info,\n}\n\n/** Entries the panel lists, newest first. */\nconst BELL_LIMIT = 100\n\n/** What a custom bell trigger needs to render itself. */\nexport interface NotificationBellTriggerState {\n /** Unread count (0 when none). */\n unread: number\n /** Accessible name, including the count: \"Notifications, 2 unread\". */\n ariaLabel: string\n testId: string\n}\n\nexport interface NotificationBellProps {\n /**\n * Replaces the default icon button with the host's own trigger (for example a labelled sidebar\n * row). It must forward its ref and rest props: it is mounted as the dropdown trigger.\n */\n renderTrigger?: (state: NotificationBellTriggerState) => ReactElement\n /** Called with an entry's `href` when it's clicked (e.g. router navigate). */\n onNavigate?: (href: string) => void\n /** Open this entry in the host notification centre instead of following its link. */\n onSelectNotification?: (notification: AppNotification) => void\n /** Called after an entry is locally marked read — the hook for a backend\n * bridge to propagate read state upstream (filter by the ids it owns). */\n onMarkRead?: (id: string) => void\n /** Called after \"Mark all read\" — same upstream-propagation hook. */\n onMarkAllRead?: () => void\n /** Show the store's toast mute switch in the header — the bell is where notification\n * behaviour is controlled. */\n showMuteToggle?: boolean\n /** Override per-variant glyph colours (e.g. brand emerald for success). */\n toneClassNames?: Partial<Record<NotifyVariant, string>>\n emptyText?: string\n /** Footer link to the app's full notification surface. Omit to hide. */\n onViewAll?: () => void\n viewAllLabel?: string\n testId?: string\n /** Where the panel opens relative to the bell (a sidebar-footer bell opens upward). */\n side?: 'top' | 'right' | 'bottom' | 'left'\n align?: 'start' | 'center' | 'end'\n}\n\nexport function NotificationBell({\n renderTrigger,\n onNavigate,\n onSelectNotification,\n onMarkRead,\n onMarkAllRead,\n showMuteToggle = false,\n toneClassNames,\n emptyText = \"You're all caught up.\",\n onViewAll,\n viewAllLabel = 'View all',\n testId = 'notifications',\n side = 'bottom',\n align = 'end',\n}: NotificationBellProps) {\n const [open, setOpen] = useState(false)\n const notifications = useNotify((s) => s.notifications)\n const unread = useNotify(selectUnread)\n const markAllRead = useNotify((s) => s.markAllRead)\n const markRead = useNotify((s) => s.markRead)\n const muted = useNotify((s) => s.muted)\n const setMuted = useNotify((s) => s.setMuted)\n const tone = (v: NotifyVariant) => toneClassNames?.[v] ?? DEFAULT_NOTIFY_TONE[v]\n\n // Ambient entries (routine session activity — \"Opening workspace…\") are kept\n // for the log but never surfaced in the bell panel: they never badge and are\n // always filtered out here. The panel is the recent history; a host's\n // notification page (`onViewAll`) holds the rest.\n const visible = notifications.filter((n) => !n.ambient).slice(0, BELL_LIMIT)\n\n return (\n <DropdownMenu open={open} onOpenChange={setOpen}>\n <DropdownMenuTrigger asChild>\n {renderTrigger ? (\n renderTrigger({\n unread,\n ariaLabel: `Notifications${unread ? `, ${unread} unread` : ''}`,\n testId,\n })\n ) : (\n <button\n className=\"relative flex size-9 pointer-coarse:size-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n data-testid={testId}\n aria-label={`Notifications${unread ? `, ${unread} unread` : ''}`}\n title=\"Notifications\"\n >\n <Bell className=\"size-5\" />\n {unread > 0 && (\n <span\n className=\"absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-semibold leading-4 text-primary-foreground\"\n data-testid={`${testId}-badge`}\n >\n {unread > 9 ? '9+' : unread}\n </span>\n )}\n </button>\n )}\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align={align}\n side={side}\n sideOffset={8}\n collisionPadding={12}\n className=\"w-60 rounded-lg border-border/60 p-0 shadow-lg\"\n data-testid={`${testId}-panel`}\n data-topbar-popover=\"\"\n >\n <div className=\"flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5 pointer-coarse:py-0\">\n <p className=\"text-sm font-semibold text-foreground\">Notifications</p>\n <div className=\"flex items-center gap-3 pointer-coarse:gap-1\">\n {unread > 0 && (\n <button\n onClick={() => {\n markAllRead()\n onMarkAllRead?.()\n }}\n className=\"flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80 pointer-coarse:min-h-11 pointer-coarse:px-2\"\n data-testid={`${testId}-mark-all`}\n >\n <CheckCheck className=\"size-3.5\" /> Mark all read\n </button>\n )}\n {showMuteToggle && (\n <button\n onClick={() => setMuted(!muted)}\n aria-pressed={muted}\n title={muted ? 'Unmute notifications' : 'Mute notifications'}\n aria-label={muted ? 'Unmute notifications' : 'Mute notifications'}\n className={cn(\n 'flex size-6 items-center justify-center rounded-md transition-colors hover:bg-accent pointer-coarse:size-11',\n muted ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'\n )}\n data-testid={`${testId}-mute`}\n >\n <BellOff className=\"size-3.5\" />\n </button>\n )}\n {/* Explicit close — the dropdown otherwise only dismisses via\n tap-outside/Escape, which isn't discoverable on touch and (at\n mobile width, see blocks.css) the panel covers most\n of the screen so there's nothing to tap outside of. Radix\n closes a DropdownMenu on any item select by default, so a\n plain item with no other effect doubles as a close button. */}\n <DropdownMenuItem\n className=\"flex size-6 items-center justify-center rounded-md p-0 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:bg-accent pointer-coarse:size-11\"\n aria-label=\"Close notifications\"\n data-testid={`${testId}-close`}\n >\n <X className=\"size-3.5\" />\n </DropdownMenuItem>\n </div>\n </div>\n {muted && (\n <p\n className=\"border-b border-border/60 bg-amber-500/10 px-3.5 py-1.5 text-xs text-muted-foreground\"\n data-testid={`${testId}-muted-note`}\n >\n Toasts are muted — everything still lands here.\n </p>\n )}\n\n {visible.length === 0 ? (\n <div className=\"px-3.5 py-10 text-center text-sm text-muted-foreground\">{emptyText}</div>\n ) : (\n <ScrollArea className=\"max-h-[380px]\">\n <ul data-testid={`${testId}-list`}>\n {visible.map((n) => {\n const Glyph = GLYPH[n.variant]\n return (\n <li key={n.id}>\n <button\n onClick={() => {\n markRead(n.id)\n if (!n.read) onMarkRead?.(n.id)\n setOpen(false)\n if (onSelectNotification) {\n onSelectNotification(n)\n return\n }\n // The specific action wins over the generic deep link.\n if (n.onSelect) n.onSelect()\n else if (n.href) onNavigate?.(n.href)\n }}\n className={cn(\n 'flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent',\n !n.read && 'bg-accent/40'\n )}\n data-testid={`${testId}-item`}\n data-notification-id={n.id}\n >\n <Glyph className={cn('mt-0.5 size-4 shrink-0', tone(n.variant))} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium leading-snug text-foreground\">\n {n.title}\n </p>\n {n.description && (\n <p className=\"mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground\">\n {n.description}\n </p>\n )}\n <p className=\"mt-1 text-xs text-muted-foreground/80\">\n {formatRelativeTime(new Date(n.ts).toISOString())}\n </p>\n </div>\n {!n.read && (\n <span className=\"mt-1.5 size-2 shrink-0 rounded-full bg-primary\" />\n )}\n </button>\n </li>\n )\n })}\n </ul>\n </ScrollArea>\n )}\n {onViewAll && (\n // A real menu item, not a bare button: selecting it must CLOSE the\n // dropdown on its way to the full surface.\n <DropdownMenuItem\n onClick={onViewAll}\n className=\"justify-center rounded-none border-t border-border px-3.5 py-2.5 text-xs font-medium text-primary focus:text-primary pointer-coarse:min-h-11\"\n data-testid={`${testId}-view-all`}\n >\n {viewAllLabel}\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","/**\n * `<ArbiHost config>`: the one place a host app hands its configuration to every hook and kit.\n *\n * <ArbiHost config={{ arbi, session, documents, calendar, mail, account, … }}>\n * <App />\n * </ArbiHost>\n *\n * Every field is optional and has a default (see `ArbiHostConfig`); a kit reads its domain from\n * the config (`useArbiHost().documents`, `useHost().billing` in blocks). A nested `<ArbiHost>`\n * overrides only the fields it gives and inherits the rest (`environment` field by field), for a\n * subtree that opens projects in its own tabs, say. There is no other host provider: a new domain\n * is a new optional field, never a new provider.\n *\n * SDK-free (this module, ./context and ./merge are all it reaches), so a marketing site that only sets the\n * blocks environment does not bundle the SDK.\n */\n\nimport { useContext, useMemo, useState, type ComponentType, type ReactNode } from 'react'\nimport { ArbiHostContext } from './context'\nimport { mergeHostConfig, OWN_SESSION_SLOT } from './merge'\n\n/** A sign-in layer mounted inside the host (`defaultHost` in `@arbidocs/blocks/connect`). */\nexport interface ArbiHostConnection {\n Provider: ComponentType<{ children: ReactNode }>\n}\n\nexport interface ArbiHostProps<Config extends object> {\n config: Config\n children?: ReactNode\n}\n\n/**\n * Provide the host configuration. Typed by the package it is imported from: `@arbidocs/react`'s\n * takes the react domains, `@arbidocs/blocks`' the blocks domains as well.\n */\nexport function ArbiHost<Config extends object>({\n config,\n children,\n}: ArbiHostProps<Config>): React.ReactElement {\n const parent = useContext(ArbiHostContext)\n // A top-level host without a session store gets its own, made on first use (useArbiSessionStore).\n const [ownSession] = useState(() => ({ current: null as unknown }))\n const value = useMemo(() => {\n const merged = mergeHostConfig(parent, config)\n return merged[OWN_SESSION_SLOT] ? merged : { ...merged, [OWN_SESSION_SLOT]: ownSession }\n }, [parent, config, ownSession])\n const Connection = (config as { connection?: ArbiHostConnection }).connection?.Provider\n return (\n <ArbiHostContext.Provider value={value}>\n {Connection ? <Connection>{children}</Connection> : children}\n </ArbiHostContext.Provider>\n )\n}\n","/**\n * @mentions in chat text: pure helpers shared by the composer (autocomplete, extraction) and\n * the message renderer (chips). No React, no SDK.\n *\n * A mention lives in two places: the readable `@Label` text in the message content, and a\n * structured entry on the message (`{ type, user_ext_id, label }`) that the server reads to share\n * the conversation and notify. The composer only ever inserts `@<label>` for a known candidate,\n * so the structured list can be recovered from the text at send time ({@link extractMentions});\n * the renderer turns each stored mention back into a chip ({@link linkMentions}).\n */\n\n/** Who can be mentioned: a workspace member, or the assistant. */\nexport type MentionKind = 'user' | 'assistant'\n\n/** One entry of the mention autocomplete. */\nexport interface MentionCandidate {\n /** User external id (`usr-…`) for a person; any stable key (e.g. `assistant`) for the assistant. */\n id: string\n kind: MentionKind\n /** Inserted as `@<label>`. For people this must be the server's display name (given + family). */\n label: string\n /** Secondary line in the menu (email, role, …). */\n description?: string\n}\n\n/** The structured mention a message carries (the API's `MessageMention`). */\nexport interface MessageMentionRef {\n type: MentionKind\n user_ext_id?: string | null\n label?: string | null\n}\n\n/** Longest text after `@` that still counts as a query in progress. */\nconst MAX_QUERY_LENGTH = 40\n\n/**\n * The `@query` the caret is in, if any: the `@` must start the text or follow whitespace, and the\n * query may contain spaces (names do) but no newline. Returns the index of the `@` and the query.\n */\nexport function findMentionQuery(\n text: string,\n caret: number\n): { start: number; query: string } | null {\n const before = text.slice(0, caret)\n const at = before.lastIndexOf('@')\n if (at < 0) return null\n if (at > 0 && !/\\s/.test(before[at - 1])) return null\n const query = before.slice(at + 1)\n if (query.length > MAX_QUERY_LENGTH || query.includes('\\n') || query.startsWith(' ')) return null\n return { start: at, query }\n}\n\n/** Candidates matching a query: label prefix (or word-prefix) matches, prefix matches first. */\nexport function filterMentionCandidates(\n candidates: ReadonlyArray<MentionCandidate>,\n query: string\n): MentionCandidate[] {\n const q = query.trim().toLowerCase()\n if (!q) return candidates.slice()\n const scored: Array<{ c: MentionCandidate; score: number }> = []\n for (const c of candidates) {\n const label = c.label.toLowerCase()\n if (label.startsWith(q)) scored.push({ c, score: 0 })\n else if (label.split(/\\s+/).some((word) => word.startsWith(q))) scored.push({ c, score: 1 })\n else if (c.description?.toLowerCase().startsWith(q)) scored.push({ c, score: 2 })\n }\n return scored.sort((a, b) => a.score - b.score).map((s) => s.c)\n}\n\n/** Replace the `@query` at `start…caret` with `@<label> `; returns the new text and caret. */\nexport function insertMention(\n text: string,\n start: number,\n caret: number,\n label: string\n): { text: string; caret: number } {\n const inserted = `@${label} `\n return {\n text: text.slice(0, start) + inserted + text.slice(caret),\n caret: start + inserted.length,\n }\n}\n\n/** Every `[from, to)` range where `@<label>` occurs as a whole token. */\nfunction tokenRanges(text: string, label: string): Array<[number, number]> {\n const needle = `@${label}`\n const ranges: Array<[number, number]> = []\n let from = 0\n for (;;) {\n const i = text.indexOf(needle, from)\n if (i < 0) break\n const end = i + needle.length\n const startsToken = i === 0 || /\\s|\\(|\\[/.test(text[i - 1])\n const endsToken = end === text.length || !/[\\p{L}\\p{N}_]/u.test(text[end])\n if (startsToken && endsToken) ranges.push([i, end])\n from = end\n }\n return ranges\n}\n\n/**\n * The candidates mentioned in `text`, in order of first appearance. Longer labels win overlaps,\n * so `@Bob Smith` is Bob Smith, not a separate `@Bob`.\n */\nexport function extractMentions(\n text: string,\n candidates: ReadonlyArray<MentionCandidate>\n): MentionCandidate[] {\n const taken: Array<[number, number]> = []\n const found: Array<{ c: MentionCandidate; at: number }> = []\n const byLength = [...candidates].sort((a, b) => b.label.length - a.label.length)\n for (const c of byLength) {\n if (!c.label) continue\n for (const [from, to] of tokenRanges(text, c.label)) {\n if (taken.some(([a, b]) => from < b && to > a)) continue\n taken.push([from, to])\n if (!found.some((f) => f.c.id === c.id)) found.push({ c, at: from })\n }\n }\n return found.sort((a, b) => a.at - b.at).map((f) => f.c)\n}\n\n/** The API payload for mentioned candidates. */\nexport function toMessageMentions(mentioned: ReadonlyArray<MentionCandidate>): MessageMentionRef[] {\n return mentioned.map((c) =>\n c.kind === 'assistant' ? { type: 'assistant' } : { type: 'user', user_ext_id: c.id }\n )\n}\n\n/** Fragment prefix of the links {@link linkMentions} writes. */\nexport const MENTION_HREF_PREFIX = '#mention-'\n\n/** Escape the characters that would end a markdown link text early. */\nfunction escapeLinkText(label: string): string {\n return label.replace(/[[\\]\\\\]/g, (ch) => `\\\\${ch}`)\n}\n\n/**\n * Turn each stored mention's `@<label>` in `content` into a markdown link\n * `[@<label>](#mention-<id>)`, so a markdown renderer can draw it as a chip (see\n * {@link mentionFromHref}). Text that no longer matches (a renamed user) stays plain text.\n * `assistantLabels` lists other names the assistant may have been mentioned by.\n */\nexport function linkMentions(\n content: string,\n mentions: ReadonlyArray<MessageMentionRef> | null | undefined,\n assistantLabels: ReadonlyArray<string> = []\n): string {\n if (!mentions || mentions.length === 0 || !content) return content\n const targets: Array<{ label: string; id: string }> = []\n for (const m of mentions) {\n const id = m.type === 'assistant' ? 'assistant' : m.user_ext_id\n if (!id) continue\n const labels = m.type === 'assistant' ? [m.label ?? '', ...assistantLabels] : [m.label ?? '']\n for (const label of labels) if (label) targets.push({ label, id })\n }\n targets.sort((a, b) => b.label.length - a.label.length)\n const replacements: Array<{ from: number; to: number; text: string }> = []\n for (const { label, id } of targets) {\n for (const [from, to] of tokenRanges(content, label)) {\n if (replacements.some((r) => from < r.to && to > r.from)) continue\n replacements.push({\n from,\n to,\n text: `[@${escapeLinkText(label)}](${MENTION_HREF_PREFIX}${id})`,\n })\n }\n }\n replacements.sort((a, b) => b.from - a.from)\n let out = content\n for (const r of replacements) out = out.slice(0, r.from) + r.text + out.slice(r.to)\n return out\n}\n\n/** The mention a `#mention-…` href points at, or null for any other href. */\nexport function mentionFromHref(\n href: string | null | undefined\n): { kind: MentionKind; id: string } | null {\n if (!href?.startsWith(MENTION_HREF_PREFIX)) return null\n const id = href.slice(MENTION_HREF_PREFIX.length)\n if (!id) return null\n return { kind: id === 'assistant' ? 'assistant' : 'user', id }\n}\n\n/** A recipient alone is not a message. */\nexport function hasMessageBody(value: string, recipientLabel = 'ARBI'): boolean {\n const text = value.trim()\n return !!text && text.toLowerCase() !== `@${recipientLabel}`.toLowerCase()\n}\n","import { useEffect, useRef, useSyncExternalStore } from 'react'\nimport { parseVersionRef } from '../artifacts/versions'\n\n/**\n * Drafting mode: the saved document open beside the chat is what a chat turn is about.\n *\n * A viewer registers the document it shows (`useRegisterOpenDocument`); every assistant turn names\n * it (`active_artifact_ext_id`, read with `takeOpenDocumentForTurn` as the question is sent), so the\n * server binds the live document to the turn: a Word document is read on demand and edited as\n * tracked changes in the open editor, and what the assistant saves becomes a child version of it.\n * The request carries a reference, never the content.\n *\n * The open document is always the subject, also while one of its earlier versions is on screen\n * read-only: a version still names its document. Sending a turn then returns the viewer to the live\n * document (`showLive`), where the assistant's edits appear as they are made. (Pinning a specific\n * version as a source is a separate feature: it does not go through here.)\n *\n * A module-level registry (not React context), like `useChatSurface`, so a viewer and a chat agree\n * wherever they sit in the tree; the most recently opened document wins and closing it hands back\n * to the one before. It is not the session state's viewing document (`useArbiSessionState`): it\n * holds what mounted viewers can draft in (saved documents only, with the callback that shows the\n * live one again), and a turn reads it outside React. A viewer on the session's viewing document\n * passes that as `shownId` (it may be a version reference, resolved here the same way as\n * `selectViewingDocumentId` does).\n */\n\n/** What a viewer knows about the document it shows. */\nexport interface SavedDocumentInput {\n /** The document (`doc-…`), never a version reference. */\n documentId: string | null | undefined\n /** An unsaved draft (client-minted id, no backend record). */\n isDraft: boolean\n /** Still streaming: nothing is persisted yet. */\n isStreaming: boolean\n /** An image, audio or video artifact: there is no text to draft in. */\n isBlobArtifact: boolean\n /** The loaded document record. */\n documentData:\n | { external_id?: string | null; wp_type?: string | null; file_name?: string | null }\n | null\n | undefined\n}\n\n/**\n * The saved, content-backed document a chat can draft in, or null. Only a saved artifact or Word\n * document counts: drafts, an artifact still streaming and blob artifacts do not.\n */\nexport function savedDocumentIdFor(input: SavedDocumentInput): string | null {\n const { documentId, isDraft, isStreaming, isBlobArtifact, documentData } = input\n if (!documentId || isDraft || isStreaming || isBlobArtifact) return null\n if (\n documentData?.wp_type !== 'artifact' &&\n !documentData?.file_name?.toLowerCase().endsWith('.docx')\n )\n return null\n // A stale record of the previously viewed document is not this one.\n if (documentData.external_id !== documentId) return null\n return documentId\n}\n\nexport interface OpenDocumentRegistration {\n /** The saved document the viewer shows (`doc-…`); null or empty registers nothing. */\n documentId: string | null | undefined\n /** What is on screen: the document itself, or one of its earlier versions (`doc-…@v2`). */\n shownId?: string | null\n /** Show the live document again. Called when a turn starts while an earlier version is shown. */\n showLive?: () => void\n /** The workspace the document belongs to; a chat in another workspace does not draft in it. */\n workspaceId?: string | null\n}\n\ninterface Entry {\n documentId: string\n current: () => OpenDocumentRegistration\n}\n\nlet entries: Entry[] = []\nconst listeners = new Set<() => void>()\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n\nfunction emit() {\n listeners.forEach((l) => l())\n}\n\nconst top = (): Entry | undefined => entries[entries.length - 1]\n\n/**\n * Registers the document a viewer shows as the open document while the caller is mounted and\n * `documentId` is set. Pass `savedDocumentIdFor(...)`, or the id of a document known to be saved.\n */\nexport function useRegisterOpenDocument(registration: OpenDocumentRegistration): void {\n const latest = useRef(registration)\n useEffect(() => {\n latest.current = registration\n })\n const { documentId } = registration\n useEffect(() => {\n if (!documentId) return\n const entry: Entry = { documentId, current: () => latest.current }\n entries = [...entries, entry]\n emit()\n return () => {\n entries = entries.filter((e) => e !== entry)\n emit()\n }\n }, [documentId])\n}\n\n/** The open document's id, or null. Re-renders when another document opens or it closes. */\nexport function useOpenDocumentId(): string | null {\n return useSyncExternalStore(\n subscribe,\n () => top()?.documentId ?? null,\n () => null\n )\n}\n\n/**\n * The document an assistant turn about to be sent drafts in, or null. Call it once per turn as the\n * question is sent: when an earlier version of the document is on screen, the viewer returns to the\n * live document, where the assistant's edits appear. With `workspaceId`, a document registered in\n * another workspace is not named (and its viewer is left alone).\n */\nexport function takeOpenDocumentForTurn(options?: { workspaceId?: string | null }): string | null {\n const entry = top()\n if (!entry) return null\n const { shownId, showLive, workspaceId } = entry.current()\n if (options?.workspaceId && workspaceId && options.workspaceId !== workspaceId) return null\n if (\n shownId &&\n shownId !== entry.documentId &&\n parseVersionRef(shownId).docId === entry.documentId\n )\n showLive?.()\n return entry.documentId\n}\n"]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2M4B4FFA_cjs = require('../chunk-2M4B4FFA.cjs');
|
|
4
4
|
var chunkRDF2Q45F_cjs = require('../chunk-RDF2Q45F.cjs');
|
|
5
5
|
var chunkLRBOMQ6Q_cjs = require('../chunk-LRBOMQ6Q.cjs');
|
|
6
|
+
var chunkVLK52VXC_cjs = require('../chunk-VLK52VXC.cjs');
|
|
6
7
|
var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
|
|
7
8
|
require('../chunk-VOFNX4P6.cjs');
|
|
8
9
|
require('../chunk-WYZJLZ67.cjs');
|
|
9
|
-
require('../chunk-Z3LLUO32.cjs');
|
|
10
10
|
require('../chunk-HJDR5HEO.cjs');
|
|
11
|
+
require('../chunk-Z3LLUO32.cjs');
|
|
11
12
|
require('../chunk-S6A6FSG7.cjs');
|
|
12
|
-
require('../chunk-
|
|
13
|
+
require('../chunk-QQ7SCJRY.cjs');
|
|
13
14
|
require('../chunk-RCKA7BEF.cjs');
|
|
14
15
|
var react = require('react');
|
|
15
16
|
var reactQuery = require('@tanstack/react-query');
|
|
16
17
|
var client = require('@arbidocs/client');
|
|
18
|
+
var browser = require('@arbidocs/sdk/browser');
|
|
17
19
|
|
|
18
20
|
// src/document-tools/production.ts
|
|
19
21
|
var PRODUCTIONS_FOLDER = "Productions";
|
|
@@ -40,9 +42,9 @@ async function fetchProductionPdf(client, doc) {
|
|
|
40
42
|
const pdf = isPdfDocument(doc);
|
|
41
43
|
let blob;
|
|
42
44
|
try {
|
|
43
|
-
blob = await (pdf ?
|
|
45
|
+
blob = await (pdf ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(client, doc.external_id);
|
|
44
46
|
} catch (e) {
|
|
45
|
-
if (!pdf && e instanceof
|
|
47
|
+
if (!pdf && e instanceof chunk2M4B4FFA_cjs.DocumentFetchError) return null;
|
|
46
48
|
throw e;
|
|
47
49
|
}
|
|
48
50
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
@@ -345,48 +347,9 @@ async function copyOpenThreads(documentId, fromVersion, client) {
|
|
|
345
347
|
function versionsWithMarkup(versions) {
|
|
346
348
|
return (versions ?? []).filter((v) => (v.markup_count ?? 0) > 0);
|
|
347
349
|
}
|
|
348
|
-
|
|
349
|
-
// src/document-tools/markup-download.ts
|
|
350
|
-
var SIGNED_LOCKED_REASON = "Signed documents can't be changed \u2014 download the signed file instead";
|
|
351
|
-
function isSignedVersion(doc, version) {
|
|
352
|
-
const n = version ?? doc.current_version ?? 1;
|
|
353
|
-
return (doc.versions ?? []).some((v) => v.n === n && v.reason === "signed");
|
|
354
|
-
}
|
|
355
|
-
var MarkupDownloadError = class extends Error {
|
|
356
|
-
constructor(message, status) {
|
|
357
|
-
super(message);
|
|
358
|
-
this.status = status;
|
|
359
|
-
this.name = "MarkupDownloadError";
|
|
360
|
-
}
|
|
361
|
-
status;
|
|
362
|
-
};
|
|
363
|
-
function currentHasMarkup(doc) {
|
|
364
|
-
const n = doc.current_version ?? 1;
|
|
365
|
-
return (doc.versions ?? []).some((v) => v.n === n && (v.markup_count ?? 0) > 0);
|
|
366
|
-
}
|
|
367
|
-
async function fetchMarkupPdf(client, documentId, version) {
|
|
368
|
-
const { data, response } = await client.GET("/v1/document/{document_ext_id}/markup/pdf", {
|
|
369
|
-
params: { path: { document_ext_id: documentId }, query: version ? { version } : {} },
|
|
370
|
-
parseAs: "blob"
|
|
371
|
-
});
|
|
372
|
-
if (!response.ok || !data) {
|
|
373
|
-
throw new MarkupDownloadError(
|
|
374
|
-
response.status === 404 ? "This document has no markup yet" : (
|
|
375
|
-
// The server refuses a signed version: its PDF takes no more changes.
|
|
376
|
-
response.status === 409 ? SIGNED_LOCKED_REASON : "The markup could not be downloaded"
|
|
377
|
-
),
|
|
378
|
-
response.status
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
const disposition = response.headers.get("content-disposition") ?? "";
|
|
382
|
-
const utf8 = /filename\*=UTF-8''([^;]+)/i.exec(disposition)?.[1];
|
|
383
|
-
const plain = /filename="([^"]+)"/i.exec(disposition)?.[1];
|
|
384
|
-
const fileName = utf8 ? decodeURIComponent(utf8) : plain ?? "markup.pdf";
|
|
385
|
-
return { blob: data, fileName };
|
|
386
|
-
}
|
|
387
350
|
var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
|
|
388
351
|
function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
|
|
389
|
-
const { client, notify, saveFile, onDocumentsChanged } =
|
|
352
|
+
const { client, notify, saveFile, onDocumentsChanged } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
390
353
|
const documentId = documentData?.external_id;
|
|
391
354
|
const currentVersion = documentData?.current_version ?? 1;
|
|
392
355
|
const shownVersion = snapshotVersion ?? currentVersion;
|
|
@@ -417,11 +380,11 @@ function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false)
|
|
|
417
380
|
const downloadMarkup = react.useCallback(async () => {
|
|
418
381
|
if (!documentId) return;
|
|
419
382
|
if (currentSigned) {
|
|
420
|
-
notify(SIGNED_LOCKED_REASON, "info");
|
|
383
|
+
notify(chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON, "info");
|
|
421
384
|
return;
|
|
422
385
|
}
|
|
423
386
|
try {
|
|
424
|
-
const { blob, fileName } = await fetchMarkupPdf(
|
|
387
|
+
const { blob, fileName } = await chunk2M4B4FFA_cjs.fetchMarkupPdf(
|
|
425
388
|
client,
|
|
426
389
|
documentId,
|
|
427
390
|
snapshotVersion ? snapshotVersion : void 0
|
|
@@ -557,19 +520,18 @@ function useIsOnline() {
|
|
|
557
520
|
() => true
|
|
558
521
|
);
|
|
559
522
|
}
|
|
560
|
-
var documentBytesKey = (documentRef, version, kind) => version === void 0 ? ["arbi", "documentBytes", documentRef] : ["arbi", "documentBytes", documentRef, version, kind ?? "pdf"];
|
|
561
523
|
function useDocumentBytes(documentRef, options) {
|
|
562
|
-
const { client } =
|
|
524
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
563
525
|
const { version, kind, enabled = true, fallback } = options;
|
|
564
526
|
return reactQuery.useQuery({
|
|
565
|
-
queryKey: documentBytesKey(documentRef, version ?? null, kind),
|
|
527
|
+
queryKey: chunkVLK52VXC_cjs.documentBytesKey(documentRef, version ?? null, kind),
|
|
566
528
|
queryFn: async ({ signal }) => {
|
|
567
529
|
if (fallback && typeof navigator !== "undefined" && navigator.onLine === false) {
|
|
568
530
|
const offline = await fallback();
|
|
569
531
|
if (offline) return offline;
|
|
570
532
|
}
|
|
571
533
|
try {
|
|
572
|
-
return await (kind === "original" ?
|
|
534
|
+
return await (kind === "original" ? chunk2M4B4FFA_cjs.fetchDocumentFile : chunk2M4B4FFA_cjs.fetchDocumentPdf)(
|
|
573
535
|
client,
|
|
574
536
|
documentRef,
|
|
575
537
|
{ signal }
|
|
@@ -601,7 +563,6 @@ function isLegibleSignatureBox(rect) {
|
|
|
601
563
|
return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height;
|
|
602
564
|
}
|
|
603
565
|
var SIGNATURES_PATH = "/v1/document/{document_ext_id}/signatures";
|
|
604
|
-
var SIGNATURES_KEY = ["get", SIGNATURES_PATH];
|
|
605
566
|
function errorDetail(error, fallback) {
|
|
606
567
|
const detail3 = error?.detail;
|
|
607
568
|
return typeof detail3 === "string" ? detail3 : fallback;
|
|
@@ -615,13 +576,10 @@ async function fetchDocumentSignatures(client, documentRef) {
|
|
|
615
576
|
return data;
|
|
616
577
|
}
|
|
617
578
|
function useDocumentSignatures(documentId, enabled = true) {
|
|
618
|
-
const { client } =
|
|
579
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
619
580
|
const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentId);
|
|
620
581
|
return reactQuery.useQuery({
|
|
621
|
-
queryKey:
|
|
622
|
-
...SIGNATURES_KEY,
|
|
623
|
-
{ params: { path: { document_ext_id: docId }, ...version ? { query: { version } } : {} } }
|
|
624
|
-
],
|
|
582
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
|
|
625
583
|
queryFn: () => fetchDocumentSignatures(client, documentId),
|
|
626
584
|
enabled: enabled && !!docId,
|
|
627
585
|
staleTime: 6e4
|
|
@@ -686,7 +644,7 @@ async function signDocument(client$1, deploymentDomain, {
|
|
|
686
644
|
return signed.data;
|
|
687
645
|
}
|
|
688
646
|
function useSignDocument() {
|
|
689
|
-
const env =
|
|
647
|
+
const env = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
690
648
|
const queryClient = reactQuery.useQueryClient();
|
|
691
649
|
return reactQuery.useMutation({
|
|
692
650
|
mutationFn: (vars) => {
|
|
@@ -695,7 +653,7 @@ function useSignDocument() {
|
|
|
695
653
|
},
|
|
696
654
|
onSuccess: async (result) => {
|
|
697
655
|
await env.onDocumentsChanged?.([result.doc_ext_id], "signed");
|
|
698
|
-
await queryClient.invalidateQueries({ queryKey:
|
|
656
|
+
await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures() });
|
|
699
657
|
}
|
|
700
658
|
});
|
|
701
659
|
}
|
|
@@ -732,9 +690,9 @@ async function fetchSignatureVerification(client, reference) {
|
|
|
732
690
|
return data;
|
|
733
691
|
}
|
|
734
692
|
function useSignatureVerification(reference) {
|
|
735
|
-
const { client } =
|
|
693
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
736
694
|
return reactQuery.useQuery({
|
|
737
|
-
queryKey:
|
|
695
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
|
|
738
696
|
queryFn: () => fetchSignatureVerification(client, reference),
|
|
739
697
|
enabled: !!reference,
|
|
740
698
|
retry: false
|
|
@@ -774,7 +732,6 @@ var SIGNER_PROGRESS_LABELS = {
|
|
|
774
732
|
var EMAIL = /^[^@\s<>,;]{1,64}@[^@\s<>,;]{1,255}\.[^@\s<>,;]{1,63}$/;
|
|
775
733
|
var isEmailSigner = (signer) => EMAIL.test(signer.trim());
|
|
776
734
|
var MARK_FIELD_TYPES = ["signature", "initials"];
|
|
777
|
-
var REQUESTS_KEY = ["signature-requests"];
|
|
778
735
|
function detail(error, fallback) {
|
|
779
736
|
const d = error?.detail;
|
|
780
737
|
if (typeof d === "string") return d;
|
|
@@ -836,18 +793,18 @@ async function fetchDocumentSignatureRequests(client, documentId) {
|
|
|
836
793
|
return data;
|
|
837
794
|
}
|
|
838
795
|
function useDocumentSignatureRequests(documentId, enabled = true) {
|
|
839
|
-
const { client } =
|
|
796
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
840
797
|
return reactQuery.useQuery({
|
|
841
|
-
queryKey:
|
|
798
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
|
|
842
799
|
queryFn: () => fetchDocumentSignatureRequests(client, documentId),
|
|
843
800
|
enabled: enabled && !!documentId,
|
|
844
801
|
staleTime: 15e3
|
|
845
802
|
});
|
|
846
803
|
}
|
|
847
804
|
function useSignatureRequestsAwaitingMe(enabled = true) {
|
|
848
|
-
const { client } =
|
|
805
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
849
806
|
return reactQuery.useQuery({
|
|
850
|
-
queryKey:
|
|
807
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequestsAwaitingMe(),
|
|
851
808
|
queryFn: async () => {
|
|
852
809
|
const { data, error } = await client.GET("/v1/signature-requests", {
|
|
853
810
|
params: { query: { awaiting_me: true } }
|
|
@@ -860,9 +817,9 @@ function useSignatureRequestsAwaitingMe(enabled = true) {
|
|
|
860
817
|
});
|
|
861
818
|
}
|
|
862
819
|
function useSignatureRequest(requestId) {
|
|
863
|
-
const { client } =
|
|
820
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
864
821
|
return reactQuery.useQuery({
|
|
865
|
-
queryKey:
|
|
822
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequest(requestId ?? ""),
|
|
866
823
|
queryFn: async () => {
|
|
867
824
|
const { data, error } = await client.GET("/v1/signature-requests/{request_ext_id}", {
|
|
868
825
|
params: { path: { request_ext_id: requestId } }
|
|
@@ -910,10 +867,10 @@ async function saveSignatureRequest(client, { documentId, version, fields, messa
|
|
|
910
867
|
}
|
|
911
868
|
function useInvalidateRequests() {
|
|
912
869
|
const queryClient = reactQuery.useQueryClient();
|
|
913
|
-
return () => queryClient.invalidateQueries({ queryKey:
|
|
870
|
+
return () => queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureRequests() });
|
|
914
871
|
}
|
|
915
872
|
function useSaveSignatureRequest() {
|
|
916
|
-
const { client } =
|
|
873
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
917
874
|
const invalidate = useInvalidateRequests();
|
|
918
875
|
return reactQuery.useMutation({
|
|
919
876
|
mutationFn: (vars) => saveSignatureRequest(client, vars),
|
|
@@ -921,7 +878,7 @@ function useSaveSignatureRequest() {
|
|
|
921
878
|
});
|
|
922
879
|
}
|
|
923
880
|
function useVoidSignatureRequest() {
|
|
924
|
-
const { client } =
|
|
881
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
925
882
|
const invalidate = useInvalidateRequests();
|
|
926
883
|
return reactQuery.useMutation({
|
|
927
884
|
mutationFn: async (requestId) => {
|
|
@@ -935,7 +892,7 @@ function useVoidSignatureRequest() {
|
|
|
935
892
|
});
|
|
936
893
|
}
|
|
937
894
|
function useDeclineSignatureRequest() {
|
|
938
|
-
const { client } =
|
|
895
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
939
896
|
const invalidate = useInvalidateRequests();
|
|
940
897
|
return reactQuery.useMutation({
|
|
941
898
|
mutationFn: async ({ requestId, reason }) => {
|
|
@@ -975,7 +932,7 @@ async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBl
|
|
|
975
932
|
return signed.data;
|
|
976
933
|
}
|
|
977
934
|
function useSignSignatureRequest() {
|
|
978
|
-
const env =
|
|
935
|
+
const env = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
979
936
|
const invalidate = useInvalidateRequests();
|
|
980
937
|
const queryClient = reactQuery.useQueryClient();
|
|
981
938
|
return reactQuery.useMutation({
|
|
@@ -987,17 +944,15 @@ function useSignSignatureRequest() {
|
|
|
987
944
|
await invalidate();
|
|
988
945
|
if (result.completed && result.request.doc_ext_id) {
|
|
989
946
|
await env.onDocumentsChanged?.([result.request.doc_ext_id], "signed");
|
|
990
|
-
await queryClient.invalidateQueries({
|
|
991
|
-
queryKey: ["get", "/v1/document/{document_ext_id}/signatures"]
|
|
992
|
-
});
|
|
947
|
+
await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.documentSignatures() });
|
|
993
948
|
}
|
|
994
949
|
}
|
|
995
950
|
});
|
|
996
951
|
}
|
|
997
952
|
function useSignerCandidates(enabled = true) {
|
|
998
|
-
const { client, user } =
|
|
953
|
+
const { client, user } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
999
954
|
return reactQuery.useQuery({
|
|
1000
|
-
queryKey:
|
|
955
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureCandidates(),
|
|
1001
956
|
queryFn: async () => {
|
|
1002
957
|
const { data, error } = await client.GET("/v1/workspace/users");
|
|
1003
958
|
if (!data) throw new Error(detail(error, "The workspace members could not be read"));
|
|
@@ -1019,13 +974,13 @@ function useSignerCandidates(enabled = true) {
|
|
|
1019
974
|
async function inviteSigners(client, documentId, emails) {
|
|
1020
975
|
if (!emails.length) return;
|
|
1021
976
|
const { error, response } = await client.POST("/v1/workspace/users", {
|
|
1022
|
-
body: {
|
|
977
|
+
body: browser.workspaces.addWorkspaceMembersBody({
|
|
1023
978
|
emails,
|
|
1024
979
|
role: "guest",
|
|
1025
980
|
confirm_invite: true,
|
|
1026
981
|
resource_type: "document",
|
|
1027
982
|
resource_ext_id: documentId
|
|
1028
|
-
}
|
|
983
|
+
})
|
|
1029
984
|
});
|
|
1030
985
|
if (response.status === 409) {
|
|
1031
986
|
throw new Error("Share the document with the workspace before asking others to sign it.");
|
|
@@ -1035,19 +990,18 @@ async function inviteSigners(client, documentId, emails) {
|
|
|
1035
990
|
}
|
|
1036
991
|
}
|
|
1037
992
|
function useInviteSigners() {
|
|
1038
|
-
const { client } =
|
|
993
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
1039
994
|
const invalidate = useInvalidateRequests();
|
|
1040
995
|
const queryClient = reactQuery.useQueryClient();
|
|
1041
996
|
return reactQuery.useMutation({
|
|
1042
997
|
mutationFn: ({ documentId, emails }) => inviteSigners(client, documentId, emails),
|
|
1043
998
|
onSuccess: async () => {
|
|
1044
999
|
await invalidate();
|
|
1045
|
-
await queryClient.invalidateQueries({ queryKey:
|
|
1000
|
+
await queryClient.invalidateQueries({ queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.signatureCandidates() });
|
|
1046
1001
|
}
|
|
1047
1002
|
});
|
|
1048
1003
|
}
|
|
1049
1004
|
var INFORMAL_SIGNATURE_NOTE = "Informal signature: for verified signing, use Request signatures.";
|
|
1050
|
-
var KEY = ["saved-signature"];
|
|
1051
1005
|
async function keypair(source = client.getUserEncryptionKeypair) {
|
|
1052
1006
|
await client.initSodium();
|
|
1053
1007
|
const pair = await source();
|
|
@@ -1080,9 +1034,9 @@ async function deleteSavedSignature(client) {
|
|
|
1080
1034
|
if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
|
|
1081
1035
|
}
|
|
1082
1036
|
function useSavedSignature(enabled = true) {
|
|
1083
|
-
const { client } =
|
|
1037
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
1084
1038
|
return reactQuery.useQuery({
|
|
1085
|
-
queryKey:
|
|
1039
|
+
queryKey: chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(),
|
|
1086
1040
|
queryFn: () => fetchSavedSignature(client),
|
|
1087
1041
|
enabled,
|
|
1088
1042
|
staleTime: 6e4,
|
|
@@ -1090,19 +1044,19 @@ function useSavedSignature(enabled = true) {
|
|
|
1090
1044
|
});
|
|
1091
1045
|
}
|
|
1092
1046
|
function useStoreSavedSignature() {
|
|
1093
|
-
const { client } =
|
|
1047
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
1094
1048
|
const queryClient = reactQuery.useQueryClient();
|
|
1095
1049
|
return reactQuery.useMutation({
|
|
1096
1050
|
mutationFn: (signature) => storeSavedSignature(client, signature),
|
|
1097
|
-
onSuccess: (_, signature) => queryClient.setQueryData(
|
|
1051
|
+
onSuccess: (_, signature) => queryClient.setQueryData(chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(), signature)
|
|
1098
1052
|
});
|
|
1099
1053
|
}
|
|
1100
1054
|
function useDeleteSavedSignature() {
|
|
1101
|
-
const { client } =
|
|
1055
|
+
const { client } = chunk2M4B4FFA_cjs.useDocumentTools();
|
|
1102
1056
|
const queryClient = reactQuery.useQueryClient();
|
|
1103
1057
|
return reactQuery.useMutation({
|
|
1104
1058
|
mutationFn: () => deleteSavedSignature(client),
|
|
1105
|
-
onSuccess: () => queryClient.setQueryData(
|
|
1059
|
+
onSuccess: () => queryClient.setQueryData(chunkVLK52VXC_cjs.arbiQueryKeys.savedSignature(), null)
|
|
1106
1060
|
});
|
|
1107
1061
|
}
|
|
1108
1062
|
function pngBytes(base64) {
|
|
@@ -1119,51 +1073,75 @@ function pngSize(base64) {
|
|
|
1119
1073
|
|
|
1120
1074
|
Object.defineProperty(exports, "DocumentFetchError", {
|
|
1121
1075
|
enumerable: true,
|
|
1122
|
-
get: function () { return
|
|
1076
|
+
get: function () { return chunk2M4B4FFA_cjs.DocumentFetchError; }
|
|
1123
1077
|
});
|
|
1124
1078
|
Object.defineProperty(exports, "DocumentToolsProvider", {
|
|
1125
1079
|
enumerable: true,
|
|
1126
|
-
get: function () { return
|
|
1080
|
+
get: function () { return chunk2M4B4FFA_cjs.DocumentToolsProvider; }
|
|
1081
|
+
});
|
|
1082
|
+
Object.defineProperty(exports, "MarkupDownloadError", {
|
|
1083
|
+
enumerable: true,
|
|
1084
|
+
get: function () { return chunk2M4B4FFA_cjs.MarkupDownloadError; }
|
|
1085
|
+
});
|
|
1086
|
+
Object.defineProperty(exports, "SIGNED_LOCKED_REASON", {
|
|
1087
|
+
enumerable: true,
|
|
1088
|
+
get: function () { return chunk2M4B4FFA_cjs.SIGNED_LOCKED_REASON; }
|
|
1127
1089
|
});
|
|
1128
1090
|
Object.defineProperty(exports, "certificateLink", {
|
|
1129
1091
|
enumerable: true,
|
|
1130
|
-
get: function () { return
|
|
1092
|
+
get: function () { return chunk2M4B4FFA_cjs.certificateLink; }
|
|
1131
1093
|
});
|
|
1132
1094
|
Object.defineProperty(exports, "clientUpload", {
|
|
1133
1095
|
enumerable: true,
|
|
1134
|
-
get: function () { return
|
|
1096
|
+
get: function () { return chunk2M4B4FFA_cjs.clientUpload; }
|
|
1135
1097
|
});
|
|
1136
1098
|
Object.defineProperty(exports, "contentDispositionFileName", {
|
|
1137
1099
|
enumerable: true,
|
|
1138
|
-
get: function () { return
|
|
1100
|
+
get: function () { return chunk2M4B4FFA_cjs.contentDispositionFileName; }
|
|
1101
|
+
});
|
|
1102
|
+
Object.defineProperty(exports, "currentHasMarkup", {
|
|
1103
|
+
enumerable: true,
|
|
1104
|
+
get: function () { return chunk2M4B4FFA_cjs.currentHasMarkup; }
|
|
1139
1105
|
});
|
|
1140
1106
|
Object.defineProperty(exports, "defaultCertificateUrl", {
|
|
1141
1107
|
enumerable: true,
|
|
1142
|
-
get: function () { return
|
|
1108
|
+
get: function () { return chunk2M4B4FFA_cjs.defaultCertificateUrl; }
|
|
1143
1109
|
});
|
|
1144
1110
|
Object.defineProperty(exports, "downloadBlob", {
|
|
1145
1111
|
enumerable: true,
|
|
1146
|
-
get: function () { return
|
|
1112
|
+
get: function () { return chunk2M4B4FFA_cjs.downloadBlob; }
|
|
1147
1113
|
});
|
|
1148
1114
|
Object.defineProperty(exports, "fetchDocumentFile", {
|
|
1149
1115
|
enumerable: true,
|
|
1150
|
-
get: function () { return
|
|
1116
|
+
get: function () { return chunk2M4B4FFA_cjs.fetchDocumentFile; }
|
|
1151
1117
|
});
|
|
1152
1118
|
Object.defineProperty(exports, "fetchDocumentPdf", {
|
|
1153
1119
|
enumerable: true,
|
|
1154
|
-
get: function () { return
|
|
1120
|
+
get: function () { return chunk2M4B4FFA_cjs.fetchDocumentPdf; }
|
|
1121
|
+
});
|
|
1122
|
+
Object.defineProperty(exports, "fetchMarkupPdf", {
|
|
1123
|
+
enumerable: true,
|
|
1124
|
+
get: function () { return chunk2M4B4FFA_cjs.fetchMarkupPdf; }
|
|
1125
|
+
});
|
|
1126
|
+
Object.defineProperty(exports, "isSignedVersion", {
|
|
1127
|
+
enumerable: true,
|
|
1128
|
+
get: function () { return chunk2M4B4FFA_cjs.isSignedVersion; }
|
|
1155
1129
|
});
|
|
1156
1130
|
Object.defineProperty(exports, "uploadQueryString", {
|
|
1157
1131
|
enumerable: true,
|
|
1158
|
-
get: function () { return
|
|
1132
|
+
get: function () { return chunk2M4B4FFA_cjs.uploadQueryString; }
|
|
1159
1133
|
});
|
|
1160
1134
|
Object.defineProperty(exports, "useDocumentTools", {
|
|
1161
1135
|
enumerable: true,
|
|
1162
|
-
get: function () { return
|
|
1136
|
+
get: function () { return chunk2M4B4FFA_cjs.useDocumentTools; }
|
|
1163
1137
|
});
|
|
1164
1138
|
Object.defineProperty(exports, "useOptionalDocumentTools", {
|
|
1165
1139
|
enumerable: true,
|
|
1166
|
-
get: function () { return
|
|
1140
|
+
get: function () { return chunk2M4B4FFA_cjs.useOptionalDocumentTools; }
|
|
1141
|
+
});
|
|
1142
|
+
Object.defineProperty(exports, "documentBytesKey", {
|
|
1143
|
+
enumerable: true,
|
|
1144
|
+
get: function () { return chunkVLK52VXC_cjs.documentBytesKey; }
|
|
1167
1145
|
});
|
|
1168
1146
|
exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
|
|
1169
1147
|
exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
|
|
@@ -1171,11 +1149,9 @@ exports.INFORMAL_SIGNATURE_NOTE = INFORMAL_SIGNATURE_NOTE;
|
|
|
1171
1149
|
exports.LEGACY_LAYER_PREFIX = LEGACY_LAYER_PREFIX;
|
|
1172
1150
|
exports.MARK_FIELD_TYPES = MARK_FIELD_TYPES;
|
|
1173
1151
|
exports.MAX_MERGE_ATTEMPTS = MAX_MERGE_ATTEMPTS;
|
|
1174
|
-
exports.MarkupDownloadError = MarkupDownloadError;
|
|
1175
1152
|
exports.MarkupStoreError = MarkupStoreError;
|
|
1176
1153
|
exports.PRODUCTIONS_FOLDER = PRODUCTIONS_FOLDER;
|
|
1177
1154
|
exports.SIGNATURE_FIELD_TYPES = SIGNATURE_FIELD_TYPES;
|
|
1178
|
-
exports.SIGNED_LOCKED_REASON = SIGNED_LOCKED_REASON;
|
|
1179
1155
|
exports.SIGNED_UNCHANGED = SIGNED_UNCHANGED;
|
|
1180
1156
|
exports.SIGNER_PROGRESS_LABELS = SIGNER_PROGRESS_LABELS;
|
|
1181
1157
|
exports.SignatureVerificationError = SignatureVerificationError;
|
|
@@ -1186,12 +1162,9 @@ exports.buildProduction = buildProduction;
|
|
|
1186
1162
|
exports.canAnnotate = canAnnotate;
|
|
1187
1163
|
exports.copyOpenThreads = copyOpenThreads;
|
|
1188
1164
|
exports.createMarkupStore = createMarkupStore;
|
|
1189
|
-
exports.currentHasMarkup = currentHasMarkup;
|
|
1190
1165
|
exports.deleteSavedSignature = deleteSavedSignature;
|
|
1191
|
-
exports.documentBytesKey = documentBytesKey;
|
|
1192
1166
|
exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
|
|
1193
1167
|
exports.fetchDocumentSignatures = fetchDocumentSignatures;
|
|
1194
|
-
exports.fetchMarkupPdf = fetchMarkupPdf;
|
|
1195
1168
|
exports.fetchProductionPdf = fetchProductionPdf;
|
|
1196
1169
|
exports.fetchSavedSignature = fetchSavedSignature;
|
|
1197
1170
|
exports.fetchSignatureVerification = fetchSignatureVerification;
|
|
@@ -1207,7 +1180,6 @@ exports.isEmailSigner = isEmailSigner;
|
|
|
1207
1180
|
exports.isLegibleSignatureBox = isLegibleSignatureBox;
|
|
1208
1181
|
exports.isPdfDocument = isPdfDocument;
|
|
1209
1182
|
exports.isSignatureReference = isSignatureReference;
|
|
1210
|
-
exports.isSignedVersion = isSignedVersion;
|
|
1211
1183
|
exports.marksByVersion = marksByVersion;
|
|
1212
1184
|
exports.matchSignedCopy = matchSignedCopy;
|
|
1213
1185
|
exports.migrateLegacyLayer = migrateLegacyLayer;
|