@arbidocs/react 0.4.71 → 0.4.73

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 (40) hide show
  1. package/dist/annotations/index.cjs +48 -48
  2. package/dist/annotations/index.js +2 -2
  3. package/dist/artifacts/index.cjs +7 -7
  4. package/dist/artifacts/index.js +2 -2
  5. package/dist/{chunk-6TFD5OS5.cjs → chunk-GE5TAR7Y.cjs} +3 -2
  6. package/dist/chunk-GE5TAR7Y.cjs.map +1 -0
  7. package/dist/{chunk-3QF5DNAP.js → chunk-IHTBAY57.js} +3 -3
  8. package/dist/{chunk-3QF5DNAP.js.map → chunk-IHTBAY57.js.map} +1 -1
  9. package/dist/{chunk-6ERJUIMQ.js → chunk-IQ5TYPVU.js} +3 -2
  10. package/dist/chunk-IQ5TYPVU.js.map +1 -0
  11. package/dist/{chunk-ULU5LEWF.cjs → chunk-L2PXZWJM.cjs} +25 -25
  12. package/dist/{chunk-ULU5LEWF.cjs.map → chunk-L2PXZWJM.cjs.map} +1 -1
  13. package/dist/{chunk-V4CXOPLB.js → chunk-MHCN7OST.js} +19 -7
  14. package/dist/{chunk-V4CXOPLB.js.map → chunk-MHCN7OST.js.map} +1 -1
  15. package/dist/{chunk-BTRIS3HY.cjs → chunk-QJRP2LLQ.cjs} +19 -6
  16. package/dist/chunk-QJRP2LLQ.cjs.map +1 -0
  17. package/dist/{chunk-LQ5YHB7W.cjs → chunk-WYZJLZ67.cjs} +6 -4
  18. package/dist/chunk-WYZJLZ67.cjs.map +1 -0
  19. package/dist/{chunk-WS6DF5X4.js → chunk-YNNAJJ5Z.js} +6 -4
  20. package/dist/chunk-YNNAJJ5Z.js.map +1 -0
  21. package/dist/document-tools/index.cjs +6 -6
  22. package/dist/document-tools/index.js +3 -3
  23. package/dist/{index-BWv_FKi3.d.cts → index-BVMBElCu.d.cts} +82 -1
  24. package/dist/{index-BWv_FKi3.d.ts → index-BVMBElCu.d.ts} +82 -1
  25. package/dist/index.cjs +641 -314
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +281 -5
  28. package/dist/index.d.ts +281 -5
  29. package/dist/index.js +324 -11
  30. package/dist/index.js.map +1 -1
  31. package/dist/ui/index.cjs +129 -125
  32. package/dist/ui/index.d.cts +1 -1
  33. package/dist/ui/index.d.ts +1 -1
  34. package/dist/ui/index.js +2 -2
  35. package/package.json +4 -3
  36. package/dist/chunk-6ERJUIMQ.js.map +0 -1
  37. package/dist/chunk-6TFD5OS5.cjs.map +0 -1
  38. package/dist/chunk-BTRIS3HY.cjs.map +0 -1
  39. package/dist/chunk-LQ5YHB7W.cjs.map +0 -1
  40. package/dist/chunk-WS6DF5X4.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,14 +1,17 @@
1
- import { arbiQueryKeys, useDocuments, useConversations, useAssistantQuery, useConversationThreads, useWorkspaces, useParsedDocument, useTags, useActivity, useThumbnails } from './chunk-6ERJUIMQ.js';
2
- export { DEFAULT_USD_PER_CREDIT, arbiQueryKeys, creditsToUsd, formatCredits, isUsageMetered, useActivity, useAgents, useAssistantQuery, useConfigs, useConversationThreads, useConversations, useDeleteAgents, useDocuments, useFacts, useHealth, useParsedDocument, useProjectInvoices, useProjectUsage, useProjects, useProjectsUsage, useSessions, useTags, useThumbnails, useUserUsageToday, useWorkspaceUsers, useWorkspaces } from './chunk-6ERJUIMQ.js';
1
+ import { arbiQueryKeys, useDocuments, useConversations, useAssistantQuery, useConversationThreads, useWorkspaces, useParsedDocument, useTags, useActivity, useThumbnails } from './chunk-IQ5TYPVU.js';
2
+ export { DEFAULT_USD_PER_CREDIT, arbiQueryKeys, creditsToUsd, formatCredits, isUsageMetered, useActivity, useAgents, useAssistantQuery, useConfigs, useConversationThreads, useConversations, useDeleteAgents, useDocuments, useFacts, useHealth, useParsedDocument, useProjectInvoices, useProjectUsage, useProjects, useProjectsUsage, useSessions, useTags, useThumbnails, useUserUsageToday, useWorkspaceUsers, useWorkspaces } from './chunk-IQ5TYPVU.js';
3
3
  export { cleanDraftMarkdown, cleanDraftWithReport, promoteBoldTitle, repairParsedStructure, repairParsedTitle, stripAgentPreamble, unescapeMarkdown, unwrapCitationLinks } from './chunk-G6FHNURH.js';
4
4
  import { formatRelativeTime } from './chunk-ECOSGMTW.js';
5
5
  export { DEFAULT_NOTIFY_TONE, NotificationBell, Toaster, formatRelativeTime, notify, seedNotifications, selectUnread, toast, useNotify } from './chunk-ECOSGMTW.js';
6
- import { returnFocusToMark, MarkMenu, AiMarkdown, Card, Badge, TagEntity, Input, FILE_TYPE_COLORS, getEntityIcon, UserEntity, getEntityColorStyles, AgentBadge, Textarea, Label, Slider, DocumentEntity, DocumentCard, useAudioRecorder, MicWaveformIndicator, IconToggle, classifyMediaError, formatElapsed, PassageCard } from './chunk-V4CXOPLB.js';
7
- export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DictateProvider, DocIcon, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, HtmlIcon, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TxtIcon, UserEntity, UserMenu, VISIBILITY_ICONS, VidIcon, VisibilityIcon, VisibilityToggle, XlsIcon, badgeVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants, useAudioRecorder } from './chunk-V4CXOPLB.js';
6
+ import { AudioViewer, ImageViewer, VideoViewer } from './chunk-HDCRPPBW.js';
7
+ import { useArbi } from './chunk-WBYNKFUO.js';
8
+ export { ArbiProvider, useArbi, useDeploymentDomain } from './chunk-WBYNKFUO.js';
9
+ import { returnFocusToMark, MarkMenu, AiMarkdown, Card, Badge, TagEntity, Input, FILE_TYPE_COLORS, getEntityIcon, UserEntity, getEntityColorStyles, AgentBadge, Textarea, Label, Slider, DocumentEntity, DocumentCard, useAudioRecorder, MicWaveformIndicator, IconToggle, classifyMediaError, formatElapsed, PassageCard } from './chunk-MHCN7OST.js';
10
+ export { AgentBadge, AiMarkdown, ArbiBotHeadIcon, AudIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DictateProvider, DocIcon, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EmlIcon, EntityIcon, EntityPill, FILE_TYPE_COLORS, HoverCard, HoverCardContent, HoverCardTrigger, HtmlIcon, IconToggle, ImgIcon, InlineMicButton, Input, Label, MarkMenu, MicRecordingOverlay, MicWaveformIndicator, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, PdfIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TxtIcon, UserEntity, UserMenu, VISIBILITY_ICONS, VerifiedBadge, VidIcon, VisibilityIcon, VisibilityToggle, XlsIcon, badgeVariants, cardVariants, classifyMediaError, configureEntityRegistry, configureRagLabels, configureStatusRegistry, formatElapsed, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants, useAudioRecorder } from './chunk-MHCN7OST.js';
8
11
  import { MarkdownRenderer } from './chunk-YXSXGTYQ.js';
9
12
  export { MarkdownRenderer, MarkdownStreamingContext, markdownBaseComponents, splitMarkdownBlocks } from './chunk-YXSXGTYQ.js';
10
- import { Button, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-WS6DF5X4.js';
11
- export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from './chunk-WS6DF5X4.js';
13
+ import { Button, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-YNNAJJ5Z.js';
14
+ export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from './chunk-YNNAJJ5Z.js';
12
15
  import { normalizeCitationMarkup } from './chunk-QRCMKEE6.js';
13
16
  export { closeOpenEmphasis, normalizeCitationMarkup, trimOpenCitation } from './chunk-QRCMKEE6.js';
14
17
  import { ScrollArea } from './chunk-W4H6XAIU.js';
@@ -17,12 +20,9 @@ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuIte
17
20
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, PortalContainerProvider, usePortalContainer } from './chunk-47CCGUWR.js';
18
21
  import { cn } from './chunk-SN5YV6FF.js';
19
22
  export { cn } from './chunk-SN5YV6FF.js';
20
- import { AudioViewer, ImageViewer, VideoViewer } from './chunk-HDCRPPBW.js';
21
- import { useArbi } from './chunk-WBYNKFUO.js';
22
- export { ArbiProvider, useArbi, useDeploymentDomain } from './chunk-WBYNKFUO.js';
23
23
  import React, { memo, useState, createContext, useMemo, useCallback, useEffect, useRef, useLayoutEffect, useContext, useId, Fragment as Fragment$1 } from 'react';
24
24
  import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
25
- import { resolveCitations, summarizeCitations, formatFileSize, connectWithReconnect, dm } from '@arbidocs/sdk/browser';
25
+ import { resolveCitations, summarizeCitations, formatFileSize, connectWithReconnect, dm, identityErrorCode } from '@arbidocs/sdk/browser';
26
26
  export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
27
27
  import { Link, Trash2, CheckCheck, Check, Loader2, AlertTriangle, ShieldCheck, Copy, Sparkles, FileText, GitCompareArrows, Download, Image as Image$1, Search, CornerDownLeft, X, ArrowLeft, Send, Tags, Crown, Info, Activity, Gauge, Gift, PartyPopper, UserCheck, AtSign, MessageCircleMore, FileX2, FileCheck2, Pencil, FolderPlus, SquareArrowOutUpRight, MessagesSquare, Paperclip, ArrowRight, MoreHorizontal, SquarePen, Mic, Pause, Play, Square, RotateCcw, Camera, Circle } from 'lucide-react';
28
28
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -64,6 +64,17 @@ function useRunConversation() {
64
64
  onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() })
65
65
  });
66
66
  }
67
+ function useActOnStep() {
68
+ const arbi = useArbi();
69
+ const qc = useQueryClient();
70
+ return useMutation({
71
+ mutationFn: ({
72
+ conversationId,
73
+ body
74
+ }) => arbi.conversations.actOnStep(conversationId, body),
75
+ onSuccess: () => qc.invalidateQueries({ queryKey: arbiQueryKeys.allConversations() })
76
+ });
77
+ }
67
78
  function usePlanWork() {
68
79
  const arbi = useArbi();
69
80
  return useMutation({
@@ -1517,6 +1528,7 @@ function useUpdateProfile() {
1517
1528
  },
1518
1529
  onSuccess: (profile) => {
1519
1530
  qc.setQueryData(arbiQueryKeys.profile(), profile);
1531
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.identity() });
1520
1532
  return qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
1521
1533
  }
1522
1534
  });
@@ -1896,6 +1908,307 @@ function useDeleteAccountFlow({
1896
1908
  onClose: close
1897
1909
  };
1898
1910
  }
1911
+
1912
+ // src/account/didit.ts
1913
+ var sdkPromise = null;
1914
+ function loadDidit() {
1915
+ sdkPromise ??= import('@didit-protocol/sdk-web').then((m) => m.DiditSdk);
1916
+ sdkPromise.catch(() => {
1917
+ sdkPromise = null;
1918
+ });
1919
+ return sdkPromise;
1920
+ }
1921
+ async function mountDiditVerification({
1922
+ url,
1923
+ containerId,
1924
+ onResult
1925
+ }) {
1926
+ const Sdk = await loadDidit();
1927
+ const sdk = Sdk.shared;
1928
+ sdk.onComplete = onResult;
1929
+ await sdk.startVerification({
1930
+ url,
1931
+ configuration: {
1932
+ embedded: true,
1933
+ embeddedContainerId: containerId,
1934
+ showCloseButton: false,
1935
+ closeModalOnComplete: true
1936
+ }
1937
+ });
1938
+ return () => {
1939
+ sdk.onComplete = void 0;
1940
+ sdk.destroy();
1941
+ };
1942
+ }
1943
+
1944
+ // src/account/identity.ts
1945
+ function problemOf(error, fallback) {
1946
+ const code = identityErrorCode(error) ?? error?.code;
1947
+ const message = error instanceof Error && error.message ? error.message : fallback;
1948
+ return { code: typeof code === "string" ? code : void 0, message };
1949
+ }
1950
+ function identityStepFor(status) {
1951
+ if (!status) return "pay";
1952
+ if (["name_mismatch", "in_review", "verified"].includes(status.state)) return "result";
1953
+ if (status.state === "declined") return status.attempts_left > 0 ? "result" : "pay";
1954
+ if (status.state === "in_progress" || status.attempts_left > 0) return "verify";
1955
+ return "pay";
1956
+ }
1957
+ function formatIdentityPrice(status) {
1958
+ let amount;
1959
+ try {
1960
+ amount = new Intl.NumberFormat("en-GB", {
1961
+ style: "currency",
1962
+ currency: status.currency
1963
+ }).format(status.price_pence / 100);
1964
+ } catch {
1965
+ amount = `${(status.price_pence / 100).toFixed(2)} ${status.currency}`;
1966
+ }
1967
+ return `${amount} incl. VAT`;
1968
+ }
1969
+ function useIdentityVerificationFlow(api, {
1970
+ enabled = true,
1971
+ onVerifiedChange,
1972
+ onNameAccepted,
1973
+ formatPrice = formatIdentityPrice
1974
+ } = {}) {
1975
+ const qc = useQueryClient();
1976
+ const apiRef = useRef(api);
1977
+ apiRef.current = api;
1978
+ const query = useQuery({
1979
+ queryKey: arbiQueryKeys.identity(),
1980
+ queryFn: () => apiRef.current.status(),
1981
+ enabled,
1982
+ staleTime: 6e4
1983
+ });
1984
+ const status = query.data;
1985
+ const [isOpen, setIsOpen] = useState(false);
1986
+ const [step, setStep] = useState("pay");
1987
+ const [busy, setBusy] = useState(null);
1988
+ const [problem, setProblem] = useState(null);
1989
+ const [paymentUrl, setPaymentUrl] = useState(null);
1990
+ const [sessionUrl, setSessionUrl] = useState(null);
1991
+ const [container, setContainer] = useState(null);
1992
+ const [embedFailed, setEmbedFailed] = useState(false);
1993
+ const verifyContainerId = `didit-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
1994
+ const lastVerified = useRef(void 0);
1995
+ const apply = useCallback(
1996
+ (next) => {
1997
+ qc.setQueryData(arbiQueryKeys.identity(), next);
1998
+ if (lastVerified.current !== void 0 && lastVerified.current !== next.verified) {
1999
+ onVerifiedChange?.(next.verified);
2000
+ }
2001
+ lastVerified.current = next.verified;
2002
+ return next;
2003
+ },
2004
+ [qc, onVerifiedChange]
2005
+ );
2006
+ useEffect(() => {
2007
+ if (status && lastVerified.current === void 0) lastVerified.current = status.verified;
2008
+ }, [status]);
2009
+ const run = useCallback(
2010
+ async (kind, fallback, fn) => {
2011
+ setBusy(kind);
2012
+ setProblem(null);
2013
+ try {
2014
+ return await fn();
2015
+ } catch (e) {
2016
+ setProblem(problemOf(e, fallback));
2017
+ return void 0;
2018
+ } finally {
2019
+ setBusy(null);
2020
+ }
2021
+ },
2022
+ []
2023
+ );
2024
+ const isOpenRef = useRef(false);
2025
+ const closeRef = useRef(() => {
2026
+ });
2027
+ const startVerifyRef = useRef(async () => {
2028
+ });
2029
+ const refresh = useCallback(async () => {
2030
+ const next = await run(
2031
+ "refresh",
2032
+ "Could not read the verification result",
2033
+ () => apiRef.current.refresh()
2034
+ );
2035
+ if (!next) return;
2036
+ apply(next);
2037
+ if (next.state === "in_progress") return;
2038
+ setSessionUrl(null);
2039
+ const nextStep = next.state === "declined" ? "result" : identityStepFor(next);
2040
+ if (nextStep === "verify" && isOpenRef.current) void startVerifyRef.current();
2041
+ else setStep(nextStep);
2042
+ }, [run, apply]);
2043
+ const refreshedOnLoad = useRef(false);
2044
+ useEffect(() => {
2045
+ if (refreshedOnLoad.current || !status) return;
2046
+ refreshedOnLoad.current = true;
2047
+ if (status.state === "in_progress" || status.state === "in_review") void refresh();
2048
+ }, [status, refresh]);
2049
+ const startVerify = useCallback(async () => {
2050
+ setStep("verify");
2051
+ setEmbedFailed(false);
2052
+ const url = await run(
2053
+ "start",
2054
+ "Could not start identity verification",
2055
+ () => apiRef.current.startSession()
2056
+ );
2057
+ if (url) {
2058
+ setSessionUrl(url);
2059
+ return;
2060
+ }
2061
+ setStep("pay");
2062
+ }, [run]);
2063
+ startVerifyRef.current = startVerify;
2064
+ useEffect(() => {
2065
+ if (!isOpen || step !== "verify" || !sessionUrl || !container || embedFailed) return;
2066
+ let teardown;
2067
+ let cancelled = false;
2068
+ mountDiditVerification({
2069
+ url: sessionUrl,
2070
+ containerId: container.id,
2071
+ onResult: (result) => {
2072
+ if (result.type === "failed" && result.error?.type === "cameraAccessDenied") {
2073
+ setEmbedFailed(true);
2074
+ return;
2075
+ }
2076
+ if (result.type === "cancelled") {
2077
+ closeRef.current();
2078
+ return;
2079
+ }
2080
+ void refresh();
2081
+ }
2082
+ }).then((stop) => {
2083
+ if (cancelled) stop();
2084
+ else teardown = stop;
2085
+ }).catch(() => setEmbedFailed(true));
2086
+ return () => {
2087
+ cancelled = true;
2088
+ teardown?.();
2089
+ };
2090
+ }, [isOpen, step, sessionUrl, container, embedFailed, refresh]);
2091
+ const [waitingInTab, setWaitingInTab] = useState(false);
2092
+ useEffect(() => {
2093
+ if (!waitingInTab || typeof window === "undefined") return;
2094
+ const onFocus = () => void refresh();
2095
+ window.addEventListener("focus", onFocus);
2096
+ return () => window.removeEventListener("focus", onFocus);
2097
+ }, [waitingInTab, refresh]);
2098
+ const open = useCallback(() => {
2099
+ isOpenRef.current = true;
2100
+ setProblem(null);
2101
+ setPaymentUrl(status?.pending_payment_url ?? null);
2102
+ const first = identityStepFor(status);
2103
+ setStep(first);
2104
+ setIsOpen(true);
2105
+ if (first === "verify") void startVerify();
2106
+ }, [status, startVerify]);
2107
+ const close = useCallback(() => {
2108
+ isOpenRef.current = false;
2109
+ setIsOpen(false);
2110
+ setSessionUrl(null);
2111
+ setWaitingInTab(false);
2112
+ setEmbedFailed(false);
2113
+ setProblem(null);
2114
+ }, []);
2115
+ closeRef.current = close;
2116
+ const pay = useCallback(async () => {
2117
+ const result = await run(
2118
+ "pay",
2119
+ "Payment could not be completed",
2120
+ () => apiRef.current.purchase()
2121
+ );
2122
+ if (!result) return;
2123
+ if (result.status === "requires_action") {
2124
+ setPaymentUrl(result.payment_url ?? null);
2125
+ return;
2126
+ }
2127
+ setPaymentUrl(null);
2128
+ void query.refetch();
2129
+ void startVerify();
2130
+ }, [run, query, startVerify]);
2131
+ const acceptName = useCallback(async () => {
2132
+ const offered = status;
2133
+ const next = await run(
2134
+ "accept",
2135
+ "Could not change your name",
2136
+ () => apiRef.current.acceptName()
2137
+ );
2138
+ if (!next) return;
2139
+ apply(next);
2140
+ if (offered?.document_given_name) {
2141
+ onNameAccepted?.({
2142
+ givenName: offered.document_given_name,
2143
+ familyName: offered.document_family_name ?? null
2144
+ });
2145
+ }
2146
+ }, [run, apply, status, onNameAccepted]);
2147
+ const remove = useCallback(async () => {
2148
+ const next = await run(
2149
+ "remove",
2150
+ "Could not remove the verification",
2151
+ () => apiRef.current.remove()
2152
+ );
2153
+ if (next) apply(next);
2154
+ }, [run, apply]);
2155
+ const price = useMemo(() => status ? formatPrice(status) : null, [status, formatPrice]);
2156
+ return {
2157
+ status,
2158
+ isLoading: query.isLoading,
2159
+ price,
2160
+ isOpen,
2161
+ open,
2162
+ close,
2163
+ step,
2164
+ busy,
2165
+ problem,
2166
+ paymentUrl,
2167
+ pay: () => void pay(),
2168
+ recheckPayment: () => void startVerify(),
2169
+ verifyContainerId,
2170
+ verifyContainerRef: setContainer,
2171
+ embedFailed,
2172
+ openInNewTab: () => {
2173
+ if (!sessionUrl || typeof window === "undefined") return;
2174
+ window.open(sessionUrl, "_blank", "noopener");
2175
+ setWaitingInTab(true);
2176
+ },
2177
+ checkResult: () => void refresh(),
2178
+ retry: () => void startVerify(),
2179
+ acceptName: () => void acceptName(),
2180
+ keepName: close,
2181
+ remove: () => void remove()
2182
+ };
2183
+ }
2184
+ function useIdentityVerification(options = {}) {
2185
+ const arbi = useArbi();
2186
+ const qc = useQueryClient();
2187
+ const api = useMemo(
2188
+ () => ({
2189
+ status: () => arbi.identity.status(),
2190
+ purchase: () => arbi.identity.purchase(),
2191
+ startSession: () => arbi.identity.startSession(),
2192
+ refresh: () => arbi.identity.refresh(),
2193
+ acceptName: () => arbi.identity.acceptName(),
2194
+ remove: () => arbi.identity.remove()
2195
+ }),
2196
+ [arbi]
2197
+ );
2198
+ const { onVerifiedChange, onNameAccepted } = options;
2199
+ return useIdentityVerificationFlow(api, {
2200
+ enabled: arbi.isLoggedIn,
2201
+ onVerifiedChange: (verified) => {
2202
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.profile() });
2203
+ onVerifiedChange?.(verified);
2204
+ },
2205
+ onNameAccepted: (name) => {
2206
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.profile() });
2207
+ void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
2208
+ onNameAccepted?.(name);
2209
+ }
2210
+ });
2211
+ }
1899
2212
  function useWorkspaceDocs(workspaceId) {
1900
2213
  const { data: docs = [], isLoading, isError } = useDocuments(workspaceId);
1901
2214
  const docIds = useMemo(
@@ -6106,6 +6419,6 @@ function hasVideoTrack(blob) {
6106
6419
  });
6107
6420
  }
6108
6421
 
6109
- export { ActivityFeed, AiActionCard, AiAnswer, AppleIcon, ArbiBotIcon, ArbiIcon, ArbiWebSocketProvider, ArtifactCanvas, ChatBubble, CitationRenderer, ClaudeIcon, CommandPalette, CommandPaletteProvider, ConversationList, DEFAULT_ASPECT_OPTIONS, DEFAULT_PASSWORD_CHANGE_FORM_MESSAGES, DEFAULT_START_BY_EMAIL_LABELS, DateSeparator, DirectMessages, DmAvatar, DmComposer, DocQaPanel, DocSearch, DocumentCardMenu, DocumentGallery, DocumentReview, DocumentTable, DraftTitleControls, FileIcon, FireworksIcon, GeminiIcon, GitHubIcon, GoogleIcon, ImageCropModal, ImageCropper, LinkedInIcon, MAX_AVATAR_FILE_BYTES, MessageArtifactCard, MessageBubble, MessageThread, OpenAIIcon, PhotoCapture, ProviderIcon, RUN_WINDOW_MS, SemanticSearch, StartByEmail, TypingIndicator, VideoCapture, VoiceNoteRecorder, annotateThread, captureFrameAsBlob, cropImage, dayKey, describeActivity, getNotificationTypeMeta, getWorkspaceActionText, getWorkspaceKind, getWorkspaceSentPhrase, hasVideoTrack, isWorkspaceNotificationType, parseActivityContent, parseDeleteAccountBlockers, pickRecentWorkspaces, redlineStats, resolveActiveWorkspace, textToArtifact, titleFromQuestion, toChatCitations, toNotificationPreferences, toProfileView, toRedlineMarkdown, toShellWorkspace, useAddContacts, useAgentChats, useAgentConfig, useAgentModels, useAgentSession, useAgentWorkspaces, useAiTask, useArbiChat, useArbiConnected, useArbiDocumentSync, useArbiShellWorkspaces, useArbiUiStore, useArbiWebSocket, useArbiWsContext, useArbiWsMessage, useArbiWsStatus, useArbiWsStore, useArbiWsTask, useArbiWsTasks, useAvatarCrop, useCameraStream, useCloseAgentSession, useCommandPalette, useConfirmEmailChange, useContacts, useConversationActivity, useConversationPendingAuth, useCreateAgent, useCreateWork, useCreateWorkflow, useCurrentSessionId, useDeleteAccount, useDeleteAccountFlow, useDeleteWorkflow, useDirectMessages, useEmailChange, useGrantAgentAccess, useLogoutAllSessions, useNameEditor, useNotificationPreferences, usePasswordChange, usePasswordChangeForm, usePendingContacts, usePlanWork, useProfile, useRemoveContacts, useRequestEmailChange, useRevokeAgentAccess, useRunConversation, useRunWorkflow, useSaveAgentConfig, useSemanticSearch, useShellWorkspaces, useSkills, useStartAgentSession, useStartWorkQuery, useTerminateSession, useUpdateConversation, useUpdateProfile, useUpdateWorkflow, useUploadSkillFiles, useUserSettings, useVideoRecorder, useWorkNotifications, useWorkflows, useWorkspaceDocs, userDisplayName, userInitials };
6422
+ export { ActivityFeed, AiActionCard, AiAnswer, AppleIcon, ArbiBotIcon, ArbiIcon, ArbiWebSocketProvider, ArtifactCanvas, ChatBubble, CitationRenderer, ClaudeIcon, CommandPalette, CommandPaletteProvider, ConversationList, DEFAULT_ASPECT_OPTIONS, DEFAULT_PASSWORD_CHANGE_FORM_MESSAGES, DEFAULT_START_BY_EMAIL_LABELS, DateSeparator, DirectMessages, DmAvatar, DmComposer, DocQaPanel, DocSearch, DocumentCardMenu, DocumentGallery, DocumentReview, DocumentTable, DraftTitleControls, FileIcon, FireworksIcon, GeminiIcon, GitHubIcon, GoogleIcon, ImageCropModal, ImageCropper, LinkedInIcon, MAX_AVATAR_FILE_BYTES, MessageArtifactCard, MessageBubble, MessageThread, OpenAIIcon, PhotoCapture, ProviderIcon, RUN_WINDOW_MS, SemanticSearch, StartByEmail, TypingIndicator, VideoCapture, VoiceNoteRecorder, annotateThread, captureFrameAsBlob, cropImage, dayKey, describeActivity, formatIdentityPrice, getNotificationTypeMeta, getWorkspaceActionText, getWorkspaceKind, getWorkspaceSentPhrase, hasVideoTrack, identityStepFor, isWorkspaceNotificationType, mountDiditVerification, parseActivityContent, parseDeleteAccountBlockers, pickRecentWorkspaces, redlineStats, resolveActiveWorkspace, textToArtifact, titleFromQuestion, toChatCitations, toNotificationPreferences, toProfileView, toRedlineMarkdown, toShellWorkspace, useActOnStep, useAddContacts, useAgentChats, useAgentConfig, useAgentModels, useAgentSession, useAgentWorkspaces, useAiTask, useArbiChat, useArbiConnected, useArbiDocumentSync, useArbiShellWorkspaces, useArbiUiStore, useArbiWebSocket, useArbiWsContext, useArbiWsMessage, useArbiWsStatus, useArbiWsStore, useArbiWsTask, useArbiWsTasks, useAvatarCrop, useCameraStream, useCloseAgentSession, useCommandPalette, useConfirmEmailChange, useContacts, useConversationActivity, useConversationPendingAuth, useCreateAgent, useCreateWork, useCreateWorkflow, useCurrentSessionId, useDeleteAccount, useDeleteAccountFlow, useDeleteWorkflow, useDirectMessages, useEmailChange, useGrantAgentAccess, useIdentityVerification, useIdentityVerificationFlow, useLogoutAllSessions, useNameEditor, useNotificationPreferences, usePasswordChange, usePasswordChangeForm, usePendingContacts, usePlanWork, useProfile, useRemoveContacts, useRequestEmailChange, useRevokeAgentAccess, useRunConversation, useRunWorkflow, useSaveAgentConfig, useSemanticSearch, useShellWorkspaces, useSkills, useStartAgentSession, useStartWorkQuery, useTerminateSession, useUpdateConversation, useUpdateProfile, useUpdateWorkflow, useUploadSkillFiles, useUserSettings, useVideoRecorder, useWorkNotifications, useWorkflows, useWorkspaceDocs, userDisplayName, userInitials };
6110
6423
  //# sourceMappingURL=index.js.map
6111
6424
  //# sourceMappingURL=index.js.map