@arbidocs/react 0.5.131 → 0.5.133

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkPDE246CA_cjs = require('../chunk-PDE246CA.cjs');
4
- var chunkPH3RGDYE_cjs = require('../chunk-PH3RGDYE.cjs');
4
+ var chunkMDSWUCCL_cjs = require('../chunk-MDSWUCCL.cjs');
5
5
  var chunk3AADNIOK_cjs = require('../chunk-3AADNIOK.cjs');
6
6
  var chunkFE6ZSNZE_cjs = require('../chunk-FE6ZSNZE.cjs');
7
7
  require('../chunk-N73IMVFF.cjs');
@@ -331,7 +331,7 @@ function useArtifactVersions(workspaceId, docId) {
331
331
  () => (documents ?? []).find((d) => d.external_id === plainId),
332
332
  [documents, plainId]
333
333
  );
334
- const { data: history } = chunkPH3RGDYE_cjs.useDocumentVersionList(plainId, {
334
+ const { data: history } = chunkMDSWUCCL_cjs.useDocumentVersionList(plainId, {
335
335
  enabled: !!plainId && documents !== void 0 && !listed
336
336
  });
337
337
  return react.useMemo(
package/dist/billing.js CHANGED
@@ -13,6 +13,20 @@ function useInvalidateProjects() {
13
13
  const qc = useQueryClient();
14
14
  return () => qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() });
15
15
  }
16
+ function useProjectBillingCache() {
17
+ const qc = useQueryClient();
18
+ return {
19
+ publish: (project) => qc.setQueryData(
20
+ arbiQueryKeys.projects(),
21
+ (rows) => rows?.map((row) => row.external_id === project.external_id ? project : row)
22
+ ),
23
+ invalidate: () => Promise.all([
24
+ qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() }),
25
+ qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() }),
26
+ qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })
27
+ ])
28
+ };
29
+ }
16
30
  function useProducts(options) {
17
31
  const arbi = useArbi();
18
32
  return useQuery({
@@ -175,6 +189,24 @@ import {
175
189
  POLL_EVERY_MS,
176
190
  STILL_WORKING
177
191
  } from "./charge-watch.js";
192
+ function useConfirmProjectSpendLimits() {
193
+ const arbi = useArbi();
194
+ const qc = useQueryClient();
195
+ return useMutation({
196
+ mutationFn: ({
197
+ projectExtId,
198
+ body
199
+ }) => arbi.projects.confirmSpendLimits(projectExtId, body),
200
+ onSuccess: (project) => {
201
+ qc.setQueryData(
202
+ arbiQueryKeys.projects(),
203
+ (old) => Array.isArray(old) ? old.map((item) => item.external_id === project.external_id ? project : item) : old
204
+ );
205
+ refreshProjects(qc);
206
+ },
207
+ onError: () => refreshProjects(qc)
208
+ });
209
+ }
178
210
  export {
179
211
  POLL_EVERY_MS,
180
212
  SLOW_AFTER_MS,
@@ -184,6 +216,7 @@ export {
184
216
  useCancelProjectSubscription,
185
217
  useChangeProjectPlan,
186
218
  useChargeWatch,
219
+ useConfirmProjectSpendLimits,
187
220
  useCreateProject,
188
221
  useCreateProjectCheckout,
189
222
  useDeleteProject,
@@ -192,6 +225,7 @@ export {
192
225
  usePlanQuote,
193
226
  usePreviewProjectPlanChange,
194
227
  useProducts,
228
+ useProjectBillingCache,
195
229
  useProjectBillingPortal,
196
230
  useRefreshProject,
197
231
  useUpdateProjectAddonSettings,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/billing.ts"],
4
- "sourcesContent": ["/**\n * Plans and billing of a project: the plans on sale, the taxed price of a purchase or a change,\n * Stripe checkout and the billing portal, add-on blocks and their settings, plan changes and\n * cancellation. Every write that changes a project refreshes the project list\n * (`arbiQueryKeys.projects()`); those that change what the user may do refresh the user settings\n * and the workspace list too.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type {\n ProjectAddonKind,\n ProjectAddonSettingsRequest,\n ProjectCheckoutRequest,\n ProjectCreateOptions,\n ProjectNextPeriodAddonsRequest,\n ProjectPlanChangeRequest,\n ProjectQuoteRequest,\n} from '@arbidocs/sdk/browser'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './hooks'\n\n/** Refresh the projects, and with `wide` the user settings and workspaces they gate. */\nfunction refreshProjects(qc: QueryClient, wide = false) {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n if (wide) {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n }\n}\n\n/**\n * Prices are not retried on a real failure (the UI says what failed), but a request aborted before\n * it ran (a remount cancels it, e.g. React StrictMode) runs again.\n */\nconst retryAbortOnly = (failureCount: number, error: unknown) =>\n failureCount < 1 && (error as { name?: string } | null)?.name === 'AbortError'\n\n/** Refresh the project list now (e.g. a paid project to list before its refresh returns). */\nexport function useInvalidateProjects(): () => Promise<void> {\n const qc = useQueryClient()\n return () => qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n}\n\n/** The plans and add-ons on sale, with their prices. */\nexport function useProducts(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.products(),\n queryFn: () => arbi.projects.products(),\n staleTime: 5 * 60_000,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\nexport interface CreateProjectVars extends ProjectCreateOptions {\n name: string\n plan?: 'free' | 'pro'\n /** Also create the project's first (encrypted) workspace, of the project's name. */\n workspace?: { description?: string | null }\n}\n\ntype CreatedProjectResponse = Awaited<ReturnType<Arbi['projects']['create']>>\ntype CreatedWorkspaceResponse = Awaited<ReturnType<Arbi['workspaces']['create']>>\n\n/** A created project, with its first workspace when one was asked for. */\nexport type CreatedProject = CreatedProjectResponse & { workspace?: CreatedWorkspaceResponse }\n\n/**\n * Create a project (Free is usable at once; Pro is pending until its checkout completes), with its\n * first workspace if asked. The project and workspace lists show them at once (updated in place,\n * then refetched); selecting the workspace is the caller's.\n */\nexport function useCreateProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({ name, plan, workspace, ...details }: CreateProjectVars) => {\n const project: CreatedProject = await arbi.projects.create(name, plan, details)\n if (workspace) {\n project.workspace = await arbi.workspaces.create(\n name,\n project.external_id,\n workspace.description ?? null\n )\n }\n return project\n },\n onSuccess: async ({ workspace, ...project }) => {\n // A list fetch that started before the project existed must not land over the update.\n await Promise.all([\n qc.cancelQueries({ queryKey: arbiQueryKeys.projects() }),\n qc.cancelQueries({ queryKey: arbiQueryKeys.workspaces() }),\n ])\n const id = (item: { external_id: string }) => item.external_id\n qc.setQueryData(arbiQueryKeys.projects(), (old: unknown) =>\n Array.isArray(old) ? [project, ...old.filter((p) => id(p) !== project.external_id)] : old\n )\n if (workspace) {\n const listed = { ...workspace, project_ext_id: project.external_id }\n qc.setQueryData(arbiQueryKeys.workspaces(), (old: unknown) =>\n Array.isArray(old) ? [listed, ...old.filter((w) => id(w) !== workspace.external_id)] : old\n )\n }\n refreshProjects(qc, true)\n },\n })\n}\n\n/** Delete an empty project (no workspaces, no subscription). */\nexport function useDeleteProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.delete(projectExtId),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Re-read a project's subscription from Stripe (after a checkout completes). */\nexport function useRefreshProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.refresh(projectExtId),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Start an embedded Stripe checkout for a project; resolves to its `client_secret`. */\nexport function useCreateProjectCheckout() {\n const arbi = useArbi()\n return useMutation({\n mutationFn: ({ projectExtId, body }: { projectExtId: string; body: ProjectCheckoutRequest }) =>\n arbi.projects.checkout(projectExtId, body),\n })\n}\n\n/**\n * Switch a Pro project between monthly and annual billing at the end of the period; the current\n * interval clears a pending switch, and resumes a project set to cancel. Resolves to the project.\n */\nexport function useChangeProjectPlan() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectPlanChangeRequest\n }) => arbi.projects.changePlan(projectExtId, body),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Move a Pro project to Free at the end of the period (no refunds). */\nexport function useCancelProjectSubscription() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.cancelSubscription(projectExtId),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() })\n },\n })\n}\n\n/** What a plan change would charge now and at the first renewal. `null` skips. */\nexport function usePreviewProjectPlanChange(\n projectExtId: string,\n change: { packs: number; interval: 'month' | 'year' } | null\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'preview', projectExtId, change],\n queryFn: () => arbi.projects.previewPlanChange(projectExtId, change!),\n enabled: !!change && arbi.isLoggedIn,\n staleTime: 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/**\n * The taxed total of a Pro purchase for a billing address: for a new project without\n * `projectExtId`, else for that (Free) project. 422 `TAX_LOCATION_INVALID` asks for a ZIP /\n * postcode; 429 `QUOTE_RATE_LIMITED`. `null` skips.\n */\nexport function usePlanQuote(\n projectExtId: string | null | undefined,\n body: ProjectQuoteRequest | null\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'plan', projectExtId ?? null, body],\n queryFn: () => arbi.projects.quotePlan(projectExtId ?? null, body!),\n enabled: !!body && arbi.isLoggedIn,\n staleTime: 5 * 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/** What one more add-on block costs now and at renewal, taxed for the saved address. */\nexport function useAddonQuote(projectExtId: string, kind: ProjectAddonKind, enabled = true) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'addon', projectExtId, kind],\n queryFn: () => arbi.projects.quoteAddon(projectExtId, kind),\n enabled: enabled && arbi.isLoggedIn,\n staleTime: 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/** A fresh, short-lived Stripe customer-portal link for a project; open it as soon as it arrives. */\nexport function useProjectBillingPortal() {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.billingPortal(projectExtId),\n })\n}\n\n/**\n * Buy one add-on block (AI usage or storage) on a Pro project, charged now and renewed every period\n * until reduced. `status: 'requires_action'` comes with a `confirm_url` (3-D Secure).\n */\nexport function useAddProjectAddonBlock() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ projectExtId, kind }: { projectExtId: string; kind: ProjectAddonKind }) =>\n arbi.projects.addAddonBlock(projectExtId, kind),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\n/** How many add-on blocks to keep from the next period (reductions only). */\nexport function useUpdateProjectNextPeriodAddons() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectNextPeriodAddonsRequest\n }) => arbi.projects.setNextPeriodAddons(projectExtId, body),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\n/** A Pro project's add-on settings: the auto top-up threshold and the monthly usage cap. */\nexport function useUpdateProjectAddonSettings() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectAddonSettingsRequest\n }) => arbi.projects.updateAddonSettings(projectExtId, body),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\nexport {\n useChargeWatch,\n useIsSlow,\n SLOW_AFTER_MS,\n POLL_EVERY_MS,\n STILL_WORKING,\n} from './charge-watch'\n\nexport type {\n ProjectResponse,\n ProductResponse,\n TaxQuoteResponse,\n ProjectAddon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W,MAAM,gBAAgB,EAAE;AAAA,EACrC,CAAC;AACH;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
4
+ "sourcesContent": ["/**\n * Plans and billing of a project: the plans on sale, the taxed price of a purchase or a change,\n * Stripe checkout and the billing portal, add-on blocks and their settings, plan changes and\n * cancellation. Every write that changes a project refreshes the project list\n * (`arbiQueryKeys.projects()`); those that change what the user may do refresh the user settings\n * and the workspace list too.\n *\n * Requires an `ArbiHost` (with an `arbi`) and a React Query client above it.\n */\n\nimport { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport type {\n ProjectAddonKind,\n ProjectAddonSettingsRequest,\n ProjectCheckoutRequest,\n ProjectCreateOptions,\n ProjectNextPeriodAddonsRequest,\n ProjectPlanChangeRequest,\n ProjectQuoteRequest,\n ProjectResponse,\n} from '@arbidocs/sdk/browser'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\nimport { arbiQueryKeys } from './hooks'\n\n/** Refresh the projects, and with `wide` the user settings and workspaces they gate. */\nfunction refreshProjects(qc: QueryClient, wide = false) {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n if (wide) {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n }\n}\n\n/**\n * Prices are not retried on a real failure (the UI says what failed), but a request aborted before\n * it ran (a remount cancels it, e.g. React StrictMode) runs again.\n */\nconst retryAbortOnly = (failureCount: number, error: unknown) =>\n failureCount < 1 && (error as { name?: string } | null)?.name === 'AbortError'\n\n/** Refresh the project list now (e.g. a paid project to list before its refresh returns). */\nexport function useInvalidateProjects(): () => Promise<void> {\n const qc = useQueryClient()\n return () => qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n}\n\n/** Keep confirmed billing responses in sync while an inline editor applies several operations. */\nexport function useProjectBillingCache() {\n const qc = useQueryClient()\n return {\n publish: (project: ProjectResponse) =>\n qc.setQueryData<ProjectResponse[]>(arbiQueryKeys.projects(), (rows) =>\n rows?.map((row) => (row.external_id === project.external_id ? project : row))\n ),\n invalidate: () =>\n Promise.all([\n qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() }),\n qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() }),\n ]),\n }\n}\n\n/** The plans and add-ons on sale, with their prices. */\nexport function useProducts(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.products(),\n queryFn: () => arbi.projects.products(),\n staleTime: 5 * 60_000,\n enabled: (options?.enabled ?? true) && arbi.isLoggedIn,\n })\n}\n\nexport interface CreateProjectVars extends ProjectCreateOptions {\n name: string\n plan?: 'free' | 'pro'\n /** Also create the project's first (encrypted) workspace, of the project's name. */\n workspace?: { description?: string | null }\n}\n\ntype CreatedProjectResponse = Awaited<ReturnType<Arbi['projects']['create']>>\ntype CreatedWorkspaceResponse = Awaited<ReturnType<Arbi['workspaces']['create']>>\n\n/** A created project, with its first workspace when one was asked for. */\nexport type CreatedProject = CreatedProjectResponse & { workspace?: CreatedWorkspaceResponse }\n\n/**\n * Create a project (Free is usable at once; Pro is pending until its checkout completes), with its\n * first workspace if asked. The project and workspace lists show them at once (updated in place,\n * then refetched); selecting the workspace is the caller's.\n */\nexport function useCreateProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: async ({ name, plan, workspace, ...details }: CreateProjectVars) => {\n const project: CreatedProject = await arbi.projects.create(name, plan, details)\n if (workspace) {\n project.workspace = await arbi.workspaces.create(\n name,\n project.external_id,\n workspace.description ?? null\n )\n }\n return project\n },\n onSuccess: async ({ workspace, ...project }) => {\n // A list fetch that started before the project existed must not land over the update.\n await Promise.all([\n qc.cancelQueries({ queryKey: arbiQueryKeys.projects() }),\n qc.cancelQueries({ queryKey: arbiQueryKeys.workspaces() }),\n ])\n const id = (item: { external_id: string }) => item.external_id\n qc.setQueryData(arbiQueryKeys.projects(), (old: unknown) =>\n Array.isArray(old) ? [project, ...old.filter((p) => id(p) !== project.external_id)] : old\n )\n if (workspace) {\n const listed = { ...workspace, project_ext_id: project.external_id }\n qc.setQueryData(arbiQueryKeys.workspaces(), (old: unknown) =>\n Array.isArray(old) ? [listed, ...old.filter((w) => id(w) !== workspace.external_id)] : old\n )\n }\n refreshProjects(qc, true)\n },\n })\n}\n\n/** Delete an empty project (no workspaces, no subscription). */\nexport function useDeleteProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.delete(projectExtId),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Re-read a project's subscription from Stripe (after a checkout completes). */\nexport function useRefreshProject() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.refresh(projectExtId),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Start an embedded Stripe checkout for a project; resolves to its `client_secret`. */\nexport function useCreateProjectCheckout() {\n const arbi = useArbi()\n return useMutation({\n mutationFn: ({ projectExtId, body }: { projectExtId: string; body: ProjectCheckoutRequest }) =>\n arbi.projects.checkout(projectExtId, body),\n })\n}\n\n/**\n * Switch a Pro project between monthly and annual billing at the end of the period; the current\n * interval clears a pending switch, and resumes a project set to cancel. Resolves to the project.\n */\nexport function useChangeProjectPlan() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectPlanChangeRequest\n }) => arbi.projects.changePlan(projectExtId, body),\n onSuccess: () => refreshProjects(qc, true),\n })\n}\n\n/** Move a Pro project to Free at the end of the period (no refunds). */\nexport function useCancelProjectSubscription() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.cancelSubscription(projectExtId),\n onSuccess: () => {\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.projects() })\n void qc.invalidateQueries({ queryKey: arbiQueryKeys.userSettings() })\n },\n })\n}\n\n/** What a plan change would charge now and at the first renewal. `null` skips. */\nexport function usePreviewProjectPlanChange(\n projectExtId: string,\n change: { packs: number; interval: 'month' | 'year' } | null\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'preview', projectExtId, change],\n queryFn: () => arbi.projects.previewPlanChange(projectExtId, change!),\n enabled: !!change && arbi.isLoggedIn,\n staleTime: 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/**\n * The taxed total of a Pro purchase for a billing address: for a new project without\n * `projectExtId`, else for that (Free) project. 422 `TAX_LOCATION_INVALID` asks for a ZIP /\n * postcode; 429 `QUOTE_RATE_LIMITED`. `null` skips.\n */\nexport function usePlanQuote(\n projectExtId: string | null | undefined,\n body: ProjectQuoteRequest | null\n) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'plan', projectExtId ?? null, body],\n queryFn: () => arbi.projects.quotePlan(projectExtId ?? null, body!),\n enabled: !!body && arbi.isLoggedIn,\n staleTime: 5 * 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/** What one more add-on block costs now and at renewal, taxed for the saved address. */\nexport function useAddonQuote(projectExtId: string, kind: ProjectAddonKind, enabled = true) {\n const arbi = useArbi()\n return useQuery({\n queryKey: [...arbiQueryKeys.billingQuotes(), 'addon', projectExtId, kind],\n queryFn: () => arbi.projects.quoteAddon(projectExtId, kind),\n enabled: enabled && arbi.isLoggedIn,\n staleTime: 60_000,\n retry: retryAbortOnly,\n })\n}\n\n/** A fresh, short-lived Stripe customer-portal link for a project; open it as soon as it arrives. */\nexport function useProjectBillingPortal() {\n const arbi = useArbi()\n return useMutation({\n mutationFn: (projectExtId: string) => arbi.projects.billingPortal(projectExtId),\n })\n}\n\n/**\n * Buy one add-on block (AI usage or storage) on a Pro project, charged now and renewed every period\n * until reduced. `status: 'requires_action'` comes with a `confirm_url` (3-D Secure).\n */\nexport function useAddProjectAddonBlock() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({ projectExtId, kind }: { projectExtId: string; kind: ProjectAddonKind }) =>\n arbi.projects.addAddonBlock(projectExtId, kind),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\n/** How many add-on blocks to keep from the next period (reductions only). */\nexport function useUpdateProjectNextPeriodAddons() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectNextPeriodAddonsRequest\n }) => arbi.projects.setNextPeriodAddons(projectExtId, body),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\n/** A Pro project's add-on settings: the auto top-up threshold and the monthly usage cap. */\nexport function useUpdateProjectAddonSettings() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: ProjectAddonSettingsRequest\n }) => arbi.projects.updateAddonSettings(projectExtId, body),\n onSuccess: () => refreshProjects(qc),\n })\n}\n\nexport {\n useChargeWatch,\n useIsSlow,\n SLOW_AFTER_MS,\n POLL_EVERY_MS,\n STILL_WORKING,\n} from './charge-watch'\n\nexport type {\n ProjectResponse,\n ProductResponse,\n TaxQuoteResponse,\n ProjectAddonKind,\n ProjectQuoteRequest,\n ProjectCheckoutRequest,\n ProjectPlanChangeRequest,\n ProjectInvoicesResponse,\n ProjectUsageResponse,\n} from '@arbidocs/sdk/browser'\n\n/** Confirm both spending limits atomically and refresh the project's shared state. */\nexport function useConfirmProjectSpendLimits() {\n const arbi = useArbi()\n const qc = useQueryClient()\n return useMutation({\n mutationFn: ({\n projectExtId,\n body,\n }: {\n projectExtId: string\n body: import('@arbidocs/client').components['schemas']['ProjectSpendLimitsRequest']\n }) => arbi.projects.confirmSpendLimits(projectExtId, body),\n onSuccess: (project) => {\n qc.setQueryData(arbiQueryKeys.projects(), (old: unknown) =>\n Array.isArray(old)\n ? old.map((item) => (item.external_id === project.external_id ? project : item))\n : old\n )\n refreshProjects(qc)\n },\n onError: () => refreshProjects(qc),\n })\n}\n"],
5
+ "mappings": "AAUA,SAAS,aAAa,UAAU,sBAAwC;AAYxE,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAG9B,SAAS,gBAAgB,IAAiB,OAAO,OAAO;AACtD,OAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAChE,MAAI,MAAM;AACR,SAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,aAAa,EAAE,CAAC;AACpE,SAAK,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,EACpE;AACF;AAMA,MAAM,iBAAiB,CAAC,cAAsB,UAC5C,eAAe,KAAM,OAAoC,SAAS;AAG7D,SAAS,wBAA6C;AAC3D,QAAM,KAAK,eAAe;AAC1B,SAAO,MAAM,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAC1E;AAGO,SAAS,yBAAyB;AACvC,QAAM,KAAK,eAAe;AAC1B,SAAO;AAAA,IACL,SAAS,CAAC,YACR,GAAG;AAAA,MAAgC,cAAc,SAAS;AAAA,MAAG,CAAC,SAC5D,MAAM,IAAI,CAAC,QAAS,IAAI,gBAAgB,QAAQ,cAAc,UAAU,GAAI;AAAA,IAC9E;AAAA,IACF,YAAY,MACV,QAAQ,IAAI;AAAA,MACV,GAAG,kBAAkB,EAAE,UAAU,cAAc,SAAS,EAAE,CAAC;AAAA,MAC3D,GAAG,kBAAkB,EAAE,UAAU,cAAc,aAAa,EAAE,CAAC;AAAA,MAC/D,GAAG,kBAAkB,EAAE,UAAU,cAAc,WAAW,EAAE,CAAC;AAAA,IAC/D,CAAC;AAAA,EACL;AACF;AAGO,SAAS,YAAY,SAAiC;AAC3D,QAAM,OAAO,QAAQ;AACrB,SAAO,SAA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AAA,IAChD,WAAW,MAAM,gBAAgB,EAAE;AAAA,EACrC,CAAC;AACH;AAGO,SAAS,mCAAmC;AACjD,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGM,KAAK,SAAS,oBAAoB,cAAc,IAAI;AAAA,IAC1D,WAAW,MAAM,gBAAgB,EAAE;AAAA,EACrC,CAAC;AACH;AAGO,SAAS,gCAAgC;AAC9C,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGM,KAAK,SAAS,oBAAoB,cAAc,IAAI;AAAA,IAC1D,WAAW,MAAM,gBAAgB,EAAE;AAAA,EACrC,CAAC;AACH;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeA,SAAS,+BAA+B;AAC7C,QAAM,OAAO,QAAQ;AACrB,QAAM,KAAK,eAAe;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGM,KAAK,SAAS,mBAAmB,cAAc,IAAI;AAAA,IACzD,WAAW,CAAC,YAAY;AACtB,SAAG;AAAA,QAAa,cAAc,SAAS;AAAA,QAAG,CAAC,QACzC,MAAM,QAAQ,GAAG,IACb,IAAI,IAAI,CAAC,SAAU,KAAK,gBAAgB,QAAQ,cAAc,UAAU,IAAK,IAC7E;AAAA,MACN;AACA,sBAAgB,EAAE;AAAA,IACpB;AAAA,IACA,SAAS,MAAM,gBAAgB,EAAE;AAAA,EACnC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ import { getUserDisplayName } from "../users/user-display.js";
5
5
  import { ensureMeetingChat, meetingChatRefFrom } from "./meeting-chat.js";
6
6
  import { transcriptSegmentOf } from "./transcript-format.js";
7
7
  const CALL_CHAT_TOPIC = "arbi.chat";
8
- const READ_ONLY_MEETING_TEXT = "Read only: you can\u2019t post in this meeting chat";
8
+ const READ_ONLY_MEETING_TEXT = "Viewer: you can\u2019t post in this meeting chat";
9
9
  const CALL_CHAT_MAX_CHARS = 4e3;
10
10
  const encoder = new TextEncoder();
11
11
  const decoder = new TextDecoder();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/calls/in-call-chat.ts"],
4
- "sourcesContent": ["/**\n * In-call chat (ARBI `docs/meeting-chats-plan.md` \u00A74).\n *\n * Live: each message goes over the LiveKit data channel (reliable, topic {@link CALL_CHAT_TOPIC})\n * as `base64(nonce \u2016 secretbox(json, K))` \u2014 K is the call's frame key, so the SFU, which never\n * holds K, only forwards ciphertext (media E2EE does not cover data packets).\n *\n * Persisted: a signed-in member's message is also posted to the call's meeting chat\n * ({@link ensureMeetingChat}, made lazily on the first one): an E2E chat message under the chat\n * key, or a comment in the workspace meeting thread (encrypted by the server with the workspace\n * key). A workspace guest on a thread call can read the meeting chat but not post to it: the panel\n * is read-only for them.\n */\n\nimport { decryptWithChatKey, encryptWithChatKey } from '@arbidocs/client'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { ArbiApiError, type Arbi } from '@arbidocs/sdk/browser'\nimport { cachedChat, type ChatResponse } from '../directmessages/chat-cache'\nimport { getUserDisplayName } from '../users/user-display'\nimport { ensureMeetingChat, meetingChatRefFrom, type MeetingChatRef } from './meeting-chat'\nimport { transcriptSegmentOf } from './transcript-format'\n\nexport const CALL_CHAT_TOPIC = 'arbi.chat'\n/** What a workspace guest sees instead of a composer in a thread call's meeting chat. */\nexport const READ_ONLY_MEETING_TEXT = 'Read only: you can\u2019t post in this meeting chat'\n/** Longest message accepted over the data channel (well under LiveKit's reliable-packet limit). */\nexport const CALL_CHAT_MAX_CHARS = 4000\n\n/** What one data packet carries, encrypted under K. */\nexport interface CallChatPacket {\n v: 1\n /** Random id, so a sender's echo and a re-delivery deduplicate. */\n id: string\n text: string\n /** Sender clock, ms since epoch. */\n at: number\n}\n\n/** One line of the in-call chat panel. */\nexport interface CallChatLine {\n id: string\n senderIdentity: string\n senderName: string\n text: string\n at: number\n mine: boolean\n /**\n * `live`: data channel only (received from someone else, or not kept); `saving` / `saved` /\n * `unsaved`: my own message and its persistence; `history`: loaded from the meeting chat.\n */\n status: 'live' | 'saving' | 'saved' | 'unsaved' | 'history'\n}\n\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\nexport function newPacketId(): string {\n const bytes = new Uint8Array(8)\n globalThis.crypto.getRandomValues(bytes)\n return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('')\n}\n\n/** Encrypt a chat packet under K for `publishData`. */\nexport async function encodeCallChatPacket(\n packet: CallChatPacket,\n callKey: Uint8Array\n): Promise<Uint8Array<ArrayBuffer>> {\n return encoder.encode(await encryptWithChatKey(JSON.stringify(packet), callKey))\n}\n\n/** Open a received packet; null when it is not ours, not under K, or malformed. */\nexport async function decodeCallChatPacket(\n payload: Uint8Array,\n callKey: Uint8Array\n): Promise<CallChatPacket | null> {\n try {\n const parsed: unknown = JSON.parse(await decryptWithChatKey(decoder.decode(payload), callKey))\n if (!parsed || typeof parsed !== 'object') return null\n const p = parsed as Partial<CallChatPacket>\n if (p.v !== 1 || typeof p.id !== 'string' || typeof p.text !== 'string') return null\n const text = p.text.slice(0, CALL_CHAT_MAX_CHARS)\n if (!text.trim()) return null\n return { v: 1, id: p.id, text, at: typeof p.at === 'number' ? p.at : Date.now() }\n } catch {\n return null\n }\n}\n\n/** One of my chats: from the cache when the list has it, else fetched. */\nexport async function chatByExtId(\n arbi: Arbi,\n queryClient: QueryClient,\n chatExtId: string\n): Promise<ChatResponse> {\n return cachedChat(queryClient, chatExtId) ?? arbi.chats.get(chatExtId)\n}\n\n/**\n * Post my message to the meeting chat, making the chat first if the call has none. Throws when it\n * cannot be kept (not a host of the call, the thread's workspace not open, \u2026).\n */\nexport async function persistMeetingMessage(\n arbi: Arbi,\n queryClient: QueryClient,\n callExtId: string,\n callKey: Uint8Array,\n text: string\n): Promise<MeetingChatRef> {\n const ref = await ensureMeetingChat(arbi, queryClient, callExtId, callKey)\n if (ref.kind === 'chat') {\n await arbi.chats.send(await chatByExtId(arbi, queryClient, ref.chatExtId), text)\n } else {\n try {\n await arbi.conversations.postMessage({\n content: text,\n conversation_ext_id: ref.conversationExtId,\n assistant_mode: 'mentioned',\n })\n } catch (err) {\n const status = err instanceof ArbiApiError ? err.status : undefined\n const detail = err instanceof ArbiApiError ? err.detail : undefined\n throw new Error(\n `Could not save the message to the meeting thread (${status ?? '?'})${detail ? `: ${detail}` : ''}`\n )\n }\n }\n return ref\n}\n\n/** A persisted message, before it is matched against live lines. */\nexport interface HistoryMessage {\n id: string\n senderExtId: string | null\n /** Known name, or null to resolve from the room. */\n senderName: string | null\n text: string\n at: number\n}\n\nexport const HISTORY_LIMIT = 50\n\n/**\n * The meeting chat's recent messages (oldest first), decrypted, or null when the call has no\n * meeting chat yet. Never creates one.\n */\nexport async function loadMeetingHistory(\n arbi: Arbi,\n queryClient: QueryClient,\n callExtId: string\n): Promise<{ ref: MeetingChatRef; messages: HistoryMessage[] } | null> {\n const ref = meetingChatRefFrom(await arbi.calls.get(callExtId))\n if (!ref) return null\n if (ref.kind === 'chat') {\n const chat = await chatByExtId(arbi, queryClient, ref.chatExtId)\n const page = await arbi.chats.page(chat)\n const names = new Map(chat.members.map((m) => [m.user.external_id, getUserDisplayName(m.user)]))\n return {\n ref,\n messages: page.messages\n .filter((m) => m.kind === 'text' && !m.decryptFailed && m.content)\n .slice(-HISTORY_LIMIT)\n .map((m) => ({\n id: m.external_id,\n senderExtId: m.sender_ext_id ?? null,\n senderName: (m.sender_ext_id && names.get(m.sender_ext_id)) || null,\n text: m.content ?? '',\n at: Date.parse(m.created_at),\n })),\n }\n }\n // A thread with no messages yet answers 404: nothing to show.\n const data = await arbi.conversations.getThreads(ref.conversationExtId).catch(() => null)\n if (!data) return { ref, messages: [] }\n const seen = new Map<string, HistoryMessage>()\n for (const thread of data.threads) {\n for (const m of thread.history) {\n if (seen.has(m.external_id) || m.role === 'system' || !m.content) continue\n // Transcript lines are captions, not chat.\n if (transcriptSegmentOf(m.tools)) continue\n seen.set(m.external_id, {\n id: m.external_id,\n senderExtId: m.role === 'assistant' ? null : m.created_by_ext_id,\n senderName: m.role === 'assistant' ? 'ARBI' : null,\n text: m.content,\n at: Date.parse(m.created_at),\n })\n }\n }\n return {\n ref,\n messages: [...seen.values()].sort((a, b) => a.at - b.at).slice(-HISTORY_LIMIT),\n }\n}\n\n/** Live and persisted copies of one message within this window are the same message. */\nconst SAME_MESSAGE_MS = 5 * 60 * 1000\n\n/**\n * The panel's lines: history first, then live lines, minus the live lines that a member already\n * persisted (same sender, same text, close in time), ordered by time.\n */\nexport function mergeChatLines(\n history: HistoryMessage[],\n live: CallChatLine[],\n context: { myIdentity: string; nameOf(identity: string): string | null }\n): CallChatLine[] {\n const historyLines: CallChatLine[] = history.map((m) => ({\n id: `h:${m.id}`,\n senderIdentity: m.senderExtId ?? 'arbi',\n senderName: m.senderName ?? (m.senderExtId ? context.nameOf(m.senderExtId) : null) ?? 'Someone',\n text: m.text,\n at: m.at,\n mine: !!m.senderExtId && m.senderExtId === context.myIdentity,\n status: 'history',\n }))\n const used = new Set<number>()\n const liveOnly = live.filter((line) => {\n const match = history.findIndex(\n (m, i) =>\n !used.has(i) &&\n m.senderExtId === line.senderIdentity &&\n m.text === line.text &&\n Math.abs(m.at - line.at) < SAME_MESSAGE_MS\n )\n if (match < 0) return true\n used.add(match)\n return false\n })\n return [...historyLines, ...liveOnly].sort((a, b) => a.at - b.at)\n}\n"],
4
+ "sourcesContent": ["/**\n * In-call chat (ARBI `docs/meeting-chats-plan.md` \u00A74).\n *\n * Live: each message goes over the LiveKit data channel (reliable, topic {@link CALL_CHAT_TOPIC})\n * as `base64(nonce \u2016 secretbox(json, K))` \u2014 K is the call's frame key, so the SFU, which never\n * holds K, only forwards ciphertext (media E2EE does not cover data packets).\n *\n * Persisted: a signed-in member's message is also posted to the call's meeting chat\n * ({@link ensureMeetingChat}, made lazily on the first one): an E2E chat message under the chat\n * key, or a comment in the workspace meeting thread (encrypted by the server with the workspace\n * key). A workspace guest on a thread call can read the meeting chat but not post to it: the panel\n * is read-only for them.\n */\n\nimport { decryptWithChatKey, encryptWithChatKey } from '@arbidocs/client'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { ArbiApiError, type Arbi } from '@arbidocs/sdk/browser'\nimport { cachedChat, type ChatResponse } from '../directmessages/chat-cache'\nimport { getUserDisplayName } from '../users/user-display'\nimport { ensureMeetingChat, meetingChatRefFrom, type MeetingChatRef } from './meeting-chat'\nimport { transcriptSegmentOf } from './transcript-format'\n\nexport const CALL_CHAT_TOPIC = 'arbi.chat'\n/** What a workspace guest sees instead of a composer in a thread call's meeting chat. */\nexport const READ_ONLY_MEETING_TEXT = 'Viewer: you can\u2019t post in this meeting chat'\n/** Longest message accepted over the data channel (well under LiveKit's reliable-packet limit). */\nexport const CALL_CHAT_MAX_CHARS = 4000\n\n/** What one data packet carries, encrypted under K. */\nexport interface CallChatPacket {\n v: 1\n /** Random id, so a sender's echo and a re-delivery deduplicate. */\n id: string\n text: string\n /** Sender clock, ms since epoch. */\n at: number\n}\n\n/** One line of the in-call chat panel. */\nexport interface CallChatLine {\n id: string\n senderIdentity: string\n senderName: string\n text: string\n at: number\n mine: boolean\n /**\n * `live`: data channel only (received from someone else, or not kept); `saving` / `saved` /\n * `unsaved`: my own message and its persistence; `history`: loaded from the meeting chat.\n */\n status: 'live' | 'saving' | 'saved' | 'unsaved' | 'history'\n}\n\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\nexport function newPacketId(): string {\n const bytes = new Uint8Array(8)\n globalThis.crypto.getRandomValues(bytes)\n return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('')\n}\n\n/** Encrypt a chat packet under K for `publishData`. */\nexport async function encodeCallChatPacket(\n packet: CallChatPacket,\n callKey: Uint8Array\n): Promise<Uint8Array<ArrayBuffer>> {\n return encoder.encode(await encryptWithChatKey(JSON.stringify(packet), callKey))\n}\n\n/** Open a received packet; null when it is not ours, not under K, or malformed. */\nexport async function decodeCallChatPacket(\n payload: Uint8Array,\n callKey: Uint8Array\n): Promise<CallChatPacket | null> {\n try {\n const parsed: unknown = JSON.parse(await decryptWithChatKey(decoder.decode(payload), callKey))\n if (!parsed || typeof parsed !== 'object') return null\n const p = parsed as Partial<CallChatPacket>\n if (p.v !== 1 || typeof p.id !== 'string' || typeof p.text !== 'string') return null\n const text = p.text.slice(0, CALL_CHAT_MAX_CHARS)\n if (!text.trim()) return null\n return { v: 1, id: p.id, text, at: typeof p.at === 'number' ? p.at : Date.now() }\n } catch {\n return null\n }\n}\n\n/** One of my chats: from the cache when the list has it, else fetched. */\nexport async function chatByExtId(\n arbi: Arbi,\n queryClient: QueryClient,\n chatExtId: string\n): Promise<ChatResponse> {\n return cachedChat(queryClient, chatExtId) ?? arbi.chats.get(chatExtId)\n}\n\n/**\n * Post my message to the meeting chat, making the chat first if the call has none. Throws when it\n * cannot be kept (not a host of the call, the thread's workspace not open, \u2026).\n */\nexport async function persistMeetingMessage(\n arbi: Arbi,\n queryClient: QueryClient,\n callExtId: string,\n callKey: Uint8Array,\n text: string\n): Promise<MeetingChatRef> {\n const ref = await ensureMeetingChat(arbi, queryClient, callExtId, callKey)\n if (ref.kind === 'chat') {\n await arbi.chats.send(await chatByExtId(arbi, queryClient, ref.chatExtId), text)\n } else {\n try {\n await arbi.conversations.postMessage({\n content: text,\n conversation_ext_id: ref.conversationExtId,\n assistant_mode: 'mentioned',\n })\n } catch (err) {\n const status = err instanceof ArbiApiError ? err.status : undefined\n const detail = err instanceof ArbiApiError ? err.detail : undefined\n throw new Error(\n `Could not save the message to the meeting thread (${status ?? '?'})${detail ? `: ${detail}` : ''}`\n )\n }\n }\n return ref\n}\n\n/** A persisted message, before it is matched against live lines. */\nexport interface HistoryMessage {\n id: string\n senderExtId: string | null\n /** Known name, or null to resolve from the room. */\n senderName: string | null\n text: string\n at: number\n}\n\nexport const HISTORY_LIMIT = 50\n\n/**\n * The meeting chat's recent messages (oldest first), decrypted, or null when the call has no\n * meeting chat yet. Never creates one.\n */\nexport async function loadMeetingHistory(\n arbi: Arbi,\n queryClient: QueryClient,\n callExtId: string\n): Promise<{ ref: MeetingChatRef; messages: HistoryMessage[] } | null> {\n const ref = meetingChatRefFrom(await arbi.calls.get(callExtId))\n if (!ref) return null\n if (ref.kind === 'chat') {\n const chat = await chatByExtId(arbi, queryClient, ref.chatExtId)\n const page = await arbi.chats.page(chat)\n const names = new Map(chat.members.map((m) => [m.user.external_id, getUserDisplayName(m.user)]))\n return {\n ref,\n messages: page.messages\n .filter((m) => m.kind === 'text' && !m.decryptFailed && m.content)\n .slice(-HISTORY_LIMIT)\n .map((m) => ({\n id: m.external_id,\n senderExtId: m.sender_ext_id ?? null,\n senderName: (m.sender_ext_id && names.get(m.sender_ext_id)) || null,\n text: m.content ?? '',\n at: Date.parse(m.created_at),\n })),\n }\n }\n // A thread with no messages yet answers 404: nothing to show.\n const data = await arbi.conversations.getThreads(ref.conversationExtId).catch(() => null)\n if (!data) return { ref, messages: [] }\n const seen = new Map<string, HistoryMessage>()\n for (const thread of data.threads) {\n for (const m of thread.history) {\n if (seen.has(m.external_id) || m.role === 'system' || !m.content) continue\n // Transcript lines are captions, not chat.\n if (transcriptSegmentOf(m.tools)) continue\n seen.set(m.external_id, {\n id: m.external_id,\n senderExtId: m.role === 'assistant' ? null : m.created_by_ext_id,\n senderName: m.role === 'assistant' ? 'ARBI' : null,\n text: m.content,\n at: Date.parse(m.created_at),\n })\n }\n }\n return {\n ref,\n messages: [...seen.values()].sort((a, b) => a.at - b.at).slice(-HISTORY_LIMIT),\n }\n}\n\n/** Live and persisted copies of one message within this window are the same message. */\nconst SAME_MESSAGE_MS = 5 * 60 * 1000\n\n/**\n * The panel's lines: history first, then live lines, minus the live lines that a member already\n * persisted (same sender, same text, close in time), ordered by time.\n */\nexport function mergeChatLines(\n history: HistoryMessage[],\n live: CallChatLine[],\n context: { myIdentity: string; nameOf(identity: string): string | null }\n): CallChatLine[] {\n const historyLines: CallChatLine[] = history.map((m) => ({\n id: `h:${m.id}`,\n senderIdentity: m.senderExtId ?? 'arbi',\n senderName: m.senderName ?? (m.senderExtId ? context.nameOf(m.senderExtId) : null) ?? 'Someone',\n text: m.text,\n at: m.at,\n mine: !!m.senderExtId && m.senderExtId === context.myIdentity,\n status: 'history',\n }))\n const used = new Set<number>()\n const liveOnly = live.filter((line) => {\n const match = history.findIndex(\n (m, i) =>\n !used.has(i) &&\n m.senderExtId === line.senderIdentity &&\n m.text === line.text &&\n Math.abs(m.at - line.at) < SAME_MESSAGE_MS\n )\n if (match < 0) return true\n used.add(match)\n return false\n })\n return [...historyLines, ...liveOnly].sort((a, b) => a.at - b.at)\n}\n"],
5
5
  "mappings": "AAcA,SAAS,oBAAoB,0BAA0B;AAEvD,SAAS,oBAA+B;AACxC,SAAS,kBAAqC;AAC9C,SAAS,0BAA0B;AACnC,SAAS,mBAAmB,0BAA+C;AAC3E,SAAS,2BAA2B;AAE7B,MAAM,kBAAkB;AAExB,MAAM,yBAAyB;AAE/B,MAAM,sBAAsB;AA2BnC,MAAM,UAAU,IAAI,YAAY;AAChC,MAAM,UAAU,IAAI,YAAY;AAEzB,SAAS,cAAsB;AACpC,QAAM,QAAQ,IAAI,WAAW,CAAC;AAC9B,aAAW,OAAO,gBAAgB,KAAK;AACvC,SAAO,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAC1E;AAGA,eAAsB,qBACpB,QACA,SACkC;AAClC,SAAO,QAAQ,OAAO,MAAM,mBAAmB,KAAK,UAAU,MAAM,GAAG,OAAO,CAAC;AACjF;AAGA,eAAsB,qBACpB,S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 
3
- var chunkNT3SMYRP_cjs = require('../../chunk-NT3SMYRP.cjs');
4
- require('../../chunk-PH3RGDYE.cjs');
3
+ var chunkHE4AQEWB_cjs = require('../../chunk-HE4AQEWB.cjs');
4
+ require('../../chunk-MDSWUCCL.cjs');
5
5
  var chunkFE6ZSNZE_cjs = require('../../chunk-FE6ZSNZE.cjs');
6
6
  var chunkIX4HOS5Z_cjs = require('../../chunk-IX4HOS5Z.cjs');
7
7
  require('../../chunk-N73IMVFF.cjs');
@@ -123,8 +123,8 @@ function useCallTranscriber({
123
123
  const arbi = chunkFE6ZSNZE_cjs.useArbi();
124
124
  const queryClient = reactQuery.useQueryClient();
125
125
  const profile = arbi.isLoggedIn ? arbi.user.profile() : null;
126
- const myProfileName = profile && chunkNT3SMYRP_cjs.toProfileView(profile).fullName || null;
127
- const deploymentAvailable = chunkNT3SMYRP_cjs.useCallTranscriptionAvailable();
126
+ const myProfileName = profile && chunkHE4AQEWB_cjs.toProfileView(profile).fullName || null;
127
+ const deploymentAvailable = chunkHE4AQEWB_cjs.useCallTranscriptionAvailable();
128
128
  const available = deploymentAvailable && !!callKey;
129
129
  const [state, setState] = react.useState(null);
130
130
  const [creatorExtId, setCreatorExtId] = react.useState(null);
@@ -167,7 +167,7 @@ function useCallTranscriber({
167
167
  };
168
168
  }, [available, callExtId]);
169
169
  react.useEffect(
170
- () => chunkNT3SMYRP_cjs.onCallEvent("call.transcription", (message) => {
170
+ () => chunkHE4AQEWB_cjs.onCallEvent("call.transcription", (message) => {
171
171
  if (message.call_ext_id === callExtId) applyState(message);
172
172
  }),
173
173
  [callExtId, applyState]
@@ -183,7 +183,7 @@ function useCallTranscriber({
183
183
  const persist = react.useCallback(
184
184
  (segment, speakerNeedsProxy) => {
185
185
  if (!callKey || persisted.current.has(segment.segmentId)) return;
186
- const role = chunkNT3SMYRP_cjs.transcriptPersistRole({
186
+ const role = chunkHE4AQEWB_cjs.transcriptPersistRole({
187
187
  myIdentity,
188
188
  canPost: canPost && (segment.speakerIdentity !== myIdentity || selfPosts.current),
189
189
  hasCallKey: true,
@@ -192,7 +192,7 @@ function useCallTranscriber({
192
192
  });
193
193
  if (!role) return;
194
194
  persisted.current.add(segment.segmentId);
195
- chunkNT3SMYRP_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
195
+ chunkHE4AQEWB_cjs.persistTranscriptSegment(arbi, queryClient, callExtId, callKey, segment).catch(
196
196
  (err) => {
197
197
  persisted.current.delete(segment.segmentId);
198
198
  if (role === "own" && err?.status === 403) {
@@ -212,7 +212,7 @@ function useCallTranscriber({
212
212
  );
213
213
  react.useEffect(() => {
214
214
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
215
- if (topic === chunkNT3SMYRP_cjs.CALL_TRANSCRIPTION_TOPIC) {
215
+ if (topic === chunkHE4AQEWB_cjs.CALL_TRANSCRIPTION_TOPIC) {
216
216
  if (participant || participantIdentity) return;
217
217
  try {
218
218
  const next = browser.calls.transcriptionStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -221,10 +221,10 @@ function useCallTranscriber({
221
221
  }
222
222
  return;
223
223
  }
224
- if (topic !== chunkNT3SMYRP_cjs.CALL_CAPTION_TOPIC || !callKey) return;
224
+ if (topic !== chunkHE4AQEWB_cjs.CALL_CAPTION_TOPIC || !callKey) return;
225
225
  const identity = participant?.identity ?? participantIdentity;
226
226
  if (!identity || identity === myIdentity) return;
227
- void chunkNT3SMYRP_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
227
+ void chunkHE4AQEWB_cjs.decodeCaptionPacket(payload, callKey).then((packet) => {
228
228
  if (!packet || packet.identity !== identity) return;
229
229
  const name = participant?.name || packet.name || identity;
230
230
  const t = Math.min(packet.t, Date.now());
@@ -264,7 +264,7 @@ function useCallTranscriber({
264
264
  })) {
265
265
  return;
266
266
  }
267
- const segmentId = chunkNT3SMYRP_cjs.newSegmentId();
267
+ const segmentId = chunkHE4AQEWB_cjs.newSegmentId();
268
268
  const startedAt = new Date(segment.startedAt).toISOString();
269
269
  let text;
270
270
  try {
@@ -298,7 +298,7 @@ function useCallTranscriber({
298
298
  });
299
299
  try {
300
300
  await localParticipant.publishData(
301
- await chunkNT3SMYRP_cjs.encodeCaptionPacket(
301
+ await chunkHE4AQEWB_cjs.encodeCaptionPacket(
302
302
  {
303
303
  v: 1,
304
304
  segment_id: segmentId,
@@ -310,7 +310,7 @@ function useCallTranscriber({
310
310
  },
311
311
  callKey
312
312
  ),
313
- { reliable: true, topic: chunkNT3SMYRP_cjs.CALL_CAPTION_TOPIC }
313
+ { reliable: true, topic: chunkHE4AQEWB_cjs.CALL_CAPTION_TOPIC }
314
314
  );
315
315
  } catch (err) {
316
316
  console.warn("[calls] could not broadcast a caption", err);
@@ -425,14 +425,14 @@ function useCallRecorder({
425
425
  };
426
426
  }, [callExtId]);
427
427
  react.useEffect(
428
- () => chunkNT3SMYRP_cjs.onCallEvent("call.recording", (message) => {
428
+ () => chunkHE4AQEWB_cjs.onCallEvent("call.recording", (message) => {
429
429
  if (message.call_ext_id === callExtId) applyState(message);
430
430
  }),
431
431
  [callExtId, applyState]
432
432
  );
433
433
  react.useEffect(() => {
434
434
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
435
- if (topic !== chunkNT3SMYRP_cjs.CALL_RECORDING_TOPIC) return;
435
+ if (topic !== chunkHE4AQEWB_cjs.CALL_RECORDING_TOPIC) return;
436
436
  if (participant || participantIdentity) return;
437
437
  try {
438
438
  const next = browser.calls.recordingStateFrom(JSON.parse(new TextDecoder().decode(payload)));
@@ -453,7 +453,7 @@ function useCallRecorder({
453
453
  try {
454
454
  const row = call ?? await arbi.calls.get(callExtId);
455
455
  if (!row.workspace_locked && !row.chat_ext_id && callKey) {
456
- const ref = await chunkNT3SMYRP_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
456
+ const ref = await chunkHE4AQEWB_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
457
457
  if (ref.kind === "chat") setCall({ ...row, chat_ext_id: ref.chatExtId });
458
458
  }
459
459
  const answer = await arbi.calls.recording.start(callExtId, mode);
@@ -555,7 +555,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
555
555
  const queryClient = reactQuery.useQueryClient();
556
556
  return react.useMemo(() => {
557
557
  if (!shouldCapture || !recordingExtId || !call) return null;
558
- return chunkNT3SMYRP_cjs.trackUploaderFor({
558
+ return chunkHE4AQEWB_cjs.trackUploaderFor({
559
559
  arbi,
560
560
  callExtId: call.external_id,
561
561
  recordingExtId,
@@ -563,7 +563,7 @@ function useTrackUploader(recording, callKey, kind, mimeType) {
563
563
  mimeType,
564
564
  recordingStartedAt: startedAt,
565
565
  linkVersion,
566
- conversationKey: () => chunkNT3SMYRP_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
566
+ conversationKey: () => chunkHE4AQEWB_cjs.conversationKeyForCall(arbi, queryClient, call, { callKey }),
567
567
  // The server stopped the recording at the quota (its state event says so too).
568
568
  onStopped: () => markStopped()
569
569
  });
@@ -612,10 +612,10 @@ function useInCallChat({
612
612
  react.useEffect(() => {
613
613
  if (!callKey) return;
614
614
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
615
- if (topic !== chunkNT3SMYRP_cjs.CALL_CHAT_TOPIC) return;
615
+ if (topic !== chunkHE4AQEWB_cjs.CALL_CHAT_TOPIC) return;
616
616
  const identity = participant?.identity ?? participantIdentity;
617
617
  if (!identity || identity === myIdentity) return;
618
- void chunkNT3SMYRP_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
618
+ void chunkHE4AQEWB_cjs.decodeCallChatPacket(payload, callKey).then((packet) => {
619
619
  if (!packet) return;
620
620
  const key = `${identity}:${packet.id}`;
621
621
  if (seen.current.has(key)) return;
@@ -645,7 +645,7 @@ function useInCallChat({
645
645
  if (!open || !canRead || historyRequested.current) return;
646
646
  historyRequested.current = true;
647
647
  setHistoryLoading(true);
648
- chunkNT3SMYRP_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
648
+ chunkHE4AQEWB_cjs.loadMeetingHistory(arbi, queryClient, callExtId).then((result) => {
649
649
  if (!result) return;
650
650
  setMeetingChat(result.ref);
651
651
  setHistory(result.messages);
@@ -656,13 +656,13 @@ function useInCallChat({
656
656
  }, [open, canRead, callExtId]);
657
657
  const send = react.useCallback(
658
658
  async (raw) => {
659
- const text = raw.trim().slice(0, chunkNT3SMYRP_cjs.CALL_CHAT_MAX_CHARS);
659
+ const text = raw.trim().slice(0, chunkHE4AQEWB_cjs.CALL_CHAT_MAX_CHARS);
660
660
  if (!text || !callKey || readOnly) return;
661
- const id = chunkNT3SMYRP_cjs.newPacketId();
661
+ const id = chunkHE4AQEWB_cjs.newPacketId();
662
662
  const at = Date.now();
663
663
  await localParticipant.publishData(
664
- await chunkNT3SMYRP_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
665
- { reliable: true, topic: chunkNT3SMYRP_cjs.CALL_CHAT_TOPIC }
664
+ await chunkHE4AQEWB_cjs.encodeCallChatPacket({ v: 1, id, text, at }, callKey),
665
+ { reliable: true, topic: chunkHE4AQEWB_cjs.CALL_CHAT_TOPIC }
666
666
  );
667
667
  setLive((prev) => [
668
668
  ...prev,
@@ -681,7 +681,7 @@ function useInCallChat({
681
681
  (prev) => prev.map((l) => l.id === id && l.senderIdentity === myIdentity ? { ...l, status } : l)
682
682
  );
683
683
  try {
684
- setMeetingChat(await chunkNT3SMYRP_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
684
+ setMeetingChat(await chunkHE4AQEWB_cjs.persistMeetingMessage(arbi, queryClient, callExtId, callKey, text));
685
685
  mark("saved");
686
686
  } catch (err) {
687
687
  console.warn("[calls] could not keep the message in the meeting chat", err);
@@ -693,7 +693,7 @@ function useInCallChat({
693
693
  const openMeeting = react.useCallback(async () => {
694
694
  if (!callKey) return;
695
695
  try {
696
- const ref = meetingChat ?? await chunkNT3SMYRP_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
696
+ const ref = meetingChat ?? await chunkHE4AQEWB_cjs.ensureMeetingChat(arbi, queryClient, callExtId, callKey);
697
697
  setMeetingChat(ref);
698
698
  openMeetingChat?.(ref);
699
699
  } catch (err) {
@@ -701,7 +701,7 @@ function useInCallChat({
701
701
  }
702
702
  }, [callExtId, callKey, meetingChat]);
703
703
  const lines = react.useMemo(
704
- () => chunkNT3SMYRP_cjs.mergeChatLines(history, live, {
704
+ () => chunkHE4AQEWB_cjs.mergeChatLines(history, live, {
705
705
  myIdentity,
706
706
  nameOf: (identity) => identity === myIdentity ? localParticipant.name || "You" : room.remoteParticipants.get(identity)?.name || null
707
707
  }),
@@ -760,7 +760,7 @@ function useWebinar({
760
760
  const n = ++questionsRead.current;
761
761
  try {
762
762
  const rows = await webinarApi().questions.list(callExtId, linkVersion);
763
- const opened = await Promise.all(rows.map((q) => chunkNT3SMYRP_cjs.openQuestion(q, callKey)));
763
+ const opened = await Promise.all(rows.map((q) => chunkHE4AQEWB_cjs.openQuestion(q, callKey)));
764
764
  if (n === questionsRead.current) setQuestions(opened);
765
765
  } catch (err) {
766
766
  console.warn("[calls] could not load the questions", err);
@@ -772,7 +772,7 @@ function useWebinar({
772
772
  }, [refresh, refreshQuestions]);
773
773
  react.useEffect(() => {
774
774
  if (!enabled) return;
775
- return chunkNT3SMYRP_cjs.onCallEvent("call.webinar", (m) => {
775
+ return chunkHE4AQEWB_cjs.onCallEvent("call.webinar", (m) => {
776
776
  if (m.call_ext_id !== callExtId) return;
777
777
  setState((s) => s ? { ...s, live: m.live, chat: m.chat } : s);
778
778
  });
@@ -781,8 +781,8 @@ function useWebinar({
781
781
  react.useEffect(() => {
782
782
  if (!enabled) return;
783
783
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
784
- if (topic !== chunkNT3SMYRP_cjs.CALL_WEBINAR_TOPIC) return;
785
- const packet = chunkNT3SMYRP_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
784
+ if (topic !== chunkHE4AQEWB_cjs.CALL_WEBINAR_TOPIC) return;
785
+ const packet = chunkHE4AQEWB_cjs.parseWebinarPacket(payload, !!(participant || participantIdentity));
786
786
  if (!packet) return;
787
787
  switch (packet.type) {
788
788
  case "state":
@@ -803,7 +803,7 @@ function useWebinar({
803
803
  return;
804
804
  case "demoted":
805
805
  setStageCheck(false);
806
- chunkNT3SMYRP_cjs.markRejoining(callExtId);
806
+ chunkHE4AQEWB_cjs.markRejoining(callExtId);
807
807
  if (fallback.current) clearTimeout(fallback.current);
808
808
  fallback.current = setTimeout(() => void room.disconnect(), DEMOTE_REJOIN_FALLBACK_MS);
809
809
  return;
@@ -830,12 +830,12 @@ function useWebinar({
830
830
  [callExtId, linkVersion]
831
831
  );
832
832
  const stepDown = react.useCallback(async () => {
833
- chunkNT3SMYRP_cjs.markRejoining(callExtId);
833
+ chunkHE4AQEWB_cjs.markRejoining(callExtId);
834
834
  setStageCheck(false);
835
835
  try {
836
836
  await webinarApi().demote(callExtId, myIdentity, linkVersion);
837
837
  } catch (err) {
838
- chunkNT3SMYRP_cjs.markRejoining(callExtId, false);
838
+ chunkHE4AQEWB_cjs.markRejoining(callExtId, false);
839
839
  failed("leave the stage")(err);
840
840
  }
841
841
  }, [callExtId, myIdentity, linkVersion]);
@@ -895,7 +895,7 @@ function useWebinar({
895
895
  if (!callKey) throw new Error("This call has no key.");
896
896
  await webinarApi().questions.ask(
897
897
  callExtId,
898
- await chunkNT3SMYRP_cjs.sealQuestionText(text, callKey),
898
+ await chunkHE4AQEWB_cjs.sealQuestionText(text, callKey),
899
899
  linkVersion
900
900
  );
901
901
  }, "ask the question"),
@@ -909,7 +909,7 @@ function useWebinar({
909
909
  await webinarApi().questions.update(
910
910
  callExtId,
911
911
  id,
912
- { answer: await chunkNT3SMYRP_cjs.sealQuestionText(text, callKey) },
912
+ { answer: await chunkHE4AQEWB_cjs.sealQuestionText(text, callKey) },
913
913
  linkVersion
914
914
  );
915
915
  }, "answer the question"),
@@ -939,15 +939,15 @@ function useWebinar({
939
939
  function useHostMuteNotice(callExtId) {
940
940
  const room = componentsReact.useRoomContext();
941
941
  react.useEffect(() => {
942
- const notifyMuted = chunkNT3SMYRP_cjs.createMutedNotifier((text) => chunkIX4HOS5Z_cjs.notify.info(text));
942
+ const notifyMuted = chunkHE4AQEWB_cjs.createMutedNotifier((text) => chunkIX4HOS5Z_cjs.notify.info(text));
943
943
  const onData = (payload, participant, _kind, topic, _encryption, participantIdentity) => {
944
- if (topic !== chunkNT3SMYRP_cjs.CALL_MODERATION_TOPIC) return;
944
+ if (topic !== chunkHE4AQEWB_cjs.CALL_MODERATION_TOPIC) return;
945
945
  if (participant || participantIdentity) return;
946
- const notice = chunkNT3SMYRP_cjs.mutedNoticeFromPacket(payload);
946
+ const notice = chunkHE4AQEWB_cjs.mutedNoticeFromPacket(payload);
947
947
  if (notice) notifyMuted(notice);
948
948
  };
949
949
  room.on(livekitClient.RoomEvent.DataReceived, onData);
950
- const offWs = chunkNT3SMYRP_cjs.onCallEvent("call.muted", (message) => {
950
+ const offWs = chunkHE4AQEWB_cjs.onCallEvent("call.muted", (message) => {
951
951
  if (message.callExtId === callExtId) notifyMuted(message);
952
952
  });
953
953
  return () => {
@@ -1,5 +1,5 @@
1
1
  import { Room } from 'livekit-client';
2
- import { J as JoinChoices, p as CaptionLine, d as AudioSegment, Z as TrackUploader, m as CallChatLine, M as MeetingChatRef, P as OpenQuestion } from '../../useAudioRecorder.d-B9rlMI_E.js';
2
+ import { J as JoinChoices, p as CaptionLine, d as AudioSegment, Z as TrackUploader, m as CallChatLine, M as MeetingChatRef, P as OpenQuestion } from '../../useAudioRecorder.d-DYVIWxKQ.js';
3
3
  import { calls } from '@arbidocs/sdk/browser';
4
4
  import '@tanstack/react-query';
5
5
  import '@arbidocs/client';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPH3RGDYE_cjs = require('./chunk-PH3RGDYE.cjs');
3
+ var chunkMDSWUCCL_cjs = require('./chunk-MDSWUCCL.cjs');
4
4
  var chunkFE6ZSNZE_cjs = require('./chunk-FE6ZSNZE.cjs');
5
5
  var chunkIX4HOS5Z_cjs = require('./chunk-IX4HOS5Z.cjs');
6
6
  var chunkEEIYXVM4_cjs = require('./chunk-EEIYXVM4.cjs');
@@ -1087,7 +1087,7 @@ function arbiAccountClient(arbi, overrides = {}) {
1087
1087
  if (everywhere) await arbi.sessions.logoutAll();
1088
1088
  else await arbi.logout();
1089
1089
  } finally {
1090
- chunkPH3RGDYE_cjs.clearSealedDrafts();
1090
+ chunkMDSWUCCL_cjs.clearSealedDrafts();
1091
1091
  chunkIX4HOS5Z_cjs.clearChatArtifacts();
1092
1092
  await wipeOfflineMail().catch(() => {
1093
1093
  });
@@ -1440,7 +1440,7 @@ function hasRecordingTranscript(lines, refOf) {
1440
1440
  return lines.some((l) => isRecordingSegmentId(refOf(l)?.segmentId));
1441
1441
  }
1442
1442
  var CALL_CHAT_TOPIC = "arbi.chat";
1443
- var READ_ONLY_MEETING_TEXT = "Read only: you can\u2019t post in this meeting chat";
1443
+ var READ_ONLY_MEETING_TEXT = "Viewer: you can\u2019t post in this meeting chat";
1444
1444
  var CALL_CHAT_MAX_CHARS = 4e3;
1445
1445
  var encoder = new TextEncoder();
1446
1446
  var decoder = new TextDecoder();
@@ -2721,7 +2721,7 @@ function isWorkspaceGuestOf(workspaces, workspaceExtId, me) {
2721
2721
  function useMeetingReadOnly(lockedWorkspaceExtId) {
2722
2722
  const arbi = chunkFE6ZSNZE_cjs.useArbi();
2723
2723
  const me = arbi.isLoggedIn ? arbi.user.identity()?.externalId ?? null : null;
2724
- const { data: workspaces } = chunkPH3RGDYE_cjs.useWorkspaces({
2724
+ const { data: workspaces } = chunkMDSWUCCL_cjs.useWorkspaces({
2725
2725
  enabled: !!lockedWorkspaceExtId && arbi.isLoggedIn
2726
2726
  });
2727
2727
  return isWorkspaceGuestOf(
@@ -2983,5 +2983,5 @@ exports.useUserSettings = useUserSettings;
2983
2983
  exports.wipeOfflineMail = wipeOfflineMail;
2984
2984
  exports.wrapTrackKey = wrapTrackKey;
2985
2985
  exports.writeSamples = writeSamples;
2986
- //# sourceMappingURL=chunk-NT3SMYRP.cjs.map
2987
- //# sourceMappingURL=chunk-NT3SMYRP.cjs.map
2986
+ //# sourceMappingURL=chunk-HE4AQEWB.cjs.map
2987
+ //# sourceMappingURL=chunk-HE4AQEWB.cjs.map