@arbidocs/react 0.5.183 → 0.5.184
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 +14 -14
- package/dist/calls/livekit/index.cjs +48 -48
- package/dist/{chunk-K6MO6YML.cjs → chunk-4LFADBRL.cjs} +10 -10
- package/dist/{chunk-K6MO6YML.cjs.map → chunk-4LFADBRL.cjs.map} +1 -1
- package/dist/{chunk-NBES77PB.cjs → chunk-BEOHXA2Z.cjs} +60 -60
- package/dist/{chunk-NBES77PB.cjs.map → chunk-BEOHXA2Z.cjs.map} +1 -1
- package/dist/{chunk-Q7BGWKHP.cjs → chunk-KAMOFYV2.cjs} +44 -44
- package/dist/{chunk-Q7BGWKHP.cjs.map → chunk-KAMOFYV2.cjs.map} +1 -1
- package/dist/{chunk-VCYRQZ3R.cjs → chunk-KQY2LP76.cjs} +70 -70
- package/dist/{chunk-VCYRQZ3R.cjs.map → chunk-KQY2LP76.cjs.map} +1 -1
- package/dist/{chunk-5QOZLKAY.cjs → chunk-SJZRVX7T.cjs} +7 -2
- package/dist/chunk-SJZRVX7T.cjs.map +1 -0
- package/dist/{chunk-3IBQW2UD.cjs → chunk-XQIUGZPV.cjs} +37 -37
- package/dist/{chunk-3IBQW2UD.cjs.map → chunk-XQIUGZPV.cjs.map} +1 -1
- package/dist/databases.js +36 -1
- package/dist/databases.js.map +2 -2
- package/dist/document-tools/core.cjs +100 -100
- package/dist/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.cjs +102 -102
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/{file-shares.d-Dlt7pKRi.d.ts → file-shares.d-DyS7nSIy.d.ts} +5 -0
- package/dist/index.cjs +1440 -1405
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -4
- package/dist/query-keys.js +5 -0
- package/dist/query-keys.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-5QOZLKAY.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/document-tools/environment.tsx","../src/document-tools/document-pdf.ts","../src/document-tools/markup-download.ts","../src/document-tools/signing.ts","../src/document-tools/file-shares.ts"],"names":["createContext","useDeploymentDomain","useRef","useCallback","useMemo","jsx","useContext","parseVersionRef","useQuery","arbiQueryKeys","client","unlockIdentityWithPassword","signMessage","useQueryClient","useMutation"],"mappings":";;;;;;;;;AAmEO,SAAS,kBAAkB,KAAA,EAAoC;AACpE,EAAA,MAAM,MAAA,GAAS,IAAI,eAAA,EAAgB;AACnC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AAC3C,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,IAAI,KAAA,GAAQ,CAAC,KAAK,CAAA,EAAG,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,MAAA,CAAO,IAAI,CAAC,CAAA;AAAA,EAC5F;AACA,EAAA,OAAO,OAAO,QAAA,EAAS;AACzB;AAqDO,SAAS,YAAA,CAAa,MAAY,QAAA,EAAwB;AAC/D,EAAA,MAAM,GAAA,GAAM,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAA;AACpC,EAAA,MAAM,CAAA,GAAI,QAAA,CAAS,aAAA,CAAc,GAAG,CAAA;AACpC,EAAA,CAAA,CAAE,IAAA,GAAO,GAAA;AACT,EAAA,CAAA,CAAE,QAAA,GAAW,QAAA;AACb,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,CAAC,CAAA;AAC3B,EAAA,CAAA,CAAE,KAAA,EAAM;AACR,EAAA,CAAA,CAAE,MAAA,EAAO;AACT,EAAA,UAAA,CAAW,MAAM,GAAA,CAAI,eAAA,CAAgB,GAAG,GAAG,GAAM,CAAA;AACnD;AAGO,SAAS,aA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,GACZ,CAAA;AACH;AAGO,SAAS,oBAAA,GAA4C;AAC1D,EAAA,MAAM,cAAcI,yBAAAA,EAAe;AACnC,EAAA,OAAOV,iBAAAA;AAAA,IACL,MAAM,YAAY,iBAAA,CAAkB,EAAE,UAAUM,+BAAA,CAAc,UAAA,IAAc,CAAA;AAAA,IAC5E,CAAC,WAAW;AAAA,GACd;AACF;AAMA,eAAsB,gBAAA,CAAiB,QAA6B,KAAA,EAAkB;AACpF,EAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,IAAA;AAAA,IAC1B,+DAAA;AAAA,IACA,EAAE,MAAA,EAAQ,EAAE,IAAA,EAAM,EAAE,eAAA,EAAiB,KAAA,CAAM,eAAA,EAAiB,QAAA,EAAU,KAAA,CAAM,WAAA,EAAY,EAAE;AAAE,GAC9F;AACA,EAAA,IAAI,CAAC,MAAA,CAAO,IAAA,EAAM,MAAM,IAAI,MAAM,oDAAoD,CAAA;AACtF,EAAA,OAAO,MAAA,CAAO,IAAA;AAChB","file":"chunk-K6MO6YML.cjs","sourcesContent":["/**\n * The host app's side of the document tools (markup, freeze, e-signing, versions): the one place\n * the tools reach the app. They never import a store, a router, a toast library or app API code;\n * the host passes what it has to `<DocumentToolsProvider>` and every optional field has a default.\n *\n * `client` is an openapi-fetch client for the ARBI API (`ArbiClient['fetch']` from\n * `@arbidocs/client`, or `arbi.getClient().fetch` from an `@arbidocs/sdk` `Arbi`), signed in with the\n * user's session; it carries the auth.\n */\n\nimport { createContext, useCallback, useContext, useMemo, useRef, type ReactNode } from 'react'\nimport type { ArbiClient, operations } from '@arbidocs/client'\nimport { useDeploymentDomain } from '../useArbi'\n\nexport type DocumentToolsClient = ArbiClient['fetch']\n\nexport type DocumentToolsNoticeKind = 'success' | 'error' | 'info' | 'warning'\n\nexport interface DocumentToolsNoticeOptions {\n /** A second line under the message. */\n description?: string\n /** One action button on the notice (\"Email it\"). */\n action?: { label: string; onClick: () => void }\n}\n\nexport type DocumentToolsNotify = (\n message: string,\n kind: DocumentToolsNoticeKind,\n options?: DocumentToolsNoticeOptions\n) => void\n\nexport interface DocumentToolsUser {\n /** The name marks are authored as and the signer's name is prefilled with. */\n name: string\n /** The sign-in email: signing re-derives the user's key from it and the password. */\n email?: string | null\n /** The user's id (usr-*): which fields of a signature request are theirs. */\n externalId?: string | null\n}\n\n/** What changed about a document, so the host can refresh its own lists and caches. */\nexport type DocumentChange =\n /** A version's markup got its first mark or lost its last one. */\n | 'markup'\n /** A signature was added: the document has a new current version. */\n | 'signed'\n /** A new document was made from it (a frozen copy). The ids are the NEW documents. */\n | 'copy'\n /** A new version was saved (the Word editor's Save version): the document's current version. */\n | 'version'\n\n/**\n * The `/v1/document/upload` query, typed from the API schema: `derived_from` is a list (a\n * production set is derived from every document in it), `shared` a boolean.\n */\nexport type DocumentUploadQuery = NonNullable<operations['upload_documents']['parameters']['query']>\n\nexport interface DocumentUploadRequest {\n file: File\n /** `/v1/document/upload` query: `derived_from`, `derived_role`, `shared`, `folder`. */\n query: DocumentUploadQuery\n}\n\n/**\n * The upload query as a URL query string, for a host that posts the upload itself (an XHR with\n * progress): a list repeats its key (`derived_from=a&derived_from=b`), empty values are left out.\n */\nexport function uploadQueryString(query: DocumentUploadQuery): string {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined) continue\n for (const item of Array.isArray(value) ? value : [value]) params.append(key, String(item))\n }\n return params.toString()\n}\n\nexport interface DocumentToolsEnvironment {\n client: DocumentToolsClient\n /**\n * The deployment domain the user's keys are derived for. Needed for signing. Default: the one\n * the host's `Arbi` computes (`arbi.getDeploymentDomain()`), if any.\n */\n deploymentDomain?: string\n /** The signed-in user; marks are authored as \"You\" without one, and signing is unavailable. */\n user?: DocumentToolsUser | null\n /** Surface a transient message. Default: none (errors still show inline where they can). */\n notify?: DocumentToolsNotify\n /** Open a document or a version reference (`doc-…@v2`): the copy just made, the signed copy. */\n openDocument?: (documentRef: string) => void\n /**\n * Documents changed on the server (see {@link DocumentChange}); refresh the host's lists. The\n * tools wait for it before opening the document, so a copy is listed when it opens.\n */\n onDocumentsChanged?: (documentIds: string[], change: DocumentChange) => void | Promise<void>\n /** Upload a derived copy. Default: `POST /v1/document/upload` through `client`. */\n uploadDocument?: (\n request: DocumentUploadRequest\n ) => Promise<{ doc_ext_ids?: string[] } | undefined>\n /** Save a file to the user's computer. Default: a temporary download link. */\n saveFile?: (blob: Blob, fileName: string) => void\n /** Email a document (offered once it is signed). Omitted: no \"Email it\". */\n emailDocument?: (documentRef: string) => void\n /**\n * The public page that checks a signature (the certificate) in this app. When given, \"View\n * certificate\" opens it in preference to the backend's `certificate_url` (which is on the\n * deployment domain, like the link embedded in the signed PDF). Without it: the backend's\n * `certificate_url`, else `/verify/{reference}` on this origin.\n */\n certificateUrl?: (reference: string) => string\n}\n\n/** The environment with every default filled in. */\nexport interface ResolvedDocumentToolsEnvironment extends DocumentToolsEnvironment {\n prepareFileShare: (documentId: string) => Promise<void>\n registerBeforeFileShare: (documentId: string, flush: () => Promise<void>) => () => void\n notify: DocumentToolsNotify\n saveFile: (blob: Blob, fileName: string) => void\n uploadDocument: (\n request: DocumentUploadRequest\n ) => Promise<{ doc_ext_ids?: string[] } | undefined>\n}\n\n/**\n * Save a blob through a temporary `<a download>`. The object URL is revoked a minute later, not at\n * once: revoking straight after `click()` can cancel the download (Safari, and large files\n * elsewhere) before the browser has read the blob.\n */\nexport function downloadBlob(blob: Blob, fileName: string): void {\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = fileName\n document.body.appendChild(a)\n a.click()\n a.remove()\n setTimeout(() => URL.revokeObjectURL(url), 60_000)\n}\n\n/** The default upload: multipart `files` to `/v1/document/upload` through the API client. */\nexport function clientUpload(client: DocumentToolsClient) {\n return async ({ file, query }: DocumentUploadRequest) => {\n const formData = new FormData()\n formData.append('files', file)\n const { data, response } = await client.POST('/v1/document/upload', {\n params: { query },\n // The schema types the multipart body as `{ files: string[] }`; the FormData is sent as is.\n body: formData as unknown as { files: string[] },\n bodySerializer: () => formData,\n })\n if (!response.ok) throw new Error(`Upload failed with status ${response.status}`)\n return data\n }\n}\n\nexport function defaultCertificateUrl(reference: string): string {\n const origin = typeof location === 'undefined' ? '' : location.origin\n return `${origin}/verify/${encodeURIComponent(reference)}`\n}\n\n/**\n * Where \"View certificate\" goes for a signature: the host's `certificateUrl(reference)` when it\n * gives one, else the `certificate_url` the backend returned, else `/verify/{reference}` here.\n */\nexport function certificateLink(\n signature: { reference: string; certificate_url?: string | null },\n certificateUrl?: (reference: string) => string\n): string {\n if (certificateUrl) return certificateUrl(signature.reference)\n return signature.certificate_url || defaultCertificateUrl(signature.reference)\n}\n\nconst DocumentToolsContext = createContext<ResolvedDocumentToolsEnvironment | null>(null)\n\nexport interface DocumentToolsProviderProps extends DocumentToolsEnvironment {\n children: ReactNode\n}\n\nexport function DocumentToolsProvider({ children, ...env }: DocumentToolsProviderProps) {\n const arbiDeploymentDomain = useDeploymentDomain()\n const guards = useRef(new Map<string, () => Promise<void>>())\n const pendingFlushes = useRef(new Map<string, Promise<void>>())\n const registerBeforeFileShare = useCallback((id: string, flush: () => Promise<void>) => {\n guards.current.set(id, flush)\n return () => {\n if (guards.current.get(id) !== flush) return\n guards.current.delete(id)\n const pending = flush()\n pendingFlushes.current.set(id, pending)\n void pending.then(\n () => {\n if (pendingFlushes.current.get(id) === pending) pendingFlushes.current.delete(id)\n },\n () => {}\n )\n }\n }, [])\n const prepareFileShare = useCallback(async (id: string) => {\n const guard = guards.current.get(id)\n if (guard) {\n await guard()\n pendingFlushes.current.delete(id)\n } else await pendingFlushes.current.get(id)\n }, [])\n const {\n client,\n deploymentDomain,\n user,\n notify,\n openDocument,\n onDocumentsChanged,\n uploadDocument,\n saveFile,\n emailDocument,\n certificateUrl,\n } = env\n const value = useMemo<ResolvedDocumentToolsEnvironment>(\n () => ({\n client,\n prepareFileShare,\n registerBeforeFileShare,\n deploymentDomain: deploymentDomain ?? arbiDeploymentDomain,\n user,\n openDocument,\n onDocumentsChanged,\n emailDocument,\n notify: notify ?? (() => {}),\n saveFile: saveFile ?? downloadBlob,\n uploadDocument: uploadDocument ?? clientUpload(client),\n certificateUrl,\n }),\n [\n client,\n prepareFileShare,\n registerBeforeFileShare,\n deploymentDomain,\n arbiDeploymentDomain,\n user,\n notify,\n openDocument,\n onDocumentsChanged,\n uploadDocument,\n saveFile,\n emailDocument,\n certificateUrl,\n ]\n )\n return <DocumentToolsContext.Provider value={value}>{children}</DocumentToolsContext.Provider>\n}\n\n/** The host's environment, or `null` outside a `<DocumentToolsProvider>`. */\nexport function useOptionalDocumentTools(): ResolvedDocumentToolsEnvironment | null {\n return useContext(DocumentToolsContext)\n}\n\n/** The host's environment; throws outside a `<DocumentToolsProvider>`. */\nexport function useDocumentTools(): ResolvedDocumentToolsEnvironment {\n const env = useContext(DocumentToolsContext)\n if (!env) throw new Error('The document tools must be used within a <DocumentToolsProvider>')\n return env\n}\n","/**\n * A document's bytes, through the host's API client: the PDF the viewer and the tools draw on\n * (`/view`: the file itself for a PDF, its PDF rendering for a Word or text file) and the stored\n * file (`/download`). Either takes a document id or a version reference `doc-…@v{n}`.\n */\n\nimport { parseVersionRef } from '../artifacts/versions'\nimport type { DocumentToolsClient } from './environment'\n\nexport interface DocumentFetchOptions {\n /** The version to fetch. Default: the one `documentRef` names, else the current version. */\n version?: number | null\n workspaceExtId?: string\n signal?: AbortSignal\n}\n\n/** A document's bytes could not be fetched; `status` is the HTTP status. */\nexport class DocumentFetchError extends Error {\n readonly status: number\n constructor(message: string, status: number) {\n super(message)\n this.name = 'DocumentFetchError'\n this.status = status\n }\n}\n\nasync function fetchDocumentBytes(\n client: DocumentToolsClient,\n endpoint: '/v1/document/{document_ext_id}/view' | '/v1/document/{document_ext_id}/download',\n documentRef: string,\n options: DocumentFetchOptions,\n headers: Record<string, string>,\n what: string\n): Promise<{ blob: Blob; response: Response }> {\n const ref = parseVersionRef(documentRef)\n const version = options.version ?? ref.version\n const { data, response } = await client.GET(endpoint, {\n params: {\n path: { document_ext_id: ref.docId },\n query: {\n ...(version ? { version } : {}),\n ...(options.workspaceExtId ? { workspace_ext_id: options.workspaceExtId } : {}),\n },\n },\n headers,\n parseAs: 'blob',\n signal: options.signal,\n })\n if (!response.ok || !(data instanceof Blob)) {\n throw new DocumentFetchError(\n `${what} could not be loaded (${response.status})`,\n response.status\n )\n }\n return { blob: data, response }\n}\n\n/**\n * The file name a `Content-Disposition` header gives, or `undefined`. Prefers the RFC 5987\n * `filename*=UTF-8''…` form (percent-encoded, any script) over the plain `filename=`.\n */\nexport function contentDispositionFileName(header: string | null | undefined): string | undefined {\n if (!header) return undefined\n const extended = /filename\\*\\s*=\\s*(?:[\\w-]+)?'[^']*'([^;]+)/i.exec(header)\n if (extended) {\n try {\n return decodeURIComponent(extended[1].trim().replace(/^\"|\"$/g, '')) || undefined\n } catch {\n // A malformed escape: fall back to the plain parameter.\n }\n }\n const plain = /filename\\s*=\\s*(\"((?:[^\"\\\\]|\\\\.)*)\"|[^;]+)/i.exec(header)\n if (!plain) return undefined\n const name = plain[2] !== undefined ? plain[2].replace(/\\\\(.)/g, '$1') : plain[1].trim()\n return name || undefined\n}\n\n/**\n * The PDF of a document version: `GET /v1/document/{id}/view?version=` with\n * `Accept: application/pdf`. Throws a {@link DocumentFetchError} when there is none (yet).\n */\nexport async function fetchDocumentPdf(\n client: DocumentToolsClient,\n documentRef: string,\n options: DocumentFetchOptions = {}\n): Promise<Blob> {\n const { blob } = await fetchDocumentBytes(\n client,\n '/v1/document/{document_ext_id}/view',\n documentRef,\n options,\n { Accept: 'application/pdf' },\n 'The PDF'\n )\n return blob\n}\n\n/**\n * The stored file of a document version, as uploaded: `GET /v1/document/{id}/download`. When the\n * server names the file (`Content-Disposition`), the result is a `File` carrying that name.\n */\nexport async function fetchDocumentFile(\n client: DocumentToolsClient,\n documentRef: string,\n options: DocumentFetchOptions = {}\n): Promise<Blob | File> {\n const { blob, response } = await fetchDocumentBytes(\n client,\n '/v1/document/{document_ext_id}/download',\n documentRef,\n options,\n {},\n 'The file'\n )\n const name = contentDispositionFileName(response.headers.get('Content-Disposition'))\n return name ? new File([blob], name, { type: blob.type }) : blob\n}\n","/**\n * \"Download with markup\": a document version's markup PDF, the PDF with its annotations as native\n * PDF annotations (comments, highlights, stamps, unapplied redactions), which Acrobat and Preview\n * show. The plain Download serves the original. Kept apart from the annotation layer code so a\n * documents list can offer it without loading the annotation tools.\n *\n * A SIGNED version is locked: nothing but a further signature changes it. Its markup stays in the\n * separate markup layer (a title beside the signature, say) and is never written into its PDF, so\n * it has no \"Download with markup\"; the plain Download is the signed file as it is.\n */\n\nimport type { DocumentToolsClient } from './environment'\n\ninterface DocumentVersions {\n current_version?: number | null\n versions?: Array<{ n: number; markup_count?: number | null; reason?: string | null }> | null\n}\n\n/** Why \"Download with markup\" is off for a signed version. */\nexport const SIGNED_LOCKED_REASON =\n \"Signed documents can't be changed — download the signed file instead\"\n\n/** Whether a version (default: the current one) is a signed copy, per its version entry. */\nexport function isSignedVersion(doc: DocumentVersions, version?: number): boolean {\n const n = version ?? doc.current_version ?? 1\n return (doc.versions ?? []).some((v) => v.n === n && v.reason === 'signed')\n}\n\nexport class MarkupDownloadError extends Error {\n constructor(\n message: string,\n readonly status?: number\n ) {\n super(message)\n this.name = 'MarkupDownloadError'\n }\n}\n\n/** Whether a document's current version has markup (per its version entries). */\nexport function currentHasMarkup(doc: DocumentVersions): boolean {\n const n = doc.current_version ?? 1\n return (doc.versions ?? []).some((v) => v.n === n && (v.markup_count ?? 0) > 0)\n}\n\n/** Fetch a version's markup PDF (default: the current version's). */\nexport async function fetchMarkupPdf(\n client: DocumentToolsClient,\n documentId: string,\n version?: number,\n workspaceExtId?: string\n): Promise<{ blob: Blob; fileName: string }> {\n const { data, response } = await client.GET('/v1/document/{document_ext_id}/markup/pdf', {\n params: {\n path: { document_ext_id: documentId },\n query: {\n ...(version ? { version } : {}),\n ...(workspaceExtId ? { workspace_ext_id: workspaceExtId } : {}),\n },\n },\n parseAs: 'blob',\n })\n if (!response.ok || !data) {\n throw new MarkupDownloadError(\n response.status === 404\n ? 'This document has no markup yet'\n : // The server refuses a signed version: its PDF takes no more changes.\n response.status === 409\n ? SIGNED_LOCKED_REASON\n : 'The markup could not be downloaded',\n response.status\n )\n }\n const disposition = response.headers.get('content-disposition') ?? ''\n const utf8 = /filename\\*=UTF-8''([^;]+)/i.exec(disposition)?.[1]\n const plain = /filename=\"([^\"]+)\"/i.exec(disposition)?.[1]\n const fileName = utf8 ? decodeURIComponent(utf8) : (plain ?? 'markup.pdf')\n return { blob: data as Blob, fileName }\n}\n","/**\n * Electronic signing. The backend (`src/core/esign.py` in ARBI) defines what a signature binds;\n * the helpers mirror the two pieces the browser must reproduce exactly: the statement of intent\n * shown to the signer, and the SHA-256 of the PDF the viewer displayed.\n */\n\nimport { signMessage, unlockIdentityWithPassword, type components } from '@arbidocs/client'\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport { parseVersionRef } from '../artifacts/versions'\nimport { useDocumentTools, type DocumentToolsClient } from './environment'\nimport { arbiQueryKeys } from '../query-keys'\n\n/**\n * Who signs: the name only. A role, a firm or a place go on the page as ordinary annotation text,\n * which is not part of the signature.\n */\nexport type SignerDetails = components['schemas']['SignerDetails']\n\n/** Same sentence as `esign.intent_text`; the dialog refuses to sign if the server's differs. */\nexport function intentText(signer: SignerDetails): string {\n return `I, ${signer.name.trim()}, sign this document electronically. I intend this electronic signature to have the same effect as my handwritten signature.`\n}\n\nexport async function sha256Hex(blob: Blob): Promise<string> {\n const digest = await crypto.subtle.digest('SHA-256', new Uint8Array(await blob.arrayBuffer()))\n return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, '0')).join('')\n}\n\n/** A signature box drawn on the annotation overlay, as the signing API's placement. */\nexport function toAppearance(box: {\n page: number\n rect: { x: number; y: number; w: number; h: number }\n}): { page: number; x: number; y: number; width: number; height: number } {\n // The layer counts pages from 1, the signing API from 0. Both use fractions of the page as\n // displayed, origin top-left.\n return { page: box.page - 1, x: box.rect.x, y: box.rect.y, width: box.rect.w, height: box.rect.h }\n}\n\n/**\n * The smallest box the backend can draw a legible signature in: the signer's name and the\n * details line shrink to fit, so a box under these fractions of the page is shrunk to near\n * unreadable size. The backend's own default box is 0.40 x 0.10.\n */\nconst MIN_SIGNATURE_BOX = { width: 0.3, height: 0.07 }\n\nexport function isLegibleSignatureBox(rect: { w: number; h: number }): boolean {\n return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height\n}\n\n// ── Signing through the API ─────────────────────────────────────────────────────────────────\n\nexport type SignatureAppearance = components['schemas']['SignatureAppearance']\nexport type SignatureStatusResponse = components['schemas']['SignatureStatusResponse']\nexport type SignatureRecord = components['schemas']['SignatureRecord']\nexport type SignDocumentResponse = components['schemas']['SignDocumentResponse']\n\nconst SIGNATURES_PATH = '/v1/document/{document_ext_id}/signatures'\n/**\n * The same key openapi-react-query gives this request (`['get', path, init]`), so a host that\n * reads or persists the API cache by path treats it like its own queries.\n */\n\nfunction errorDetail(error: unknown, fallback: string): string {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n return typeof detail === 'string' ? detail : fallback\n}\n\n/** Whether a document version is a signed copy, and its signatures. */\nexport async function fetchDocumentSignatures(\n client: DocumentToolsClient,\n documentRef: string\n): Promise<SignatureStatusResponse> {\n const { docId, version } = parseVersionRef(documentRef)\n const { data, error } = await client.GET(SIGNATURES_PATH, {\n params: { path: { document_ext_id: docId }, ...(version ? { query: { version } } : {}) },\n })\n if (!data) throw new Error(errorDetail(error, 'The signatures could not be read'))\n return data\n}\n\n/**\n * Is a document version a signed copy? `documentId` is a document id (its current version) or a\n * version reference `doc-…@v{n}`. Needs a React Query `QueryClientProvider`.\n */\nexport function useDocumentSignatures(documentId: string | null | undefined, enabled = true) {\n const { client } = useDocumentTools()\n const { docId, version } = parseVersionRef(documentId)\n return useQuery({\n queryKey: arbiQueryKeys.documentSignatures(docId ?? '', version),\n queryFn: () => fetchDocumentSignatures(client, documentId!),\n enabled: enabled && !!docId,\n staleTime: 60_000,\n })\n}\n\n/**\n * Why the server would not sign: the PDF of a Word or text document is still being rendered\n * (`preparing`, worth another try in a moment), or the version on screen is no longer the current\n * one (`stale`: only the current version can be signed, so the signer reopens it).\n */\nexport type SigningErrorReason = 'preparing' | 'stale' | 'failed'\n\nexport class SigningError extends Error {\n readonly reason: SigningErrorReason\n constructor(message: string, reason: SigningErrorReason) {\n super(message)\n this.name = 'SigningError'\n this.reason = reason\n }\n}\n\n/** The 409s the backend's signing router raises, told apart by their wording. */\nfunction signingErrorReason(detail: string): SigningErrorReason {\n if (/still being prepared/i.test(detail)) return 'preparing'\n if (/no longer the current version/i.test(detail)) return 'stale'\n return 'failed'\n}\n\nfunction signingError(error: unknown, fallback: string): SigningError {\n const detail = errorDetail(error, fallback)\n return new SigningError(detail, signingErrorReason(detail))\n}\n\n/** How often, and how long apart, a prepare is retried while the PDF is still being rendered. */\nexport const PREPARE_RETRIES = 3\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\nexport interface SignDocumentVars {\n documentId: string\n /**\n * The PDF bytes the viewer is showing (`GET /view?version=`, never the original's download): the\n * signer signs exactly these.\n */\n pdfBlob: Blob\n /**\n * The version `pdfBlob` is of. The server signs only the current version and refuses\n * (`SigningError` `stale`) when this one has been superseded. Omitted = the current version.\n */\n version?: number\n email: string\n password: string\n signer: SignerDetails\n /** Where the signature goes; omitted = the backend default (bottom of the last page). */\n appearance?: SignatureAppearance\n /** Draw the signing date under the signature. Default off: only the signature is drawn. */\n includeDate?: boolean\n}\n\n/**\n * Sign a document: the server prepares the statement, the browser checks that it covers the PDF\n * on screen under the wording the signer read, re-derives the user's Ed25519 key from their\n * password and signs it, and the server seals the signed copy as a new version.\n *\n * What is drawn on the page is only the signature (the signer's name as the signature mark) and,\n * with `includeDate`, the date; anyone can click it to open its certificate. A role, a firm or a\n * place go on the page as ordinary annotation text, which is not part of the signature.\n */\nexport async function signDocument(\n client: DocumentToolsClient,\n deploymentDomain: string,\n {\n documentId,\n pdfBlob,\n email,\n password,\n signer,\n appearance,\n includeDate = false,\n version,\n }: SignDocumentVars\n): Promise<SignDocumentResponse> {\n const path = { document_ext_id: documentId }\n // One body for both calls: the server refuses a /sign whose include_date (or placement) differs\n // from what was prepared, since what the signature shows is part of what is signed.\n const body = {\n signer: { name: signer.name },\n ...(appearance ? { appearance } : {}),\n include_date: includeDate,\n ...(version ? { version } : {}),\n }\n\n // A Word or text document's PDF is rendered after upload: while it is, prepare says so, and a\n // short wait usually sees it ready.\n const prepare = () =>\n client.POST('/v1/document/{document_ext_id}/sign/prepare', { params: { path }, body })\n let prepared = await prepare()\n for (let attempt = 0; !prepared.data && attempt < PREPARE_RETRIES; attempt++) {\n if (signingError(prepared.error, '').reason !== 'preparing') break\n await wait(PREPARE_RETRY_DELAY_MS)\n prepared = await prepare()\n }\n if (!prepared.data) throw signingError(prepared.error, 'Could not prepare signing')\n const { statement, intent, source_sha256, timestamp } = prepared.data\n // Sign only what was on screen, under the wording the signer read.\n if ((await sha256Hex(pdfBlob)) !== source_sha256) {\n throw new Error('The document changed since it was opened. Reopen it and sign again.')\n }\n if (intent !== intentText(signer)) throw new Error('Signing statement mismatch; not signed.')\n\n // The re-typed password must open the session's identity, which is the key the server verifies.\n const identity = await unlockIdentityWithPassword(email, password, deploymentDomain)\n const signed = await client.POST('/v1/document/{document_ext_id}/sign', {\n params: { path },\n body: { ...body, timestamp, signature: signMessage(statement, identity) },\n })\n if (!signed.data) throw signingError(signed.error, 'Signing failed')\n return signed.data\n}\n\n/** The signing mutation. On success the host hears the document changed (`'signed'`). */\nexport function useSignDocument() {\n const env = useDocumentTools()\n const queryClient = useQueryClient()\n return useMutation({\n mutationFn: (vars: SignDocumentVars) => {\n if (!env.deploymentDomain) throw new Error('Signing is not set up: no deployment domain')\n return signDocument(env.client, env.deploymentDomain, vars)\n },\n onSuccess: async (result) => {\n // The signed copy is the document's new current version: the host refreshes its row,\n // versions and rendered PDF, and the signature badge reads again.\n await env.onDocumentsChanged?.([result.doc_ext_id], 'signed')\n await queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documentSignatures() })\n },\n })\n}\n","import { useCallback } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { arbiQueryKeys } from '../query-keys'\n/** Share one immutable file version with named recipients, independently of workspace membership. */\nimport { signMessage, unlockIdentityWithPassword, type components } from '@arbidocs/client'\nimport type { DocumentToolsClient } from './environment'\nimport { intentText, sha256Hex } from './signing'\nimport type {\n SignatureRequest,\n SignRequestVars,\n SignRequestSignResponse,\n} from './signature-requests'\n\nexport type FileShare = components['schemas']['FileShareResponse']\nexport type CreateFileShare = components['schemas']['CreateFileShare']\n\nfunction failure(error: unknown): Error {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n return new Error(typeof detail === 'string' ? detail : 'The shared file request failed')\n}\n\nexport async function createFileShare(\n client: DocumentToolsClient,\n documentId: string,\n body: CreateFileShare\n) {\n const result = await client.POST('/v1/document/{document_ext_id}/file-shares', {\n params: { path: { document_ext_id: documentId } },\n body,\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\nexport async function getFileShare(client: DocumentToolsClient, id: string): Promise<FileShare> {\n const result = await client.GET('/v1/file-shares/{share_id}', {\n params: { path: { share_id: id } },\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\nexport async function fileShareBytes(\n client: DocumentToolsClient,\n id: string,\n kind: 'view' | 'original' | 'signed'\n) {\n const result = await client.GET('/v1/file-shares/{share_id}/file', {\n params: { path: { share_id: id }, query: { kind } },\n parseAs: 'blob',\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\n/** Adapt only the guided viewer's presentation data; sharing uses its own authorization endpoints. */\nexport function fileShareSigningRequest(share: FileShare): SignatureRequest {\n return {\n external_id: share.external_id,\n doc_ext_id: share.document_ext_id,\n version: share.version,\n source_sha256: share.source_sha256,\n fields: share.fields,\n message: share.message,\n status:\n share.status === 'signing' ? 'sent' : share.status === 'completed' ? 'completed' : 'voided',\n signers: share.recipients\n .filter((r) => r.permission === 'sign')\n .map((r) => ({\n external_id: r.email,\n email: r.email,\n name: r.email,\n status: r.status === 'signed' ? 'signed' : 'pending',\n progress: r.status === 'signed' ? 'signed' : 'registered',\n fields: share.fields.filter((f) => f.signer === r.email).length,\n })),\n created_at: new Date(0).toISOString(),\n stale: false,\n }\n}\n\nexport async function signFileShare(\n client: DocumentToolsClient,\n domain: string,\n vars: SignRequestVars\n): Promise<SignRequestSignResponse> {\n const path = { share_id: vars.request.external_id }\n const body = { adopted: vars.adopted, fields: vars.fields }\n const prepared = await client.POST('/v1/file-shares/{share_id}/sign/prepare', {\n params: { path },\n body,\n })\n if (!prepared.data) throw failure(prepared.error)\n const { statement, timestamp, source_sha256, intent } = prepared.data\n if (\n source_sha256 !== vars.request.source_sha256 ||\n (await sha256Hex(vars.pdfBlob)) !== source_sha256\n )\n throw new Error('The shared file changed. Ask the sender for a new request.')\n if (intent !== intentText({ name: vars.adopted.name }))\n throw new Error('Signing statement mismatch')\n const identity = await unlockIdentityWithPassword(vars.email, vars.password, domain)\n const result = await client.POST('/v1/file-shares/{share_id}/sign', {\n params: { path },\n body: { ...body, timestamp, signature: signMessage(statement, identity) },\n })\n if (!result.data) throw failure(result.error)\n return {\n request: fileShareSigningRequest(result.data),\n completed: result.data.status === 'completed',\n }\n}\n\nexport function useFileShare(client: DocumentToolsClient, shareId: string, signing: boolean) {\n return useQuery({\n queryKey: arbiQueryKeys.fileShare(shareId),\n queryFn: () => getFileShare(client, shareId),\n refetchInterval: signing ? false : 5000,\n })\n}\n\nexport function useFileSharePdf(client: DocumentToolsClient, shareId: string, share?: FileShare) {\n return useQuery({\n queryKey: arbiQueryKeys.fileSharePdf(shareId, share?.status),\n queryFn: () =>\n fileShareBytes(client, shareId, share?.status === 'completed' ? 'signed' : 'view'),\n enabled: !!share?.can_preview,\n staleTime: Infinity,\n })\n}\n\n/** The shares I created or was invited to (revoked and expired ones are not listed). Listing does\n * not open a share, so it never starts a recipient's access window. Null client: not loaded. */\nexport function useFileShares(client: DocumentToolsClient | null) {\n return useQuery({\n queryKey: arbiQueryKeys.fileShares(),\n queryFn: async () => {\n const result = await client?.GET('/v1/file-shares')\n if (!result?.data) throw new Error('Could not load shared files')\n return result.data\n },\n enabled: !!client,\n })\n}\n\n/** Read the share list again (after a change made to a share: signed, declined, saved, revoked). */\nexport function useRefreshFileShares(): () => Promise<void> {\n const queryClient = useQueryClient()\n return useCallback(\n () => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.fileShares() }),\n [queryClient]\n )\n}\n\n/**\n * Save a completed share's signed PDF as its document's next version, in the share's workspace\n * (its key must be on the session: open that workspace first).\n */\nexport async function publishFileShare(client: DocumentToolsClient, share: FileShare) {\n const result = await client.POST(\n '/v1/document/{document_ext_id}/file-shares/{share_id}/publish',\n { params: { path: { document_ext_id: share.document_ext_id, share_id: share.external_id } } }\n )\n if (!result.data) throw new Error('Could not save the signed version to its workspace')\n return result.data\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/document-tools/environment.tsx","../src/document-tools/document-pdf.ts","../src/document-tools/markup-download.ts","../src/document-tools/signing.ts","../src/document-tools/file-shares.ts"],"names":["createContext","useDeploymentDomain","useRef","useCallback","useMemo","jsx","useContext","parseVersionRef","useQuery","arbiQueryKeys","client","unlockIdentityWithPassword","signMessage","useQueryClient","useMutation"],"mappings":";;;;;;;;;AAmEO,SAAS,kBAAkB,KAAA,EAAoC;AACpE,EAAA,MAAM,MAAA,GAAS,IAAI,eAAA,EAAgB;AACnC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AAC3C,IAAA,KAAA,MAAW,IAA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IAAA,EAAM,MAAM,IAAI,MAAM,oDAAoD,CAAA;AACtF,EAAA,OAAO,MAAA,CAAO,IAAA;AAChB","file":"chunk-4LFADBRL.cjs","sourcesContent":["/**\n * The host app's side of the document tools (markup, freeze, e-signing, versions): the one place\n * the tools reach the app. They never import a store, a router, a toast library or app API code;\n * the host passes what it has to `<DocumentToolsProvider>` and every optional field has a default.\n *\n * `client` is an openapi-fetch client for the ARBI API (`ArbiClient['fetch']` from\n * `@arbidocs/client`, or `arbi.getClient().fetch` from an `@arbidocs/sdk` `Arbi`), signed in with the\n * user's session; it carries the auth.\n */\n\nimport { createContext, useCallback, useContext, useMemo, useRef, type ReactNode } from 'react'\nimport type { ArbiClient, operations } from '@arbidocs/client'\nimport { useDeploymentDomain } from '../useArbi'\n\nexport type DocumentToolsClient = ArbiClient['fetch']\n\nexport type DocumentToolsNoticeKind = 'success' | 'error' | 'info' | 'warning'\n\nexport interface DocumentToolsNoticeOptions {\n /** A second line under the message. */\n description?: string\n /** One action button on the notice (\"Email it\"). */\n action?: { label: string; onClick: () => void }\n}\n\nexport type DocumentToolsNotify = (\n message: string,\n kind: DocumentToolsNoticeKind,\n options?: DocumentToolsNoticeOptions\n) => void\n\nexport interface DocumentToolsUser {\n /** The name marks are authored as and the signer's name is prefilled with. */\n name: string\n /** The sign-in email: signing re-derives the user's key from it and the password. */\n email?: string | null\n /** The user's id (usr-*): which fields of a signature request are theirs. */\n externalId?: string | null\n}\n\n/** What changed about a document, so the host can refresh its own lists and caches. */\nexport type DocumentChange =\n /** A version's markup got its first mark or lost its last one. */\n | 'markup'\n /** A signature was added: the document has a new current version. */\n | 'signed'\n /** A new document was made from it (a frozen copy). The ids are the NEW documents. */\n | 'copy'\n /** A new version was saved (the Word editor's Save version): the document's current version. */\n | 'version'\n\n/**\n * The `/v1/document/upload` query, typed from the API schema: `derived_from` is a list (a\n * production set is derived from every document in it), `shared` a boolean.\n */\nexport type DocumentUploadQuery = NonNullable<operations['upload_documents']['parameters']['query']>\n\nexport interface DocumentUploadRequest {\n file: File\n /** `/v1/document/upload` query: `derived_from`, `derived_role`, `shared`, `folder`. */\n query: DocumentUploadQuery\n}\n\n/**\n * The upload query as a URL query string, for a host that posts the upload itself (an XHR with\n * progress): a list repeats its key (`derived_from=a&derived_from=b`), empty values are left out.\n */\nexport function uploadQueryString(query: DocumentUploadQuery): string {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined) continue\n for (const item of Array.isArray(value) ? value : [value]) params.append(key, String(item))\n }\n return params.toString()\n}\n\nexport interface DocumentToolsEnvironment {\n client: DocumentToolsClient\n /**\n * The deployment domain the user's keys are derived for. Needed for signing. Default: the one\n * the host's `Arbi` computes (`arbi.getDeploymentDomain()`), if any.\n */\n deploymentDomain?: string\n /** The signed-in user; marks are authored as \"You\" without one, and signing is unavailable. */\n user?: DocumentToolsUser | null\n /** Surface a transient message. Default: none (errors still show inline where they can). */\n notify?: DocumentToolsNotify\n /** Open a document or a version reference (`doc-…@v2`): the copy just made, the signed copy. */\n openDocument?: (documentRef: string) => void\n /**\n * Documents changed on the server (see {@link DocumentChange}); refresh the host's lists. The\n * tools wait for it before opening the document, so a copy is listed when it opens.\n */\n onDocumentsChanged?: (documentIds: string[], change: DocumentChange) => void | Promise<void>\n /** Upload a derived copy. Default: `POST /v1/document/upload` through `client`. */\n uploadDocument?: (\n request: DocumentUploadRequest\n ) => Promise<{ doc_ext_ids?: string[] } | undefined>\n /** Save a file to the user's computer. Default: a temporary download link. */\n saveFile?: (blob: Blob, fileName: string) => void\n /** Email a document (offered once it is signed). Omitted: no \"Email it\". */\n emailDocument?: (documentRef: string) => void\n /**\n * The public page that checks a signature (the certificate) in this app. When given, \"View\n * certificate\" opens it in preference to the backend's `certificate_url` (which is on the\n * deployment domain, like the link embedded in the signed PDF). Without it: the backend's\n * `certificate_url`, else `/verify/{reference}` on this origin.\n */\n certificateUrl?: (reference: string) => string\n}\n\n/** The environment with every default filled in. */\nexport interface ResolvedDocumentToolsEnvironment extends DocumentToolsEnvironment {\n prepareFileShare: (documentId: string) => Promise<void>\n registerBeforeFileShare: (documentId: string, flush: () => Promise<void>) => () => void\n notify: DocumentToolsNotify\n saveFile: (blob: Blob, fileName: string) => void\n uploadDocument: (\n request: DocumentUploadRequest\n ) => Promise<{ doc_ext_ids?: string[] } | undefined>\n}\n\n/**\n * Save a blob through a temporary `<a download>`. The object URL is revoked a minute later, not at\n * once: revoking straight after `click()` can cancel the download (Safari, and large files\n * elsewhere) before the browser has read the blob.\n */\nexport function downloadBlob(blob: Blob, fileName: string): void {\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = fileName\n document.body.appendChild(a)\n a.click()\n a.remove()\n setTimeout(() => URL.revokeObjectURL(url), 60_000)\n}\n\n/** The default upload: multipart `files` to `/v1/document/upload` through the API client. */\nexport function clientUpload(client: DocumentToolsClient) {\n return async ({ file, query }: DocumentUploadRequest) => {\n const formData = new FormData()\n formData.append('files', file)\n const { data, response } = await client.POST('/v1/document/upload', {\n params: { query },\n // The schema types the multipart body as `{ files: string[] }`; the FormData is sent as is.\n body: formData as unknown as { files: string[] },\n bodySerializer: () => formData,\n })\n if (!response.ok) throw new Error(`Upload failed with status ${response.status}`)\n return data\n }\n}\n\nexport function defaultCertificateUrl(reference: string): string {\n const origin = typeof location === 'undefined' ? '' : location.origin\n return `${origin}/verify/${encodeURIComponent(reference)}`\n}\n\n/**\n * Where \"View certificate\" goes for a signature: the host's `certificateUrl(reference)` when it\n * gives one, else the `certificate_url` the backend returned, else `/verify/{reference}` here.\n */\nexport function certificateLink(\n signature: { reference: string; certificate_url?: string | null },\n certificateUrl?: (reference: string) => string\n): string {\n if (certificateUrl) return certificateUrl(signature.reference)\n return signature.certificate_url || defaultCertificateUrl(signature.reference)\n}\n\nconst DocumentToolsContext = createContext<ResolvedDocumentToolsEnvironment | null>(null)\n\nexport interface DocumentToolsProviderProps extends DocumentToolsEnvironment {\n children: ReactNode\n}\n\nexport function DocumentToolsProvider({ children, ...env }: DocumentToolsProviderProps) {\n const arbiDeploymentDomain = useDeploymentDomain()\n const guards = useRef(new Map<string, () => Promise<void>>())\n const pendingFlushes = useRef(new Map<string, Promise<void>>())\n const registerBeforeFileShare = useCallback((id: string, flush: () => Promise<void>) => {\n guards.current.set(id, flush)\n return () => {\n if (guards.current.get(id) !== flush) return\n guards.current.delete(id)\n const pending = flush()\n pendingFlushes.current.set(id, pending)\n void pending.then(\n () => {\n if (pendingFlushes.current.get(id) === pending) pendingFlushes.current.delete(id)\n },\n () => {}\n )\n }\n }, [])\n const prepareFileShare = useCallback(async (id: string) => {\n const guard = guards.current.get(id)\n if (guard) {\n await guard()\n pendingFlushes.current.delete(id)\n } else await pendingFlushes.current.get(id)\n }, [])\n const {\n client,\n deploymentDomain,\n user,\n notify,\n openDocument,\n onDocumentsChanged,\n uploadDocument,\n saveFile,\n emailDocument,\n certificateUrl,\n } = env\n const value = useMemo<ResolvedDocumentToolsEnvironment>(\n () => ({\n client,\n prepareFileShare,\n registerBeforeFileShare,\n deploymentDomain: deploymentDomain ?? arbiDeploymentDomain,\n user,\n openDocument,\n onDocumentsChanged,\n emailDocument,\n notify: notify ?? (() => {}),\n saveFile: saveFile ?? downloadBlob,\n uploadDocument: uploadDocument ?? clientUpload(client),\n certificateUrl,\n }),\n [\n client,\n prepareFileShare,\n registerBeforeFileShare,\n deploymentDomain,\n arbiDeploymentDomain,\n user,\n notify,\n openDocument,\n onDocumentsChanged,\n uploadDocument,\n saveFile,\n emailDocument,\n certificateUrl,\n ]\n )\n return <DocumentToolsContext.Provider value={value}>{children}</DocumentToolsContext.Provider>\n}\n\n/** The host's environment, or `null` outside a `<DocumentToolsProvider>`. */\nexport function useOptionalDocumentTools(): ResolvedDocumentToolsEnvironment | null {\n return useContext(DocumentToolsContext)\n}\n\n/** The host's environment; throws outside a `<DocumentToolsProvider>`. */\nexport function useDocumentTools(): ResolvedDocumentToolsEnvironment {\n const env = useContext(DocumentToolsContext)\n if (!env) throw new Error('The document tools must be used within a <DocumentToolsProvider>')\n return env\n}\n","/**\n * A document's bytes, through the host's API client: the PDF the viewer and the tools draw on\n * (`/view`: the file itself for a PDF, its PDF rendering for a Word or text file) and the stored\n * file (`/download`). Either takes a document id or a version reference `doc-…@v{n}`.\n */\n\nimport { parseVersionRef } from '../artifacts/versions'\nimport type { DocumentToolsClient } from './environment'\n\nexport interface DocumentFetchOptions {\n /** The version to fetch. Default: the one `documentRef` names, else the current version. */\n version?: number | null\n workspaceExtId?: string\n signal?: AbortSignal\n}\n\n/** A document's bytes could not be fetched; `status` is the HTTP status. */\nexport class DocumentFetchError extends Error {\n readonly status: number\n constructor(message: string, status: number) {\n super(message)\n this.name = 'DocumentFetchError'\n this.status = status\n }\n}\n\nasync function fetchDocumentBytes(\n client: DocumentToolsClient,\n endpoint: '/v1/document/{document_ext_id}/view' | '/v1/document/{document_ext_id}/download',\n documentRef: string,\n options: DocumentFetchOptions,\n headers: Record<string, string>,\n what: string\n): Promise<{ blob: Blob; response: Response }> {\n const ref = parseVersionRef(documentRef)\n const version = options.version ?? ref.version\n const { data, response } = await client.GET(endpoint, {\n params: {\n path: { document_ext_id: ref.docId },\n query: {\n ...(version ? { version } : {}),\n ...(options.workspaceExtId ? { workspace_ext_id: options.workspaceExtId } : {}),\n },\n },\n headers,\n parseAs: 'blob',\n signal: options.signal,\n })\n if (!response.ok || !(data instanceof Blob)) {\n throw new DocumentFetchError(\n `${what} could not be loaded (${response.status})`,\n response.status\n )\n }\n return { blob: data, response }\n}\n\n/**\n * The file name a `Content-Disposition` header gives, or `undefined`. Prefers the RFC 5987\n * `filename*=UTF-8''…` form (percent-encoded, any script) over the plain `filename=`.\n */\nexport function contentDispositionFileName(header: string | null | undefined): string | undefined {\n if (!header) return undefined\n const extended = /filename\\*\\s*=\\s*(?:[\\w-]+)?'[^']*'([^;]+)/i.exec(header)\n if (extended) {\n try {\n return decodeURIComponent(extended[1].trim().replace(/^\"|\"$/g, '')) || undefined\n } catch {\n // A malformed escape: fall back to the plain parameter.\n }\n }\n const plain = /filename\\s*=\\s*(\"((?:[^\"\\\\]|\\\\.)*)\"|[^;]+)/i.exec(header)\n if (!plain) return undefined\n const name = plain[2] !== undefined ? plain[2].replace(/\\\\(.)/g, '$1') : plain[1].trim()\n return name || undefined\n}\n\n/**\n * The PDF of a document version: `GET /v1/document/{id}/view?version=` with\n * `Accept: application/pdf`. Throws a {@link DocumentFetchError} when there is none (yet).\n */\nexport async function fetchDocumentPdf(\n client: DocumentToolsClient,\n documentRef: string,\n options: DocumentFetchOptions = {}\n): Promise<Blob> {\n const { blob } = await fetchDocumentBytes(\n client,\n '/v1/document/{document_ext_id}/view',\n documentRef,\n options,\n { Accept: 'application/pdf' },\n 'The PDF'\n )\n return blob\n}\n\n/**\n * The stored file of a document version, as uploaded: `GET /v1/document/{id}/download`. When the\n * server names the file (`Content-Disposition`), the result is a `File` carrying that name.\n */\nexport async function fetchDocumentFile(\n client: DocumentToolsClient,\n documentRef: string,\n options: DocumentFetchOptions = {}\n): Promise<Blob | File> {\n const { blob, response } = await fetchDocumentBytes(\n client,\n '/v1/document/{document_ext_id}/download',\n documentRef,\n options,\n {},\n 'The file'\n )\n const name = contentDispositionFileName(response.headers.get('Content-Disposition'))\n return name ? new File([blob], name, { type: blob.type }) : blob\n}\n","/**\n * \"Download with markup\": a document version's markup PDF, the PDF with its annotations as native\n * PDF annotations (comments, highlights, stamps, unapplied redactions), which Acrobat and Preview\n * show. The plain Download serves the original. Kept apart from the annotation layer code so a\n * documents list can offer it without loading the annotation tools.\n *\n * A SIGNED version is locked: nothing but a further signature changes it. Its markup stays in the\n * separate markup layer (a title beside the signature, say) and is never written into its PDF, so\n * it has no \"Download with markup\"; the plain Download is the signed file as it is.\n */\n\nimport type { DocumentToolsClient } from './environment'\n\ninterface DocumentVersions {\n current_version?: number | null\n versions?: Array<{ n: number; markup_count?: number | null; reason?: string | null }> | null\n}\n\n/** Why \"Download with markup\" is off for a signed version. */\nexport const SIGNED_LOCKED_REASON =\n \"Signed documents can't be changed — download the signed file instead\"\n\n/** Whether a version (default: the current one) is a signed copy, per its version entry. */\nexport function isSignedVersion(doc: DocumentVersions, version?: number): boolean {\n const n = version ?? doc.current_version ?? 1\n return (doc.versions ?? []).some((v) => v.n === n && v.reason === 'signed')\n}\n\nexport class MarkupDownloadError extends Error {\n constructor(\n message: string,\n readonly status?: number\n ) {\n super(message)\n this.name = 'MarkupDownloadError'\n }\n}\n\n/** Whether a document's current version has markup (per its version entries). */\nexport function currentHasMarkup(doc: DocumentVersions): boolean {\n const n = doc.current_version ?? 1\n return (doc.versions ?? []).some((v) => v.n === n && (v.markup_count ?? 0) > 0)\n}\n\n/** Fetch a version's markup PDF (default: the current version's). */\nexport async function fetchMarkupPdf(\n client: DocumentToolsClient,\n documentId: string,\n version?: number,\n workspaceExtId?: string\n): Promise<{ blob: Blob; fileName: string }> {\n const { data, response } = await client.GET('/v1/document/{document_ext_id}/markup/pdf', {\n params: {\n path: { document_ext_id: documentId },\n query: {\n ...(version ? { version } : {}),\n ...(workspaceExtId ? { workspace_ext_id: workspaceExtId } : {}),\n },\n },\n parseAs: 'blob',\n })\n if (!response.ok || !data) {\n throw new MarkupDownloadError(\n response.status === 404\n ? 'This document has no markup yet'\n : // The server refuses a signed version: its PDF takes no more changes.\n response.status === 409\n ? SIGNED_LOCKED_REASON\n : 'The markup could not be downloaded',\n response.status\n )\n }\n const disposition = response.headers.get('content-disposition') ?? ''\n const utf8 = /filename\\*=UTF-8''([^;]+)/i.exec(disposition)?.[1]\n const plain = /filename=\"([^\"]+)\"/i.exec(disposition)?.[1]\n const fileName = utf8 ? decodeURIComponent(utf8) : (plain ?? 'markup.pdf')\n return { blob: data as Blob, fileName }\n}\n","/**\n * Electronic signing. The backend (`src/core/esign.py` in ARBI) defines what a signature binds;\n * the helpers mirror the two pieces the browser must reproduce exactly: the statement of intent\n * shown to the signer, and the SHA-256 of the PDF the viewer displayed.\n */\n\nimport { signMessage, unlockIdentityWithPassword, type components } from '@arbidocs/client'\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'\nimport { parseVersionRef } from '../artifacts/versions'\nimport { useDocumentTools, type DocumentToolsClient } from './environment'\nimport { arbiQueryKeys } from '../query-keys'\n\n/**\n * Who signs: the name only. A role, a firm or a place go on the page as ordinary annotation text,\n * which is not part of the signature.\n */\nexport type SignerDetails = components['schemas']['SignerDetails']\n\n/** Same sentence as `esign.intent_text`; the dialog refuses to sign if the server's differs. */\nexport function intentText(signer: SignerDetails): string {\n return `I, ${signer.name.trim()}, sign this document electronically. I intend this electronic signature to have the same effect as my handwritten signature.`\n}\n\nexport async function sha256Hex(blob: Blob): Promise<string> {\n const digest = await crypto.subtle.digest('SHA-256', new Uint8Array(await blob.arrayBuffer()))\n return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, '0')).join('')\n}\n\n/** A signature box drawn on the annotation overlay, as the signing API's placement. */\nexport function toAppearance(box: {\n page: number\n rect: { x: number; y: number; w: number; h: number }\n}): { page: number; x: number; y: number; width: number; height: number } {\n // The layer counts pages from 1, the signing API from 0. Both use fractions of the page as\n // displayed, origin top-left.\n return { page: box.page - 1, x: box.rect.x, y: box.rect.y, width: box.rect.w, height: box.rect.h }\n}\n\n/**\n * The smallest box the backend can draw a legible signature in: the signer's name and the\n * details line shrink to fit, so a box under these fractions of the page is shrunk to near\n * unreadable size. The backend's own default box is 0.40 x 0.10.\n */\nconst MIN_SIGNATURE_BOX = { width: 0.3, height: 0.07 }\n\nexport function isLegibleSignatureBox(rect: { w: number; h: number }): boolean {\n return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height\n}\n\n// ── Signing through the API ─────────────────────────────────────────────────────────────────\n\nexport type SignatureAppearance = components['schemas']['SignatureAppearance']\nexport type SignatureStatusResponse = components['schemas']['SignatureStatusResponse']\nexport type SignatureRecord = components['schemas']['SignatureRecord']\nexport type SignDocumentResponse = components['schemas']['SignDocumentResponse']\n\nconst SIGNATURES_PATH = '/v1/document/{document_ext_id}/signatures'\n/**\n * The same key openapi-react-query gives this request (`['get', path, init]`), so a host that\n * reads or persists the API cache by path treats it like its own queries.\n */\n\nfunction errorDetail(error: unknown, fallback: string): string {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n return typeof detail === 'string' ? detail : fallback\n}\n\n/** Whether a document version is a signed copy, and its signatures. */\nexport async function fetchDocumentSignatures(\n client: DocumentToolsClient,\n documentRef: string\n): Promise<SignatureStatusResponse> {\n const { docId, version } = parseVersionRef(documentRef)\n const { data, error } = await client.GET(SIGNATURES_PATH, {\n params: { path: { document_ext_id: docId }, ...(version ? { query: { version } } : {}) },\n })\n if (!data) throw new Error(errorDetail(error, 'The signatures could not be read'))\n return data\n}\n\n/**\n * Is a document version a signed copy? `documentId` is a document id (its current version) or a\n * version reference `doc-…@v{n}`. Needs a React Query `QueryClientProvider`.\n */\nexport function useDocumentSignatures(documentId: string | null | undefined, enabled = true) {\n const { client } = useDocumentTools()\n const { docId, version } = parseVersionRef(documentId)\n return useQuery({\n queryKey: arbiQueryKeys.documentSignatures(docId ?? '', version),\n queryFn: () => fetchDocumentSignatures(client, documentId!),\n enabled: enabled && !!docId,\n staleTime: 60_000,\n })\n}\n\n/**\n * Why the server would not sign: the PDF of a Word or text document is still being rendered\n * (`preparing`, worth another try in a moment), or the version on screen is no longer the current\n * one (`stale`: only the current version can be signed, so the signer reopens it).\n */\nexport type SigningErrorReason = 'preparing' | 'stale' | 'failed'\n\nexport class SigningError extends Error {\n readonly reason: SigningErrorReason\n constructor(message: string, reason: SigningErrorReason) {\n super(message)\n this.name = 'SigningError'\n this.reason = reason\n }\n}\n\n/** The 409s the backend's signing router raises, told apart by their wording. */\nfunction signingErrorReason(detail: string): SigningErrorReason {\n if (/still being prepared/i.test(detail)) return 'preparing'\n if (/no longer the current version/i.test(detail)) return 'stale'\n return 'failed'\n}\n\nfunction signingError(error: unknown, fallback: string): SigningError {\n const detail = errorDetail(error, fallback)\n return new SigningError(detail, signingErrorReason(detail))\n}\n\n/** How often, and how long apart, a prepare is retried while the PDF is still being rendered. */\nexport const PREPARE_RETRIES = 3\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\nexport interface SignDocumentVars {\n documentId: string\n /**\n * The PDF bytes the viewer is showing (`GET /view?version=`, never the original's download): the\n * signer signs exactly these.\n */\n pdfBlob: Blob\n /**\n * The version `pdfBlob` is of. The server signs only the current version and refuses\n * (`SigningError` `stale`) when this one has been superseded. Omitted = the current version.\n */\n version?: number\n email: string\n password: string\n signer: SignerDetails\n /** Where the signature goes; omitted = the backend default (bottom of the last page). */\n appearance?: SignatureAppearance\n /** Draw the signing date under the signature. Default off: only the signature is drawn. */\n includeDate?: boolean\n}\n\n/**\n * Sign a document: the server prepares the statement, the browser checks that it covers the PDF\n * on screen under the wording the signer read, re-derives the user's Ed25519 key from their\n * password and signs it, and the server seals the signed copy as a new version.\n *\n * What is drawn on the page is only the signature (the signer's name as the signature mark) and,\n * with `includeDate`, the date; anyone can click it to open its certificate. A role, a firm or a\n * place go on the page as ordinary annotation text, which is not part of the signature.\n */\nexport async function signDocument(\n client: DocumentToolsClient,\n deploymentDomain: string,\n {\n documentId,\n pdfBlob,\n email,\n password,\n signer,\n appearance,\n includeDate = false,\n version,\n }: SignDocumentVars\n): Promise<SignDocumentResponse> {\n const path = { document_ext_id: documentId }\n // One body for both calls: the server refuses a /sign whose include_date (or placement) differs\n // from what was prepared, since what the signature shows is part of what is signed.\n const body = {\n signer: { name: signer.name },\n ...(appearance ? { appearance } : {}),\n include_date: includeDate,\n ...(version ? { version } : {}),\n }\n\n // A Word or text document's PDF is rendered after upload: while it is, prepare says so, and a\n // short wait usually sees it ready.\n const prepare = () =>\n client.POST('/v1/document/{document_ext_id}/sign/prepare', { params: { path }, body })\n let prepared = await prepare()\n for (let attempt = 0; !prepared.data && attempt < PREPARE_RETRIES; attempt++) {\n if (signingError(prepared.error, '').reason !== 'preparing') break\n await wait(PREPARE_RETRY_DELAY_MS)\n prepared = await prepare()\n }\n if (!prepared.data) throw signingError(prepared.error, 'Could not prepare signing')\n const { statement, intent, source_sha256, timestamp } = prepared.data\n // Sign only what was on screen, under the wording the signer read.\n if ((await sha256Hex(pdfBlob)) !== source_sha256) {\n throw new Error('The document changed since it was opened. Reopen it and sign again.')\n }\n if (intent !== intentText(signer)) throw new Error('Signing statement mismatch; not signed.')\n\n // The re-typed password must open the session's identity, which is the key the server verifies.\n const identity = await unlockIdentityWithPassword(email, password, deploymentDomain)\n const signed = await client.POST('/v1/document/{document_ext_id}/sign', {\n params: { path },\n body: { ...body, timestamp, signature: signMessage(statement, identity) },\n })\n if (!signed.data) throw signingError(signed.error, 'Signing failed')\n return signed.data\n}\n\n/** The signing mutation. On success the host hears the document changed (`'signed'`). */\nexport function useSignDocument() {\n const env = useDocumentTools()\n const queryClient = useQueryClient()\n return useMutation({\n mutationFn: (vars: SignDocumentVars) => {\n if (!env.deploymentDomain) throw new Error('Signing is not set up: no deployment domain')\n return signDocument(env.client, env.deploymentDomain, vars)\n },\n onSuccess: async (result) => {\n // The signed copy is the document's new current version: the host refreshes its row,\n // versions and rendered PDF, and the signature badge reads again.\n await env.onDocumentsChanged?.([result.doc_ext_id], 'signed')\n await queryClient.invalidateQueries({ queryKey: arbiQueryKeys.documentSignatures() })\n },\n })\n}\n","import { useCallback } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { arbiQueryKeys } from '../query-keys'\n/** Share one immutable file version with named recipients, independently of workspace membership. */\nimport { signMessage, unlockIdentityWithPassword, type components } from '@arbidocs/client'\nimport type { DocumentToolsClient } from './environment'\nimport { intentText, sha256Hex } from './signing'\nimport type {\n SignatureRequest,\n SignRequestVars,\n SignRequestSignResponse,\n} from './signature-requests'\n\nexport type FileShare = components['schemas']['FileShareResponse']\nexport type CreateFileShare = components['schemas']['CreateFileShare']\n\nfunction failure(error: unknown): Error {\n const detail = (error as { detail?: unknown } | undefined)?.detail\n return new Error(typeof detail === 'string' ? detail : 'The shared file request failed')\n}\n\nexport async function createFileShare(\n client: DocumentToolsClient,\n documentId: string,\n body: CreateFileShare\n) {\n const result = await client.POST('/v1/document/{document_ext_id}/file-shares', {\n params: { path: { document_ext_id: documentId } },\n body,\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\nexport async function getFileShare(client: DocumentToolsClient, id: string): Promise<FileShare> {\n const result = await client.GET('/v1/file-shares/{share_id}', {\n params: { path: { share_id: id } },\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\nexport async function fileShareBytes(\n client: DocumentToolsClient,\n id: string,\n kind: 'view' | 'original' | 'signed'\n) {\n const result = await client.GET('/v1/file-shares/{share_id}/file', {\n params: { path: { share_id: id }, query: { kind } },\n parseAs: 'blob',\n })\n if (!result.data) throw failure(result.error)\n return result.data\n}\n\n/** Adapt only the guided viewer's presentation data; sharing uses its own authorization endpoints. */\nexport function fileShareSigningRequest(share: FileShare): SignatureRequest {\n return {\n external_id: share.external_id,\n doc_ext_id: share.document_ext_id,\n version: share.version,\n source_sha256: share.source_sha256,\n fields: share.fields,\n message: share.message,\n status:\n share.status === 'signing' ? 'sent' : share.status === 'completed' ? 'completed' : 'voided',\n signers: share.recipients\n .filter((r) => r.permission === 'sign')\n .map((r) => ({\n external_id: r.email,\n email: r.email,\n name: r.email,\n status: r.status === 'signed' ? 'signed' : 'pending',\n progress: r.status === 'signed' ? 'signed' : 'registered',\n fields: share.fields.filter((f) => f.signer === r.email).length,\n })),\n created_at: new Date(0).toISOString(),\n stale: false,\n }\n}\n\nexport async function signFileShare(\n client: DocumentToolsClient,\n domain: string,\n vars: SignRequestVars\n): Promise<SignRequestSignResponse> {\n const path = { share_id: vars.request.external_id }\n const body = { adopted: vars.adopted, fields: vars.fields }\n const prepared = await client.POST('/v1/file-shares/{share_id}/sign/prepare', {\n params: { path },\n body,\n })\n if (!prepared.data) throw failure(prepared.error)\n const { statement, timestamp, source_sha256, intent } = prepared.data\n if (\n source_sha256 !== vars.request.source_sha256 ||\n (await sha256Hex(vars.pdfBlob)) !== source_sha256\n )\n throw new Error('The shared file changed. Ask the sender for a new request.')\n if (intent !== intentText({ name: vars.adopted.name }))\n throw new Error('Signing statement mismatch')\n const identity = await unlockIdentityWithPassword(vars.email, vars.password, domain)\n const result = await client.POST('/v1/file-shares/{share_id}/sign', {\n params: { path },\n body: { ...body, timestamp, signature: signMessage(statement, identity) },\n })\n if (!result.data) throw failure(result.error)\n return {\n request: fileShareSigningRequest(result.data),\n completed: result.data.status === 'completed',\n }\n}\n\nexport function useFileShare(client: DocumentToolsClient, shareId: string, signing: boolean) {\n return useQuery({\n queryKey: arbiQueryKeys.fileShare(shareId),\n queryFn: () => getFileShare(client, shareId),\n refetchInterval: signing ? false : 5000,\n })\n}\n\nexport function useFileSharePdf(client: DocumentToolsClient, shareId: string, share?: FileShare) {\n return useQuery({\n queryKey: arbiQueryKeys.fileSharePdf(shareId, share?.status),\n queryFn: () =>\n fileShareBytes(client, shareId, share?.status === 'completed' ? 'signed' : 'view'),\n enabled: !!share?.can_preview,\n staleTime: Infinity,\n })\n}\n\n/** The shares I created or was invited to (revoked and expired ones are not listed). Listing does\n * not open a share, so it never starts a recipient's access window. Null client: not loaded. */\nexport function useFileShares(client: DocumentToolsClient | null) {\n return useQuery({\n queryKey: arbiQueryKeys.fileShares(),\n queryFn: async () => {\n const result = await client?.GET('/v1/file-shares')\n if (!result?.data) throw new Error('Could not load shared files')\n return result.data\n },\n enabled: !!client,\n })\n}\n\n/** Read the share list again (after a change made to a share: signed, declined, saved, revoked). */\nexport function useRefreshFileShares(): () => Promise<void> {\n const queryClient = useQueryClient()\n return useCallback(\n () => queryClient.invalidateQueries({ queryKey: arbiQueryKeys.fileShares() }),\n [queryClient]\n )\n}\n\n/**\n * Save a completed share's signed PDF as its document's next version, in the share's workspace\n * (its key must be on the session: open that workspace first).\n */\nexport async function publishFileShare(client: DocumentToolsClient, share: FileShare) {\n const result = await client.POST(\n '/v1/document/{document_ext_id}/file-shares/{share_id}/publish',\n { params: { path: { document_ext_id: share.document_ext_id, share_id: share.external_id } } }\n )\n if (!result.data) throw new Error('Could not save the signed version to its workspace')\n return result.data\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSJZRVX7T_cjs = require('./chunk-SJZRVX7T.cjs');
|
|
4
4
|
var chunkN73IMVFF_cjs = require('./chunk-N73IMVFF.cjs');
|
|
5
5
|
var chunkDQODLWFX_cjs = require('./chunk-DQODLWFX.cjs');
|
|
6
6
|
var client = require('@arbidocs/client');
|
|
@@ -1562,7 +1562,7 @@ var createOwnStore = (host) => createArbiSessionStore(
|
|
|
1562
1562
|
var moduleDefault = null;
|
|
1563
1563
|
var defaultStore = () => moduleDefault ??= createArbiSessionStore();
|
|
1564
1564
|
function useArbiSessionStore() {
|
|
1565
|
-
const host =
|
|
1565
|
+
const host = chunkSJZRVX7T_cjs.useArbiHost();
|
|
1566
1566
|
if (host.session) return host.session;
|
|
1567
1567
|
const own = host[chunkN73IMVFF_cjs.OWN_SESSION_SLOT];
|
|
1568
1568
|
if (own) return own.current ??= createOwnStore(host);
|
|
@@ -1601,7 +1601,7 @@ var SIGNED_OUT = {
|
|
|
1601
1601
|
var noSubscription = () => () => {
|
|
1602
1602
|
};
|
|
1603
1603
|
function useArbiSession() {
|
|
1604
|
-
return useSignedInSession(
|
|
1604
|
+
return useSignedInSession(chunkSJZRVX7T_cjs.useArbiHost().arbi?.session ?? null);
|
|
1605
1605
|
}
|
|
1606
1606
|
function useSignedInSession(session) {
|
|
1607
1607
|
const state = react.useSyncExternalStore(
|
|
@@ -1925,27 +1925,27 @@ function isUsageMetered(usage, subscription) {
|
|
|
1925
1925
|
return !(empty && subscription === "dev");
|
|
1926
1926
|
}
|
|
1927
1927
|
function useWorkspaces(options) {
|
|
1928
|
-
const arbi =
|
|
1928
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1929
1929
|
return reactQuery.useQuery({
|
|
1930
|
-
queryKey:
|
|
1930
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.workspaces(),
|
|
1931
1931
|
queryFn: () => arbi.workspaces.list(),
|
|
1932
1932
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1933
1933
|
});
|
|
1934
1934
|
}
|
|
1935
1935
|
function useDocumentVersionList(docId, options) {
|
|
1936
|
-
const arbi =
|
|
1936
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1937
1937
|
return reactQuery.useQuery({
|
|
1938
|
-
queryKey:
|
|
1938
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.documentVersions(docId ?? ""),
|
|
1939
1939
|
queryFn: () => arbi.documents.versions(docId),
|
|
1940
1940
|
enabled: (options?.enabled ?? true) && !!docId && arbi.hasWorkspace
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
1943
|
function useConversations(workspaceId, options) {
|
|
1944
|
-
const arbi =
|
|
1944
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1945
1945
|
const queryClient = reactQuery.useQueryClient();
|
|
1946
1946
|
const live = options?.live === true;
|
|
1947
1947
|
return reactQuery.useQuery({
|
|
1948
|
-
queryKey:
|
|
1948
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.conversations(workspaceId ?? ""),
|
|
1949
1949
|
// The request names the workspace, so a switch while it runs cannot answer for another.
|
|
1950
1950
|
queryFn: () => readConversationList(
|
|
1951
1951
|
queryClient,
|
|
@@ -1960,9 +1960,9 @@ function useConversations(workspaceId, options) {
|
|
|
1960
1960
|
});
|
|
1961
1961
|
}
|
|
1962
1962
|
function useBuiltinCommands() {
|
|
1963
|
-
const arbi =
|
|
1963
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1964
1964
|
const query = reactQuery.useQuery({
|
|
1965
|
-
queryKey:
|
|
1965
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.assistantCommands(),
|
|
1966
1966
|
queryFn: () => arbi.assistant.commands(),
|
|
1967
1967
|
staleTime: 30 * 1e3,
|
|
1968
1968
|
enabled: arbi.isLoggedIn
|
|
@@ -1971,18 +1971,18 @@ function useBuiltinCommands() {
|
|
|
1971
1971
|
return { commands, isLoading: query.isLoading };
|
|
1972
1972
|
}
|
|
1973
1973
|
function useMessageDetails(messageId, options) {
|
|
1974
|
-
const arbi =
|
|
1974
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1975
1975
|
return reactQuery.useQuery({
|
|
1976
|
-
queryKey:
|
|
1976
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.messageDetails(messageId ?? ""),
|
|
1977
1977
|
queryFn: () => arbi.conversations.getMessage(messageId),
|
|
1978
1978
|
enabled: (options?.enabled ?? true) && !!messageId && arbi.isLoggedIn
|
|
1979
1979
|
});
|
|
1980
1980
|
}
|
|
1981
1981
|
function useConversationThreads(conversationId, options) {
|
|
1982
|
-
const arbi =
|
|
1982
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
1983
1983
|
const session = useArbiSessionStore();
|
|
1984
1984
|
return reactQuery.useQuery({
|
|
1985
|
-
queryKey:
|
|
1985
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.conversationThreads(conversationId ?? ""),
|
|
1986
1986
|
queryFn: () => arbi.conversations.getThreads(conversationId),
|
|
1987
1987
|
enabled: (options?.enabled ?? true) && !!conversationId && arbi.hasWorkspace,
|
|
1988
1988
|
staleTime: 2 * 60 * 1e3,
|
|
@@ -1998,12 +1998,12 @@ var tagListKey = (query) => [
|
|
|
1998
1998
|
query.linksLimit !== void 0 ? `links:${query.linksLimit}` : ""
|
|
1999
1999
|
].filter(Boolean).join("|");
|
|
2000
2000
|
function useTags(workspaceId, options) {
|
|
2001
|
-
const arbi =
|
|
2001
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2002
2002
|
const { enabled, ...query } = options ?? {};
|
|
2003
2003
|
const workspace = workspaceId ?? (arbi.hasWorkspace ? arbi.getWorkspaceId() : "");
|
|
2004
2004
|
const key = tagListKey(query);
|
|
2005
2005
|
return reactQuery.useQuery({
|
|
2006
|
-
queryKey: key ?
|
|
2006
|
+
queryKey: key ? chunkSJZRVX7T_cjs.arbiQueryKeys.tagList(workspace, key) : chunkSJZRVX7T_cjs.arbiQueryKeys.tags(workspace),
|
|
2007
2007
|
// The request names the workspace (opened for this session first when it is not the current
|
|
2008
2008
|
// one), so another workspace's tags can be listed and a switch cannot answer for it. The
|
|
2009
2009
|
// current workspace's list is also read under the switch guard.
|
|
@@ -2016,18 +2016,18 @@ function useTags(workspaceId, options) {
|
|
|
2016
2016
|
});
|
|
2017
2017
|
}
|
|
2018
2018
|
function useThumbnails(docIds, options) {
|
|
2019
|
-
const arbi =
|
|
2019
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2020
2020
|
return reactQuery.useQuery({
|
|
2021
|
-
queryKey:
|
|
2021
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.thumbnails(docIds),
|
|
2022
2022
|
queryFn: () => arbi.documents.getThumbnails(docIds),
|
|
2023
2023
|
enabled: (options?.enabled ?? true) && docIds.length > 0 && arbi.hasWorkspace,
|
|
2024
2024
|
staleTime: 5 * 6e4
|
|
2025
2025
|
});
|
|
2026
2026
|
}
|
|
2027
2027
|
function useParsedDocument(docId, stage = "final", options) {
|
|
2028
|
-
const arbi =
|
|
2028
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2029
2029
|
return reactQuery.useQuery({
|
|
2030
|
-
queryKey:
|
|
2030
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.parsedDoc(docId ?? "", stage),
|
|
2031
2031
|
queryFn: () => {
|
|
2032
2032
|
const { docId: id, version } = chunkDQODLWFX_cjs.parseVersionRef(docId);
|
|
2033
2033
|
return arbi.documents.getParsedContent(
|
|
@@ -2040,84 +2040,84 @@ function useParsedDocument(docId, stage = "final", options) {
|
|
|
2040
2040
|
});
|
|
2041
2041
|
}
|
|
2042
2042
|
function useAssistantQuery() {
|
|
2043
|
-
const arbi =
|
|
2043
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2044
2044
|
return reactQuery.useMutation({
|
|
2045
2045
|
mutationFn: ({ request, handlers }) => arbi.assistant.ask(request, handlers)
|
|
2046
2046
|
});
|
|
2047
2047
|
}
|
|
2048
2048
|
function useAgents(options) {
|
|
2049
|
-
const arbi =
|
|
2049
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2050
2050
|
return reactQuery.useQuery({
|
|
2051
|
-
queryKey:
|
|
2051
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.agents(),
|
|
2052
2052
|
queryFn: () => arbi.agents.list(),
|
|
2053
2053
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
2054
2054
|
});
|
|
2055
2055
|
}
|
|
2056
2056
|
function useDeleteAgents() {
|
|
2057
|
-
const arbi =
|
|
2057
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2058
2058
|
const qc = reactQuery.useQueryClient();
|
|
2059
2059
|
return reactQuery.useMutation({
|
|
2060
2060
|
mutationFn: ({ agentExtIds }) => arbi.agents.delete(agentExtIds),
|
|
2061
2061
|
onSuccess: (_result, { agentExtIds }) => {
|
|
2062
2062
|
for (const id of agentExtIds) {
|
|
2063
|
-
qc.removeQueries({ queryKey:
|
|
2064
|
-
qc.removeQueries({ queryKey:
|
|
2063
|
+
qc.removeQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.agentConfig(id) });
|
|
2064
|
+
qc.removeQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.agentWorkspaces(id) });
|
|
2065
2065
|
}
|
|
2066
2066
|
return Promise.all([
|
|
2067
|
-
qc.invalidateQueries({ queryKey:
|
|
2068
|
-
qc.invalidateQueries({ queryKey:
|
|
2069
|
-
qc.invalidateQueries({ queryKey:
|
|
2070
|
-
qc.invalidateQueries({ queryKey:
|
|
2067
|
+
qc.invalidateQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.agents() }),
|
|
2068
|
+
qc.invalidateQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.workflows() }),
|
|
2069
|
+
qc.invalidateQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.allConversations() }),
|
|
2070
|
+
qc.invalidateQueries({ queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.configs() })
|
|
2071
2071
|
]);
|
|
2072
2072
|
}
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
function useHealth(options) {
|
|
2076
|
-
const arbi =
|
|
2076
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2077
2077
|
return reactQuery.useQuery({
|
|
2078
|
-
queryKey:
|
|
2078
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.health(),
|
|
2079
2079
|
queryFn: () => arbi.health.check(),
|
|
2080
2080
|
enabled: options?.enabled
|
|
2081
2081
|
});
|
|
2082
2082
|
}
|
|
2083
2083
|
function useAvailableModels(options) {
|
|
2084
|
-
const arbi =
|
|
2084
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2085
2085
|
return reactQuery.useQuery({
|
|
2086
|
-
queryKey:
|
|
2086
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.availableModels(),
|
|
2087
2087
|
queryFn: () => arbi.health.models(),
|
|
2088
2088
|
staleTime: Infinity,
|
|
2089
2089
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
2090
2090
|
});
|
|
2091
2091
|
}
|
|
2092
2092
|
function useConfigs(options) {
|
|
2093
|
-
const arbi =
|
|
2093
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2094
2094
|
return reactQuery.useQuery({
|
|
2095
|
-
queryKey:
|
|
2095
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.configVersions(),
|
|
2096
2096
|
queryFn: () => arbi.agentConfig.list(),
|
|
2097
2097
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
2098
2098
|
});
|
|
2099
2099
|
}
|
|
2100
2100
|
function useConfig(configId, options) {
|
|
2101
|
-
const arbi =
|
|
2101
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2102
2102
|
return reactQuery.useQuery({
|
|
2103
|
-
queryKey:
|
|
2103
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.config(configId ?? ""),
|
|
2104
2104
|
queryFn: () => arbi.agentConfig.get(configId),
|
|
2105
2105
|
staleTime: 10 * 60 * 1e3,
|
|
2106
2106
|
enabled: (options?.enabled ?? true) && !!configId && arbi.isLoggedIn
|
|
2107
2107
|
});
|
|
2108
2108
|
}
|
|
2109
2109
|
function useActivity(options) {
|
|
2110
|
-
const arbi =
|
|
2110
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2111
2111
|
return reactQuery.useQuery({
|
|
2112
|
-
queryKey:
|
|
2112
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.activity(),
|
|
2113
2113
|
queryFn: () => arbi.dm.listActivity({ limit: options?.limit, offset: options?.offset }),
|
|
2114
2114
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
2115
2115
|
});
|
|
2116
2116
|
}
|
|
2117
2117
|
function useWorkspaceActivity(workspaceId, options) {
|
|
2118
|
-
const arbi =
|
|
2118
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2119
2119
|
return reactQuery.useInfiniteQuery({
|
|
2120
|
-
queryKey:
|
|
2120
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.workspaceActivity(workspaceId ?? "", options?.limit),
|
|
2121
2121
|
queryFn: async ({ pageParam }) => {
|
|
2122
2122
|
await options?.beforeFetch?.();
|
|
2123
2123
|
return arbi.workspaces.activity(workspaceId, {
|
|
@@ -2131,17 +2131,17 @@ function useWorkspaceActivity(workspaceId, options) {
|
|
|
2131
2131
|
});
|
|
2132
2132
|
}
|
|
2133
2133
|
function useProjects(options) {
|
|
2134
|
-
const arbi =
|
|
2134
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2135
2135
|
return reactQuery.useQuery({
|
|
2136
|
-
queryKey:
|
|
2136
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.projects(),
|
|
2137
2137
|
queryFn: () => arbi.projects.list(),
|
|
2138
2138
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
2139
2139
|
});
|
|
2140
2140
|
}
|
|
2141
2141
|
function useProjectUsage(projectExtId, monthsBack = 0, options) {
|
|
2142
|
-
const arbi =
|
|
2142
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2143
2143
|
const usage = reactQuery.useQuery({
|
|
2144
|
-
queryKey:
|
|
2144
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.projectUsage(projectExtId ?? "", monthsBack),
|
|
2145
2145
|
queryFn: () => arbi.projects.usage(projectExtId, monthsBack),
|
|
2146
2146
|
enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
|
|
2147
2147
|
});
|
|
@@ -2151,17 +2151,17 @@ function useProjectUsage(projectExtId, monthsBack = 0, options) {
|
|
|
2151
2151
|
return { ...usage, metered };
|
|
2152
2152
|
}
|
|
2153
2153
|
function useProjectInvoices(projectExtId, options) {
|
|
2154
|
-
const arbi =
|
|
2154
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2155
2155
|
return reactQuery.useQuery({
|
|
2156
|
-
queryKey:
|
|
2156
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.projectInvoices(projectExtId ?? ""),
|
|
2157
2157
|
queryFn: () => arbi.projects.invoices(projectExtId),
|
|
2158
2158
|
enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
|
|
2159
2159
|
});
|
|
2160
2160
|
}
|
|
2161
2161
|
function useCurrentUser(options) {
|
|
2162
|
-
const arbi =
|
|
2162
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2163
2163
|
return reactQuery.useQuery({
|
|
2164
|
-
queryKey:
|
|
2164
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.currentUser(),
|
|
2165
2165
|
queryFn: () => arbi.user.me(),
|
|
2166
2166
|
enabled: options?.enabled ?? arbi.isLoggedIn,
|
|
2167
2167
|
refetchOnWindowFocus: true,
|
|
@@ -2169,9 +2169,9 @@ function useCurrentUser(options) {
|
|
|
2169
2169
|
});
|
|
2170
2170
|
}
|
|
2171
2171
|
function useFirmPool(options) {
|
|
2172
|
-
const arbi =
|
|
2172
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2173
2173
|
return reactQuery.useQuery({
|
|
2174
|
-
queryKey:
|
|
2174
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.firmPool(),
|
|
2175
2175
|
queryFn: () => arbi.firm.pool(),
|
|
2176
2176
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
2177
2177
|
retry: false,
|
|
@@ -2222,9 +2222,9 @@ function useCanCreateWorkspaces() {
|
|
|
2222
2222
|
return me && (me.can_create_workspaces ?? me.can_create_projects);
|
|
2223
2223
|
}
|
|
2224
2224
|
function useUserUsageToday(options) {
|
|
2225
|
-
const arbi =
|
|
2225
|
+
const arbi = chunkSJZRVX7T_cjs.useArbi();
|
|
2226
2226
|
return reactQuery.useQuery({
|
|
2227
|
-
queryKey:
|
|
2227
|
+
queryKey: chunkSJZRVX7T_cjs.arbiQueryKeys.userUsageToday(),
|
|
2228
2228
|
queryFn: () => arbi.user.usageToday(),
|
|
2229
2229
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
2230
2230
|
refetchOnWindowFocus: true,
|
|
@@ -2252,7 +2252,7 @@ function writeLog(queryClient, key) {
|
|
|
2252
2252
|
return log;
|
|
2253
2253
|
}
|
|
2254
2254
|
function withLocalWrites(queryClient, workspaceId, rows, requestedAt) {
|
|
2255
|
-
return writeLog(queryClient,
|
|
2255
|
+
return writeLog(queryClient, chunkSJZRVX7T_cjs.arbiQueryKeys.conversations(workspaceId)).filter((w) => w.at >= requestedAt).reduce((list, w) => w.apply(list), rows);
|
|
2256
2256
|
}
|
|
2257
2257
|
async function readConversationList(queryClient, workspaceId, read) {
|
|
2258
2258
|
const requestedAt = Date.now();
|
|
@@ -2260,7 +2260,7 @@ async function readConversationList(queryClient, workspaceId, read) {
|
|
|
2260
2260
|
}
|
|
2261
2261
|
function seedConversationList(queryClient, workspaceId, rows, requestedAt) {
|
|
2262
2262
|
queryClient.setQueryData(
|
|
2263
|
-
|
|
2263
|
+
chunkSJZRVX7T_cjs.arbiQueryKeys.conversations(workspaceId),
|
|
2264
2264
|
withLocalWrites(queryClient, workspaceId, rows, requestedAt)
|
|
2265
2265
|
);
|
|
2266
2266
|
}
|
|
@@ -2279,7 +2279,7 @@ function patchLists(queryClient, reducer) {
|
|
|
2279
2279
|
}
|
|
2280
2280
|
function patchConversationList(queryClient, workspaceId, reducer) {
|
|
2281
2281
|
if (!workspaceId) return;
|
|
2282
|
-
const key =
|
|
2282
|
+
const key = chunkSJZRVX7T_cjs.arbiQueryKeys.conversations(workspaceId);
|
|
2283
2283
|
const current = queryClient.getQueryData(key) ?? [];
|
|
2284
2284
|
const next = reducer(current);
|
|
2285
2285
|
if (next !== current) writeList(queryClient, key, reducer, next);
|
|
@@ -2420,5 +2420,5 @@ exports.useUserUsageToday = useUserUsageToday;
|
|
|
2420
2420
|
exports.useWorkspaceActivity = useWorkspaceActivity;
|
|
2421
2421
|
exports.useWorkspaces = useWorkspaces;
|
|
2422
2422
|
exports.withLocalWrites = withLocalWrites;
|
|
2423
|
-
//# sourceMappingURL=chunk-
|
|
2424
|
-
//# sourceMappingURL=chunk-
|
|
2423
|
+
//# sourceMappingURL=chunk-BEOHXA2Z.cjs.map
|
|
2424
|
+
//# sourceMappingURL=chunk-BEOHXA2Z.cjs.map
|