@arbidocs/react 0.5.57 → 0.5.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +9 -0
  2. package/dist/artifacts/index.cjs +14 -14
  3. package/dist/artifacts/index.js +4 -4
  4. package/dist/calls/livekit/index.cjs +49 -49
  5. package/dist/calls/livekit/index.js +4 -4
  6. package/dist/{chunk-V64EETLS.cjs → chunk-3QK4VVPG.cjs} +4 -4
  7. package/dist/{chunk-V64EETLS.cjs.map → chunk-3QK4VVPG.cjs.map} +1 -1
  8. package/dist/{chunk-3CVY5SGY.cjs → chunk-4E737GNX.cjs} +65 -65
  9. package/dist/{chunk-3CVY5SGY.cjs.map → chunk-4E737GNX.cjs.map} +1 -1
  10. package/dist/{chunk-RRWAX52L.cjs → chunk-G76ASVVH.cjs} +6 -2
  11. package/dist/chunk-G76ASVVH.cjs.map +1 -0
  12. package/dist/{chunk-WRMA2JYX.js → chunk-KRH55LXW.js} +5 -5
  13. package/dist/{chunk-WRMA2JYX.js.map → chunk-KRH55LXW.js.map} +1 -1
  14. package/dist/{chunk-UKEUDTOE.cjs → chunk-LCSUCZVX.cjs} +46 -46
  15. package/dist/{chunk-UKEUDTOE.cjs.map → chunk-LCSUCZVX.cjs.map} +1 -1
  16. package/dist/{chunk-4TKNUJKD.js → chunk-M2SZQBCO.js} +3 -3
  17. package/dist/{chunk-4TKNUJKD.js.map → chunk-M2SZQBCO.js.map} +1 -1
  18. package/dist/{chunk-PVUZULHI.js → chunk-OSWKXZTJ.js} +92 -12
  19. package/dist/chunk-OSWKXZTJ.js.map +1 -0
  20. package/dist/{chunk-DFZECLD3.js → chunk-R7YNABZY.js} +2 -2
  21. package/dist/chunk-R7YNABZY.js.map +1 -0
  22. package/dist/{chunk-JFL7BBZ6.js → chunk-S2W3ZOWG.js} +4 -4
  23. package/dist/{chunk-JFL7BBZ6.js.map → chunk-S2W3ZOWG.js.map} +1 -1
  24. package/dist/{chunk-PBXJFMES.js → chunk-U64WCQP3.js} +6 -2
  25. package/dist/chunk-U64WCQP3.js.map +1 -0
  26. package/dist/{chunk-2JQ7QNOO.cjs → chunk-X7JXQT6F.cjs} +154 -69
  27. package/dist/chunk-X7JXQT6F.cjs.map +1 -0
  28. package/dist/{chunk-YRY6DGRU.cjs → chunk-Y7S2SQH3.cjs} +2 -2
  29. package/dist/chunk-Y7S2SQH3.cjs.map +1 -0
  30. package/dist/document-tools/index.cjs +60 -60
  31. package/dist/document-tools/index.d.cts +2 -2
  32. package/dist/document-tools/index.d.ts +2 -2
  33. package/dist/document-tools/index.js +5 -5
  34. package/dist/index.cjs +2317 -1092
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +1672 -1085
  37. package/dist/index.d.ts +1672 -1085
  38. package/dist/index.js +1223 -60
  39. package/dist/index.js.map +1 -1
  40. package/dist/{query-keys.d-DM2N5pzN.d.cts → query-keys.d-DEEMzkLz.d.cts} +4 -0
  41. package/dist/{query-keys.d-DM2N5pzN.d.ts → query-keys.d-DEEMzkLz.d.ts} +4 -0
  42. package/dist/viewers/index.cjs +2 -2
  43. package/dist/viewers/index.js +1 -1
  44. package/package.json +3 -3
  45. package/dist/chunk-2JQ7QNOO.cjs.map +0 -1
  46. package/dist/chunk-DFZECLD3.js.map +0 -1
  47. package/dist/chunk-PBXJFMES.js.map +0 -1
  48. package/dist/chunk-PVUZULHI.js.map +0 -1
  49. package/dist/chunk-RRWAX52L.cjs.map +0 -1
  50. package/dist/chunk-YRY6DGRU.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"],"names":["createContext","useDeploymentDomain","useRef","useCallback","useMemo","jsx","useContext","parseVersionRef"],"mappings":";;;;;;;AAmEO,SAAS,kBAAkB,KAAA,EAAoC;AACpE,EAAA,MAAM,MAAA,GAAS,IAAI,eAAA,EAAgB;AACnC,EAAA,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C/D,EAAA,MAAM,KAAA,GAAQ,qBAAA,CAAsB,IAAA,CAAK,WAAW,IAAI,CAAC,CAAA;AACzD,EAAA,MAAM,QAAA,GAAW,IAAA,GAAO,kBAAA,CAAmB,IAAI,IAAK,KAAA,IAAS,YAAA;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAc,QAAA,EAAS;AACxC","file":"chunk-V64EETLS.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 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: { path: { document_ext_id: ref.docId }, query: version ? { version } : {} },\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): Promise<{ blob: Blob; fileName: string }> {\n const { data, response } = await client.GET('/v1/document/{document_ext_id}/markup/pdf', {\n params: { path: { document_ext_id: documentId }, query: version ? { version } : {} },\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"]}
1
+ {"version":3,"sources":["../src/document-tools/environment.tsx","../src/document-tools/document-pdf.ts","../src/document-tools/markup-download.ts"],"names":["createContext","useDeploymentDomain","useRef","useCallback","useMemo","jsx","useContext","parseVersionRef"],"mappings":";;;;;;;AAmE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K,EAAA;AACnE,EAAA,MAAM,IAAA,GAAO,4BAAA,CAA6B,IAAA,CAAK,WAAW,IAAI,CAAC,CAAA;AAC/D,EAAA,MAAM,KAAA,GAAQ,qBAAA,CAAsB,IAAA,CAAK,WAAW,IAAI,CAAC,CAAA;AACzD,EAAA,MAAM,QAAA,GAAW,IAAA,GAAO,kBAAA,CAAmB,IAAI,IAAK,KAAA,IAAS,YAAA;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAc,QAAA,EAAS;AACxC","file":"chunk-3QK4VVPG.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 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: { path: { document_ext_id: ref.docId }, query: version ? { version } : {} },\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): Promise<{ blob: Blob; fileName: string }> {\n const { data, response } = await client.GET('/v1/document/{document_ext_id}/markup/pdf', {\n params: { path: { document_ext_id: documentId }, query: version ? { version } : {} },\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"]}
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunk2JQ7QNOO_cjs = require('./chunk-2JQ7QNOO.cjs');
4
- var chunkRRWAX52L_cjs = require('./chunk-RRWAX52L.cjs');
3
+ var chunkX7JXQT6F_cjs = require('./chunk-X7JXQT6F.cjs');
4
+ var chunkG76ASVVH_cjs = require('./chunk-G76ASVVH.cjs');
5
5
  var chunkVAMPYLQ4_cjs = require('./chunk-VAMPYLQ4.cjs');
6
6
  var chunkEEIYXVM4_cjs = require('./chunk-EEIYXVM4.cjs');
7
- var chunkYRY6DGRU_cjs = require('./chunk-YRY6DGRU.cjs');
7
+ var chunkY7S2SQH3_cjs = require('./chunk-Y7S2SQH3.cjs');
8
8
  var reactQuery = require('@tanstack/react-query');
9
9
  var react = require('react');
10
10
  var browser = require('@arbidocs/sdk/browser');
11
11
  var client = require('@arbidocs/client');
12
12
 
13
13
  function useUserSettings(options) {
14
- const arbi = chunkYRY6DGRU_cjs.useArbi();
14
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
15
15
  return reactQuery.useQuery({
16
- queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.userSettings(),
16
+ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.userSettings(),
17
17
  queryFn: () => arbi.settings.get(),
18
18
  // Edited about once a month, and every write here patches the cache: no refetch on each mount.
19
19
  staleTime: 30 * 60 * 1e3,
@@ -21,23 +21,23 @@ function useUserSettings(options) {
21
21
  });
22
22
  }
23
23
  function useUpdateUserSettings() {
24
- const arbi = chunkYRY6DGRU_cjs.useArbi();
24
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
25
25
  const qc = reactQuery.useQueryClient();
26
26
  return reactQuery.useMutation({
27
27
  mutationFn: (patch) => arbi.settings.update(patch),
28
28
  onMutate: async (patch) => {
29
- await qc.cancelQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.userSettings() });
30
- const previous = qc.getQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.userSettings());
29
+ await qc.cancelQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.userSettings() });
30
+ const previous = qc.getQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.userSettings());
31
31
  qc.setQueryData(
32
- chunkRRWAX52L_cjs.arbiQueryKeys.userSettings(),
32
+ chunkG76ASVVH_cjs.arbiQueryKeys.userSettings(),
33
33
  (old) => old ? { ...old, ...patch } : old
34
34
  );
35
35
  return { previous };
36
36
  },
37
37
  onError: (_err, _patch, context) => {
38
- qc.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.userSettings(), context?.previous);
38
+ qc.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.userSettings(), context?.previous);
39
39
  },
40
- onSettled: () => qc.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.userSettings() })
40
+ onSettled: () => qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.userSettings() })
41
41
  });
42
42
  }
43
43
  var ALWAYS_ON = { on: true, set: () => {
@@ -60,7 +60,7 @@ function useLocalSwitch(source, feature) {
60
60
  return { on: saved ?? fallback, set };
61
61
  }
62
62
  function useFeatureSwitch(feature) {
63
- const source = chunkYRY6DGRU_cjs.useArbiHost().features?.[feature];
63
+ const source = chunkY7S2SQH3_cjs.useArbiHost().features?.[feature];
64
64
  const useSource = !source ? useUnlisted : "userSetting" in source ? useUserSettingSwitch : useLocalSwitch;
65
65
  return useSource(source, feature);
66
66
  }
@@ -150,7 +150,7 @@ var LISTS = {
150
150
  };
151
151
  function patchConversationList(queryClient, workspaceId, reducer) {
152
152
  if (!workspaceId) return;
153
- const key = chunkRRWAX52L_cjs.arbiQueryKeys.conversations(workspaceId);
153
+ const key = chunkG76ASVVH_cjs.arbiQueryKeys.conversations(workspaceId);
154
154
  const current = queryClient.getQueryData(key) ?? [];
155
155
  const next = reducer(current);
156
156
  if (next !== current) queryClient.setQueryData(key, next);
@@ -218,13 +218,13 @@ function byActivity(a, b) {
218
218
  return bt - at;
219
219
  }
220
220
  function cachedChats(queryClient) {
221
- return queryClient.getQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatList()) ?? [];
221
+ return queryClient.getQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatList()) ?? [];
222
222
  }
223
223
  function cachedChat(queryClient, chatExtId) {
224
224
  return cachedChats(queryClient).find((c) => c.external_id === chatExtId);
225
225
  }
226
226
  function upsertChat(queryClient, chat) {
227
- queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatList(), (old) => {
227
+ queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatList(), (old) => {
228
228
  if (!old) return old;
229
229
  const rest = old.filter((c) => c.external_id !== chat.external_id);
230
230
  return [chat, ...rest].sort(byActivity);
@@ -232,13 +232,13 @@ function upsertChat(queryClient, chat) {
232
232
  }
233
233
  function removeChat(queryClient, chatExtId) {
234
234
  queryClient.setQueryData(
235
- chunkRRWAX52L_cjs.arbiQueryKeys.chatList(),
235
+ chunkG76ASVVH_cjs.arbiQueryKeys.chatList(),
236
236
  (old) => old?.filter((c) => c.external_id !== chatExtId)
237
237
  );
238
- queryClient.removeQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId) });
238
+ queryClient.removeQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId) });
239
239
  }
240
240
  function appendToThread(queryClient, chatExtId, message, replaceOptimisticId) {
241
- queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId), (old) => {
241
+ queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId), (old) => {
242
242
  if (!old) return old;
243
243
  const without = old.messages.filter(
244
244
  (m) => m.external_id !== message.external_id && m.external_id !== replaceOptimisticId
@@ -248,12 +248,12 @@ function appendToThread(queryClient, chatExtId, message, replaceOptimisticId) {
248
248
  }
249
249
  function dropFromThread(queryClient, chatExtId, messageExtId) {
250
250
  queryClient.setQueryData(
251
- chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId),
251
+ chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId),
252
252
  (old) => old ? { ...old, messages: old.messages.filter((m) => m.external_id !== messageExtId) } : old
253
253
  );
254
254
  }
255
255
  function replaceInThread(queryClient, chatExtId, message) {
256
- queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId), (old) => {
256
+ queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId), (old) => {
257
257
  if (!old || !old.messages.some((m) => m.external_id === message.external_id)) return old;
258
258
  return {
259
259
  ...old,
@@ -263,14 +263,14 @@ function replaceInThread(queryClient, chatExtId, message) {
263
263
  }
264
264
  function patchLastMessage(queryClient, chatExtId, message) {
265
265
  queryClient.setQueryData(
266
- chunkRRWAX52L_cjs.arbiQueryKeys.chatList(),
266
+ chunkG76ASVVH_cjs.arbiQueryKeys.chatList(),
267
267
  (old) => old?.map(
268
268
  (c) => c.external_id === chatExtId && c.last_message?.external_id === message.external_id ? { ...c, last_message: message } : c
269
269
  )
270
270
  );
271
271
  }
272
272
  async function deleteChatMessage(arbi, queryClient, chatExtId, messageExtId) {
273
- const thread = queryClient.getQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId));
273
+ const thread = queryClient.getQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId));
274
274
  const before = thread?.messages.find((m) => m.external_id === messageExtId);
275
275
  const listed = cachedChat(queryClient, chatExtId);
276
276
  const wasLast = listed?.last_message?.external_id === messageExtId ? listed.last_message : null;
@@ -291,7 +291,7 @@ async function applyChangedMessage(arbi, queryClient, chatExtId, message) {
291
291
  return;
292
292
  }
293
293
  const chat = cachedChat(queryClient, chatExtId);
294
- if (!chat || !queryClient.getQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId))) return;
294
+ if (!chat || !queryClient.getQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId))) return;
295
295
  try {
296
296
  replaceInThread(queryClient, chatExtId, await arbi.chats.decrypt(chat, message));
297
297
  } catch (err) {
@@ -303,7 +303,7 @@ async function applyChatMessage(arbi, queryClient, chatExtId, message) {
303
303
  const me = myChatId(arbi);
304
304
  const chat = cachedChat(queryClient, chatExtId);
305
305
  if (!chat) {
306
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.chatList() });
306
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.chatList() });
307
307
  return;
308
308
  }
309
309
  const mine = message.sender_ext_id === me;
@@ -317,7 +317,7 @@ async function applyChatMessage(arbi, queryClient, chatExtId, message) {
317
317
  (m) => m.user.external_id === me ? { ...m, last_read_at: message.created_at } : m
318
318
  ) : chat.members
319
319
  });
320
- if (queryClient.getQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId))) {
320
+ if (queryClient.getQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId))) {
321
321
  try {
322
322
  appendToThread(queryClient, chatExtId, await arbi.chats.decrypt(chat, message));
323
323
  } catch (err) {
@@ -328,7 +328,7 @@ async function applyChatMessage(arbi, queryClient, chatExtId, message) {
328
328
  function applyChatRead(arbi, queryClient, chatExtId, userExtId, lastReadAt) {
329
329
  const me = myChatId(arbi);
330
330
  queryClient.setQueryData(
331
- chunkRRWAX52L_cjs.arbiQueryKeys.chatList(),
331
+ chunkG76ASVVH_cjs.arbiQueryKeys.chatList(),
332
332
  (old) => old?.map(
333
333
  (c) => c.external_id !== chatExtId ? c : {
334
334
  ...c,
@@ -354,11 +354,11 @@ async function applyChatUpdated(arbi, queryClient, chatExtId, message) {
354
354
  }
355
355
  upsertChat(queryClient, chat);
356
356
  if (!message)
357
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.chatThread(chatExtId) });
357
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.chatThread(chatExtId) });
358
358
  }
359
359
  function applyAgentDmStatus(queryClient, status) {
360
360
  if (!["queued", "working", "done", "failed"].includes(status.status)) return;
361
- queryClient.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.agentDmStatus(status.agent_ext_id), status);
361
+ queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.agentDmStatus(status.agent_ext_id), status);
362
362
  }
363
363
  async function applyChatEvent(arbi, queryClient, event) {
364
364
  const e = event;
@@ -373,13 +373,13 @@ async function applyChatEvent(arbi, queryClient, event) {
373
373
 
374
374
  // src/calls/keys.ts
375
375
  function serverCallsExperimental(queryClient) {
376
- return queryClient.getQueryData(chunkRRWAX52L_cjs.callQueryKeys.config())?.experimental !== false;
376
+ return queryClient.getQueryData(chunkG76ASVVH_cjs.callQueryKeys.config())?.experimental !== false;
377
377
  }
378
378
  function invalidateCall(queryClient, message) {
379
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.callQueryKeys.call(message.call_ext_id) });
379
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.callQueryKeys.call(message.call_ext_id) });
380
380
  const thread = message.log_conversation_ext_id;
381
381
  if (thread) {
382
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.conversationActivity(thread) });
382
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.conversationActivity(thread) });
383
383
  }
384
384
  }
385
385
 
@@ -630,19 +630,19 @@ function applyCallEvent(queryClient, event, options = {}) {
630
630
  }
631
631
  case "call.recording": {
632
632
  if (callExtId)
633
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.callQueryKeys.recordingsOf(callExtId) });
633
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recordingsOf(callExtId) });
634
634
  const state2 = browser.calls.recordingStateFrom(m);
635
635
  relay("call.recording", callExtId && state2 ? { ...state2, call_ext_id: callExtId } : null);
636
636
  return true;
637
637
  }
638
638
  case "call.recording_updated": {
639
639
  if (callExtId)
640
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.callQueryKeys.recordingsOf(callExtId) });
640
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recordingsOf(callExtId) });
641
641
  return true;
642
642
  }
643
643
  case "call.recording_deleted": {
644
644
  if (callExtId)
645
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.callQueryKeys.recordingsOf(callExtId) });
645
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recordingsOf(callExtId) });
646
646
  const recordingExtId = str(m.recording_ext_id);
647
647
  relay(
648
648
  "call.recording_deleted",
@@ -683,11 +683,11 @@ function useProfile(options) {
683
683
  const { client, enabled } = useAccountClient();
684
684
  const qc = reactQuery.useQueryClient();
685
685
  react.useEffect(
686
- () => client.onProfileChange(() => qc.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.profile(), client.profile())),
686
+ () => client.onProfileChange(() => qc.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.profile(), client.profile())),
687
687
  [client, qc]
688
688
  );
689
689
  return reactQuery.useQuery({
690
- queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.profile(),
690
+ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.profile(),
691
691
  queryFn: () => client.profile(),
692
692
  enabled: (options?.enabled ?? true) && enabled,
693
693
  staleTime: Infinity
@@ -702,9 +702,9 @@ function useUpdateProfile() {
702
702
  return client.profile();
703
703
  },
704
704
  onSuccess: (profile) => {
705
- qc.setQueryData(chunkRRWAX52L_cjs.arbiQueryKeys.profile(), profile);
706
- void qc.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.identity() });
707
- return qc.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.workspaces() });
705
+ qc.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.profile(), profile);
706
+ void qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.identity() });
707
+ return qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.workspaces() });
708
708
  }
709
709
  });
710
710
  }
@@ -806,7 +806,7 @@ function arbiAccountClient(arbi, overrides = {}) {
806
806
  if (everywhere) await arbi.sessions.logoutAll();
807
807
  else await arbi.logout();
808
808
  } finally {
809
- chunk2JQ7QNOO_cjs.clearSealedDrafts();
809
+ chunkX7JXQT6F_cjs.clearSealedDrafts();
810
810
  }
811
811
  },
812
812
  requestDeletion: () => arbi.account.requestDeletion(),
@@ -850,7 +850,7 @@ var NO_ACCOUNT = {
850
850
  };
851
851
  var ALWAYS = () => true;
852
852
  function useAccountClient() {
853
- const { account, arbi } = chunkYRY6DGRU_cjs.useArbiHost();
853
+ const { account, arbi } = chunkY7S2SQH3_cjs.useArbiHost();
854
854
  const fallback = react.useMemo(() => arbi ? arbiAccountClient(arbi) : null, [arbi]);
855
855
  const useEnabled = account?.useEnabled ?? ALWAYS;
856
856
  const enabled = useEnabled();
@@ -861,9 +861,9 @@ function useAccountClient() {
861
861
  return { client: fallback, enabled: arbi.isLoggedIn };
862
862
  }
863
863
  function useEntitlements() {
864
- const arbi = chunkYRY6DGRU_cjs.useArbi();
864
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
865
865
  return reactQuery.useQuery({
866
- queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.entitlements(),
866
+ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.entitlements(),
867
867
  queryFn: () => arbi.account.entitlements(),
868
868
  enabled: arbi.isLoggedIn,
869
869
  // A plan change shows on the next read; the API enforces it at once either way.
@@ -992,7 +992,7 @@ function ensureMeetingChat(arbi, queryClient, callExtId, callKey) {
992
992
  });
993
993
  if (!ref) throw new Error("The server did not return a meeting chat");
994
994
  if (ref.kind === "chat")
995
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.arbiQueryKeys.chatList() });
995
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.chatList() });
996
996
  else void invalidateConversationLists(queryClient);
997
997
  return ref;
998
998
  })();
@@ -1998,9 +1998,9 @@ async function transcribeRecording(params) {
1998
1998
  return { stored, failed };
1999
1999
  }
2000
2000
  function useCallsConfig() {
2001
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2001
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2002
2002
  const { data } = reactQuery.useQuery({
2003
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.config(),
2003
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.config(),
2004
2004
  queryFn: () => arbi.calls.config(),
2005
2005
  enabled: arbi.isLoggedIn,
2006
2006
  staleTime: 5 * 6e4,
@@ -2018,9 +2018,9 @@ function useCallTranscriptionAvailable() {
2018
2018
  return useCallsConfig()?.transcription_available === true;
2019
2019
  }
2020
2020
  function useCall(callExtId) {
2021
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2021
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2022
2022
  return reactQuery.useQuery({
2023
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.call(callExtId ?? ""),
2023
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.call(callExtId ?? ""),
2024
2024
  queryFn: () => arbi.calls.get(callExtId),
2025
2025
  enabled: !!callExtId && arbi.isLoggedIn,
2026
2026
  staleTime: 6e4,
@@ -2028,18 +2028,18 @@ function useCall(callExtId) {
2028
2028
  });
2029
2029
  }
2030
2030
  function useCallRecordings(callExtId, enabled = true) {
2031
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2031
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2032
2032
  return reactQuery.useQuery({
2033
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.recordings(callExtId ?? ""),
2033
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recordings(callExtId ?? ""),
2034
2034
  queryFn: () => arbi.calls.recording.list(callExtId),
2035
2035
  enabled: !!callExtId && enabled && arbi.isLoggedIn,
2036
2036
  retry: false
2037
2037
  });
2038
2038
  }
2039
2039
  function useCallRecording(callExtId, recordingExtId) {
2040
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2040
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2041
2041
  return reactQuery.useQuery({
2042
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.recording(callExtId ?? "", recordingExtId ?? ""),
2042
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recording(callExtId ?? "", recordingExtId ?? ""),
2043
2043
  queryFn: () => arbi.calls.recording.get(callExtId, recordingExtId),
2044
2044
  enabled: !!callExtId && !!recordingExtId && arbi.isLoggedIn,
2045
2045
  retry: false
@@ -2051,21 +2051,21 @@ function useRecordingWindows(callExtId, enabled) {
2051
2051
  return react.useMemo(() => data ? recordingWindowsOf(data) : NO_WINDOWS, [data]);
2052
2052
  }
2053
2053
  function useCallInviteLinks(callExtId) {
2054
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2054
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2055
2055
  return reactQuery.useQuery({
2056
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.inviteLinks(callExtId ?? ""),
2056
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.inviteLinks(callExtId ?? ""),
2057
2057
  queryFn: () => arbi.calls.inviteLinks.list(callExtId),
2058
2058
  enabled: !!callExtId && arbi.isLoggedIn,
2059
2059
  retry: false
2060
2060
  });
2061
2061
  }
2062
2062
  function useRecordingActions(call) {
2063
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2063
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2064
2064
  const queryClient = reactQuery.useQueryClient();
2065
2065
  return react.useMemo(
2066
2066
  () => ({
2067
2067
  refresh: () => void queryClient.invalidateQueries({
2068
- queryKey: chunkRRWAX52L_cjs.callQueryKeys.recordingsOf(call.external_id)
2068
+ queryKey: chunkG76ASVVH_cjs.callQueryKeys.recordingsOf(call.external_id)
2069
2069
  }),
2070
2070
  open: (recording) => openRecording(arbi, queryClient, call, recording.external_id, recording),
2071
2071
  transcribe: async (opened, onProgress) => transcribeRecording({
@@ -2081,12 +2081,12 @@ function useRecordingActions(call) {
2081
2081
  );
2082
2082
  }
2083
2083
  function useRevokeCallInviteLink(callExtId) {
2084
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2084
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2085
2085
  const queryClient = reactQuery.useQueryClient();
2086
2086
  return react.useCallback(
2087
2087
  async (inviteExtId) => {
2088
2088
  await arbi.calls.inviteLinks.revoke(callExtId, inviteExtId);
2089
- void queryClient.invalidateQueries({ queryKey: chunkRRWAX52L_cjs.callQueryKeys.inviteLinks(callExtId) });
2089
+ void queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.callQueryKeys.inviteLinks(callExtId) });
2090
2090
  },
2091
2091
  [arbi, queryClient, callExtId]
2092
2092
  );
@@ -2143,7 +2143,7 @@ async function saveRecordingFilesToThread(arbi, params) {
2143
2143
  });
2144
2144
  }
2145
2145
  function useSaveToThread() {
2146
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2146
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2147
2147
  const queryClient = reactQuery.useQueryClient();
2148
2148
  return react.useMemo(() => {
2149
2149
  const thenRefresh = async (run) => {
@@ -2430,9 +2430,9 @@ function isWorkspaceGuestOf(workspaces, workspaceExtId, me) {
2430
2430
  return workspace?.users?.find((wu) => wu.user.external_id === me)?.role === "guest";
2431
2431
  }
2432
2432
  function useMeetingReadOnly(lockedWorkspaceExtId) {
2433
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2433
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2434
2434
  const me = arbi.isLoggedIn ? arbi.user.identity()?.externalId ?? null : null;
2435
- const { data: workspaces } = chunk2JQ7QNOO_cjs.useWorkspaces({
2435
+ const { data: workspaces } = chunkX7JXQT6F_cjs.useWorkspaces({
2436
2436
  enabled: !!lockedWorkspaceExtId && arbi.isLoggedIn
2437
2437
  });
2438
2438
  return isWorkspaceGuestOf(
@@ -2455,9 +2455,9 @@ function useCanHostCalls() {
2455
2455
  return callsEnabled && entitled;
2456
2456
  }
2457
2457
  function useOpenCallMeetingChat() {
2458
- const arbi = chunkYRY6DGRU_cjs.useArbi();
2458
+ const arbi = chunkY7S2SQH3_cjs.useArbi();
2459
2459
  const queryClient = reactQuery.useQueryClient();
2460
- const open = chunkYRY6DGRU_cjs.useArbiHost().calls?.openMeetingChat;
2460
+ const open = chunkY7S2SQH3_cjs.useArbiHost().calls?.openMeetingChat;
2461
2461
  return react.useCallback(
2462
2462
  async (target) => {
2463
2463
  try {
@@ -2667,5 +2667,5 @@ exports.useUpdateUserSettings = useUpdateUserSettings;
2667
2667
  exports.useUserSettings = useUserSettings;
2668
2668
  exports.wrapTrackKey = wrapTrackKey;
2669
2669
  exports.writeSamples = writeSamples;
2670
- //# sourceMappingURL=chunk-3CVY5SGY.cjs.map
2671
- //# sourceMappingURL=chunk-3CVY5SGY.cjs.map
2670
+ //# sourceMappingURL=chunk-4E737GNX.cjs.map
2671
+ //# sourceMappingURL=chunk-4E737GNX.cjs.map