@arbidocs/react 0.4.70 → 0.4.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/ProductionDialog-BRrZ5Lj5.d.cts +84 -0
- package/dist/ProductionDialog-DUC9BXWS.d.ts +84 -0
- package/dist/annotations/freeze/index.cjs +45 -1100
- package/dist/annotations/freeze/index.cjs.map +1 -1
- package/dist/annotations/freeze/index.d.cts +2 -85
- package/dist/annotations/freeze/index.d.ts +2 -85
- package/dist/annotations/freeze/index.js +4 -1084
- package/dist/annotations/freeze/index.js.map +1 -1
- package/dist/annotations/index.cjs +48 -48
- package/dist/annotations/index.d.cts +3 -51
- package/dist/annotations/index.d.ts +3 -51
- package/dist/annotations/index.js +2 -2
- package/dist/artifacts/index.cjs +9 -9
- package/dist/artifacts/index.js +2 -2
- package/dist/bundle-BnCSbHy2.d.cts +85 -0
- package/dist/bundle-BnCSbHy2.d.ts +85 -0
- package/dist/bundle-N2JIJ2T6.js +4 -0
- package/dist/bundle-N2JIJ2T6.js.map +1 -0
- package/dist/bundle-T6BEVYHE.cjs +13 -0
- package/dist/bundle-T6BEVYHE.cjs.map +1 -0
- package/dist/{chunk-7CL7QHT6.cjs → chunk-GE5TAR7Y.cjs} +26 -25
- package/dist/chunk-GE5TAR7Y.cjs.map +1 -0
- package/dist/{chunk-3QF5DNAP.js → chunk-IHTBAY57.js} +3 -3
- package/dist/{chunk-3QF5DNAP.js.map → chunk-IHTBAY57.js.map} +1 -1
- package/dist/{chunk-ZMTLGO3K.cjs → chunk-IIT7DMQL.cjs} +6 -2
- package/dist/chunk-IIT7DMQL.cjs.map +1 -0
- package/dist/{chunk-SYPUFZGA.js → chunk-IQ5TYPVU.js} +4 -3
- package/dist/chunk-IQ5TYPVU.js.map +1 -0
- package/dist/{chunk-ULU5LEWF.cjs → chunk-L2PXZWJM.cjs} +25 -25
- package/dist/{chunk-ULU5LEWF.cjs.map → chunk-L2PXZWJM.cjs.map} +1 -1
- package/dist/{chunk-V4CXOPLB.js → chunk-MHCN7OST.js} +19 -7
- package/dist/{chunk-V4CXOPLB.js.map → chunk-MHCN7OST.js.map} +1 -1
- package/dist/{chunk-BTRIS3HY.cjs → chunk-QJRP2LLQ.cjs} +19 -6
- package/dist/chunk-QJRP2LLQ.cjs.map +1 -0
- package/dist/chunk-QJXFRP5R.cjs +1103 -0
- package/dist/chunk-QJXFRP5R.cjs.map +1 -0
- package/dist/{chunk-J4MX2W4H.js → chunk-WBYNKFUO.js} +6 -3
- package/dist/chunk-WBYNKFUO.js.map +1 -0
- package/dist/{chunk-LQ5YHB7W.cjs → chunk-WYZJLZ67.cjs} +6 -4
- package/dist/chunk-WYZJLZ67.cjs.map +1 -0
- package/dist/{chunk-WS6DF5X4.js → chunk-YNNAJJ5Z.js} +6 -4
- package/dist/chunk-YNNAJJ5Z.js.map +1 -0
- package/dist/chunk-ZJMUNGOY.js +1088 -0
- package/dist/chunk-ZJMUNGOY.js.map +1 -0
- package/dist/document-tools/index.cjs +226 -11
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +139 -9
- package/dist/document-tools/index.d.ts +139 -9
- package/dist/document-tools/index.js +207 -9
- package/dist/document-tools/index.js.map +1 -1
- package/dist/{index-BWv_FKi3.d.cts → index-BVMBElCu.d.cts} +82 -1
- package/dist/{index-BWv_FKi3.d.ts → index-BVMBElCu.d.ts} +82 -1
- package/dist/index.cjs +688 -369
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +208 -4
- package/dist/index.d.ts +208 -4
- package/dist/index.js +313 -11
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +137 -133
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/viewers/index.cjs +2 -2
- package/dist/viewers/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-7CL7QHT6.cjs.map +0 -1
- package/dist/chunk-BTRIS3HY.cjs.map +0 -1
- package/dist/chunk-J4MX2W4H.js.map +0 -1
- package/dist/chunk-LQ5YHB7W.cjs.map +0 -1
- package/dist/chunk-SYPUFZGA.js.map +0 -1
- package/dist/chunk-WS6DF5X4.js.map +0 -1
- package/dist/chunk-ZMTLGO3K.cjs.map +0 -1
- package/dist/store-CqkkD7Ho.d.cts +0 -35
- package/dist/store-D1nhbkgk.d.ts +0 -35
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { arbiQueryKeys, useDocuments, useConversations, useAssistantQuery, useConversationThreads, useWorkspaces, useParsedDocument, useTags, useActivity, useThumbnails } from './chunk-
|
|
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-
|
|
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 {
|
|
7
|
-
|
|
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';
|
|
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';
|
|
10
15
|
import { normalizeCitationMarkup } from './chunk-QRCMKEE6.js';
|
|
11
16
|
export { closeOpenEmphasis, normalizeCitationMarkup, trimOpenCitation } from './chunk-QRCMKEE6.js';
|
|
12
|
-
import { Button, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-WS6DF5X4.js';
|
|
13
|
-
export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from './chunk-WS6DF5X4.js';
|
|
14
17
|
import { ScrollArea } from './chunk-W4H6XAIU.js';
|
|
15
18
|
export { ScrollArea, ScrollBar } from './chunk-W4H6XAIU.js';
|
|
16
19
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './chunk-47CCGUWR.js';
|
|
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-J4MX2W4H.js';
|
|
22
|
-
export { ArbiProvider, useArbi } from './chunk-J4MX2W4H.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';
|
|
@@ -1517,6 +1517,7 @@ function useUpdateProfile() {
|
|
|
1517
1517
|
},
|
|
1518
1518
|
onSuccess: (profile) => {
|
|
1519
1519
|
qc.setQueryData(arbiQueryKeys.profile(), profile);
|
|
1520
|
+
void qc.invalidateQueries({ queryKey: arbiQueryKeys.identity() });
|
|
1520
1521
|
return qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
|
|
1521
1522
|
}
|
|
1522
1523
|
});
|
|
@@ -1896,6 +1897,307 @@ function useDeleteAccountFlow({
|
|
|
1896
1897
|
onClose: close
|
|
1897
1898
|
};
|
|
1898
1899
|
}
|
|
1900
|
+
|
|
1901
|
+
// src/account/didit.ts
|
|
1902
|
+
var sdkPromise = null;
|
|
1903
|
+
function loadDidit() {
|
|
1904
|
+
sdkPromise ??= import('@didit-protocol/sdk-web').then((m) => m.DiditSdk);
|
|
1905
|
+
sdkPromise.catch(() => {
|
|
1906
|
+
sdkPromise = null;
|
|
1907
|
+
});
|
|
1908
|
+
return sdkPromise;
|
|
1909
|
+
}
|
|
1910
|
+
async function mountDiditVerification({
|
|
1911
|
+
url,
|
|
1912
|
+
containerId,
|
|
1913
|
+
onResult
|
|
1914
|
+
}) {
|
|
1915
|
+
const Sdk = await loadDidit();
|
|
1916
|
+
const sdk = Sdk.shared;
|
|
1917
|
+
sdk.onComplete = onResult;
|
|
1918
|
+
await sdk.startVerification({
|
|
1919
|
+
url,
|
|
1920
|
+
configuration: {
|
|
1921
|
+
embedded: true,
|
|
1922
|
+
embeddedContainerId: containerId,
|
|
1923
|
+
showCloseButton: false,
|
|
1924
|
+
closeModalOnComplete: true
|
|
1925
|
+
}
|
|
1926
|
+
});
|
|
1927
|
+
return () => {
|
|
1928
|
+
sdk.onComplete = void 0;
|
|
1929
|
+
sdk.destroy();
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
// src/account/identity.ts
|
|
1934
|
+
function problemOf(error, fallback) {
|
|
1935
|
+
const code = identityErrorCode(error) ?? error?.code;
|
|
1936
|
+
const message = error instanceof Error && error.message ? error.message : fallback;
|
|
1937
|
+
return { code: typeof code === "string" ? code : void 0, message };
|
|
1938
|
+
}
|
|
1939
|
+
function identityStepFor(status) {
|
|
1940
|
+
if (!status) return "pay";
|
|
1941
|
+
if (["name_mismatch", "in_review", "verified"].includes(status.state)) return "result";
|
|
1942
|
+
if (status.state === "declined") return status.attempts_left > 0 ? "result" : "pay";
|
|
1943
|
+
if (status.state === "in_progress" || status.attempts_left > 0) return "verify";
|
|
1944
|
+
return "pay";
|
|
1945
|
+
}
|
|
1946
|
+
function formatIdentityPrice(status) {
|
|
1947
|
+
let amount;
|
|
1948
|
+
try {
|
|
1949
|
+
amount = new Intl.NumberFormat("en-GB", {
|
|
1950
|
+
style: "currency",
|
|
1951
|
+
currency: status.currency
|
|
1952
|
+
}).format(status.price_pence / 100);
|
|
1953
|
+
} catch {
|
|
1954
|
+
amount = `${(status.price_pence / 100).toFixed(2)} ${status.currency}`;
|
|
1955
|
+
}
|
|
1956
|
+
return `${amount} incl. VAT`;
|
|
1957
|
+
}
|
|
1958
|
+
function useIdentityVerificationFlow(api, {
|
|
1959
|
+
enabled = true,
|
|
1960
|
+
onVerifiedChange,
|
|
1961
|
+
onNameAccepted,
|
|
1962
|
+
formatPrice = formatIdentityPrice
|
|
1963
|
+
} = {}) {
|
|
1964
|
+
const qc = useQueryClient();
|
|
1965
|
+
const apiRef = useRef(api);
|
|
1966
|
+
apiRef.current = api;
|
|
1967
|
+
const query = useQuery({
|
|
1968
|
+
queryKey: arbiQueryKeys.identity(),
|
|
1969
|
+
queryFn: () => apiRef.current.status(),
|
|
1970
|
+
enabled,
|
|
1971
|
+
staleTime: 6e4
|
|
1972
|
+
});
|
|
1973
|
+
const status = query.data;
|
|
1974
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
1975
|
+
const [step, setStep] = useState("pay");
|
|
1976
|
+
const [busy, setBusy] = useState(null);
|
|
1977
|
+
const [problem, setProblem] = useState(null);
|
|
1978
|
+
const [paymentUrl, setPaymentUrl] = useState(null);
|
|
1979
|
+
const [sessionUrl, setSessionUrl] = useState(null);
|
|
1980
|
+
const [container, setContainer] = useState(null);
|
|
1981
|
+
const [embedFailed, setEmbedFailed] = useState(false);
|
|
1982
|
+
const verifyContainerId = `didit-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
1983
|
+
const lastVerified = useRef(void 0);
|
|
1984
|
+
const apply = useCallback(
|
|
1985
|
+
(next) => {
|
|
1986
|
+
qc.setQueryData(arbiQueryKeys.identity(), next);
|
|
1987
|
+
if (lastVerified.current !== void 0 && lastVerified.current !== next.verified) {
|
|
1988
|
+
onVerifiedChange?.(next.verified);
|
|
1989
|
+
}
|
|
1990
|
+
lastVerified.current = next.verified;
|
|
1991
|
+
return next;
|
|
1992
|
+
},
|
|
1993
|
+
[qc, onVerifiedChange]
|
|
1994
|
+
);
|
|
1995
|
+
useEffect(() => {
|
|
1996
|
+
if (status && lastVerified.current === void 0) lastVerified.current = status.verified;
|
|
1997
|
+
}, [status]);
|
|
1998
|
+
const run = useCallback(
|
|
1999
|
+
async (kind, fallback, fn) => {
|
|
2000
|
+
setBusy(kind);
|
|
2001
|
+
setProblem(null);
|
|
2002
|
+
try {
|
|
2003
|
+
return await fn();
|
|
2004
|
+
} catch (e) {
|
|
2005
|
+
setProblem(problemOf(e, fallback));
|
|
2006
|
+
return void 0;
|
|
2007
|
+
} finally {
|
|
2008
|
+
setBusy(null);
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
[]
|
|
2012
|
+
);
|
|
2013
|
+
const isOpenRef = useRef(false);
|
|
2014
|
+
const closeRef = useRef(() => {
|
|
2015
|
+
});
|
|
2016
|
+
const startVerifyRef = useRef(async () => {
|
|
2017
|
+
});
|
|
2018
|
+
const refresh = useCallback(async () => {
|
|
2019
|
+
const next = await run(
|
|
2020
|
+
"refresh",
|
|
2021
|
+
"Could not read the verification result",
|
|
2022
|
+
() => apiRef.current.refresh()
|
|
2023
|
+
);
|
|
2024
|
+
if (!next) return;
|
|
2025
|
+
apply(next);
|
|
2026
|
+
if (next.state === "in_progress") return;
|
|
2027
|
+
setSessionUrl(null);
|
|
2028
|
+
const nextStep = next.state === "declined" ? "result" : identityStepFor(next);
|
|
2029
|
+
if (nextStep === "verify" && isOpenRef.current) void startVerifyRef.current();
|
|
2030
|
+
else setStep(nextStep);
|
|
2031
|
+
}, [run, apply]);
|
|
2032
|
+
const refreshedOnLoad = useRef(false);
|
|
2033
|
+
useEffect(() => {
|
|
2034
|
+
if (refreshedOnLoad.current || !status) return;
|
|
2035
|
+
refreshedOnLoad.current = true;
|
|
2036
|
+
if (status.state === "in_progress" || status.state === "in_review") void refresh();
|
|
2037
|
+
}, [status, refresh]);
|
|
2038
|
+
const startVerify = useCallback(async () => {
|
|
2039
|
+
setStep("verify");
|
|
2040
|
+
setEmbedFailed(false);
|
|
2041
|
+
const url = await run(
|
|
2042
|
+
"start",
|
|
2043
|
+
"Could not start identity verification",
|
|
2044
|
+
() => apiRef.current.startSession()
|
|
2045
|
+
);
|
|
2046
|
+
if (url) {
|
|
2047
|
+
setSessionUrl(url);
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
setStep("pay");
|
|
2051
|
+
}, [run]);
|
|
2052
|
+
startVerifyRef.current = startVerify;
|
|
2053
|
+
useEffect(() => {
|
|
2054
|
+
if (!isOpen || step !== "verify" || !sessionUrl || !container || embedFailed) return;
|
|
2055
|
+
let teardown;
|
|
2056
|
+
let cancelled = false;
|
|
2057
|
+
mountDiditVerification({
|
|
2058
|
+
url: sessionUrl,
|
|
2059
|
+
containerId: container.id,
|
|
2060
|
+
onResult: (result) => {
|
|
2061
|
+
if (result.type === "failed" && result.error?.type === "cameraAccessDenied") {
|
|
2062
|
+
setEmbedFailed(true);
|
|
2063
|
+
return;
|
|
2064
|
+
}
|
|
2065
|
+
if (result.type === "cancelled") {
|
|
2066
|
+
closeRef.current();
|
|
2067
|
+
return;
|
|
2068
|
+
}
|
|
2069
|
+
void refresh();
|
|
2070
|
+
}
|
|
2071
|
+
}).then((stop) => {
|
|
2072
|
+
if (cancelled) stop();
|
|
2073
|
+
else teardown = stop;
|
|
2074
|
+
}).catch(() => setEmbedFailed(true));
|
|
2075
|
+
return () => {
|
|
2076
|
+
cancelled = true;
|
|
2077
|
+
teardown?.();
|
|
2078
|
+
};
|
|
2079
|
+
}, [isOpen, step, sessionUrl, container, embedFailed, refresh]);
|
|
2080
|
+
const [waitingInTab, setWaitingInTab] = useState(false);
|
|
2081
|
+
useEffect(() => {
|
|
2082
|
+
if (!waitingInTab || typeof window === "undefined") return;
|
|
2083
|
+
const onFocus = () => void refresh();
|
|
2084
|
+
window.addEventListener("focus", onFocus);
|
|
2085
|
+
return () => window.removeEventListener("focus", onFocus);
|
|
2086
|
+
}, [waitingInTab, refresh]);
|
|
2087
|
+
const open = useCallback(() => {
|
|
2088
|
+
isOpenRef.current = true;
|
|
2089
|
+
setProblem(null);
|
|
2090
|
+
setPaymentUrl(status?.pending_payment_url ?? null);
|
|
2091
|
+
const first = identityStepFor(status);
|
|
2092
|
+
setStep(first);
|
|
2093
|
+
setIsOpen(true);
|
|
2094
|
+
if (first === "verify") void startVerify();
|
|
2095
|
+
}, [status, startVerify]);
|
|
2096
|
+
const close = useCallback(() => {
|
|
2097
|
+
isOpenRef.current = false;
|
|
2098
|
+
setIsOpen(false);
|
|
2099
|
+
setSessionUrl(null);
|
|
2100
|
+
setWaitingInTab(false);
|
|
2101
|
+
setEmbedFailed(false);
|
|
2102
|
+
setProblem(null);
|
|
2103
|
+
}, []);
|
|
2104
|
+
closeRef.current = close;
|
|
2105
|
+
const pay = useCallback(async () => {
|
|
2106
|
+
const result = await run(
|
|
2107
|
+
"pay",
|
|
2108
|
+
"Payment could not be completed",
|
|
2109
|
+
() => apiRef.current.purchase()
|
|
2110
|
+
);
|
|
2111
|
+
if (!result) return;
|
|
2112
|
+
if (result.status === "requires_action") {
|
|
2113
|
+
setPaymentUrl(result.payment_url ?? null);
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
setPaymentUrl(null);
|
|
2117
|
+
void query.refetch();
|
|
2118
|
+
void startVerify();
|
|
2119
|
+
}, [run, query, startVerify]);
|
|
2120
|
+
const acceptName = useCallback(async () => {
|
|
2121
|
+
const offered = status;
|
|
2122
|
+
const next = await run(
|
|
2123
|
+
"accept",
|
|
2124
|
+
"Could not change your name",
|
|
2125
|
+
() => apiRef.current.acceptName()
|
|
2126
|
+
);
|
|
2127
|
+
if (!next) return;
|
|
2128
|
+
apply(next);
|
|
2129
|
+
if (offered?.document_given_name) {
|
|
2130
|
+
onNameAccepted?.({
|
|
2131
|
+
givenName: offered.document_given_name,
|
|
2132
|
+
familyName: offered.document_family_name ?? null
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
}, [run, apply, status, onNameAccepted]);
|
|
2136
|
+
const remove = useCallback(async () => {
|
|
2137
|
+
const next = await run(
|
|
2138
|
+
"remove",
|
|
2139
|
+
"Could not remove the verification",
|
|
2140
|
+
() => apiRef.current.remove()
|
|
2141
|
+
);
|
|
2142
|
+
if (next) apply(next);
|
|
2143
|
+
}, [run, apply]);
|
|
2144
|
+
const price = useMemo(() => status ? formatPrice(status) : null, [status, formatPrice]);
|
|
2145
|
+
return {
|
|
2146
|
+
status,
|
|
2147
|
+
isLoading: query.isLoading,
|
|
2148
|
+
price,
|
|
2149
|
+
isOpen,
|
|
2150
|
+
open,
|
|
2151
|
+
close,
|
|
2152
|
+
step,
|
|
2153
|
+
busy,
|
|
2154
|
+
problem,
|
|
2155
|
+
paymentUrl,
|
|
2156
|
+
pay: () => void pay(),
|
|
2157
|
+
recheckPayment: () => void startVerify(),
|
|
2158
|
+
verifyContainerId,
|
|
2159
|
+
verifyContainerRef: setContainer,
|
|
2160
|
+
embedFailed,
|
|
2161
|
+
openInNewTab: () => {
|
|
2162
|
+
if (!sessionUrl || typeof window === "undefined") return;
|
|
2163
|
+
window.open(sessionUrl, "_blank", "noopener");
|
|
2164
|
+
setWaitingInTab(true);
|
|
2165
|
+
},
|
|
2166
|
+
checkResult: () => void refresh(),
|
|
2167
|
+
retry: () => void startVerify(),
|
|
2168
|
+
acceptName: () => void acceptName(),
|
|
2169
|
+
keepName: close,
|
|
2170
|
+
remove: () => void remove()
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
function useIdentityVerification(options = {}) {
|
|
2174
|
+
const arbi = useArbi();
|
|
2175
|
+
const qc = useQueryClient();
|
|
2176
|
+
const api = useMemo(
|
|
2177
|
+
() => ({
|
|
2178
|
+
status: () => arbi.identity.status(),
|
|
2179
|
+
purchase: () => arbi.identity.purchase(),
|
|
2180
|
+
startSession: () => arbi.identity.startSession(),
|
|
2181
|
+
refresh: () => arbi.identity.refresh(),
|
|
2182
|
+
acceptName: () => arbi.identity.acceptName(),
|
|
2183
|
+
remove: () => arbi.identity.remove()
|
|
2184
|
+
}),
|
|
2185
|
+
[arbi]
|
|
2186
|
+
);
|
|
2187
|
+
const { onVerifiedChange, onNameAccepted } = options;
|
|
2188
|
+
return useIdentityVerificationFlow(api, {
|
|
2189
|
+
enabled: arbi.isLoggedIn,
|
|
2190
|
+
onVerifiedChange: (verified) => {
|
|
2191
|
+
void qc.invalidateQueries({ queryKey: arbiQueryKeys.profile() });
|
|
2192
|
+
onVerifiedChange?.(verified);
|
|
2193
|
+
},
|
|
2194
|
+
onNameAccepted: (name) => {
|
|
2195
|
+
void qc.invalidateQueries({ queryKey: arbiQueryKeys.profile() });
|
|
2196
|
+
void qc.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() });
|
|
2197
|
+
onNameAccepted?.(name);
|
|
2198
|
+
}
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
1899
2201
|
function useWorkspaceDocs(workspaceId) {
|
|
1900
2202
|
const { data: docs = [], isLoading, isError } = useDocuments(workspaceId);
|
|
1901
2203
|
const docIds = useMemo(
|
|
@@ -6106,6 +6408,6 @@ function hasVideoTrack(blob) {
|
|
|
6106
6408
|
});
|
|
6107
6409
|
}
|
|
6108
6410
|
|
|
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 };
|
|
6411
|
+
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, 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
6412
|
//# sourceMappingURL=index.js.map
|
|
6111
6413
|
//# sourceMappingURL=index.js.map
|