@ezychat/web 0.0.0-stage → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/assets/font-1be3448e292f.woff2 +0 -0
- package/dist-lib/assets/font-3100e775e861.woff2 +0 -0
- package/dist-lib/assets/font-34b9c504cab7.woff2 +0 -0
- package/dist-lib/assets/font-5c66f9e07e90.woff2 +0 -0
- package/dist-lib/assets/font-6e9e020a25f9.woff2 +0 -0
- package/dist-lib/assets/font-71d5ee93cc1e.woff2 +0 -0
- package/dist-lib/assets/font-ca157063339a.woff2 +0 -0
- package/dist-lib/chunks/admin-BPgvUcQO.js +602 -0
- package/dist-lib/chunks/admin-B_hIZ1Sp.js +603 -0
- package/dist-lib/chunks/app-C2A7ZZsu.js +97 -0
- package/dist-lib/chunks/app-RX8Fy2Oz.js +97 -0
- package/dist-lib/chunks/auth-Cif_yktU.js +127 -0
- package/dist-lib/chunks/auth-DJBQd10l.js +127 -0
- package/dist-lib/chunks/common-BwLWsyiW.js +80 -0
- package/dist-lib/chunks/common-CDytP7HK.js +80 -0
- package/dist-lib/chunks/errors-BIyy5VTn.js +39 -0
- package/dist-lib/chunks/errors-CEweqDjm.js +39 -0
- package/dist-lib/chunks/inbox-IiNeuwOm.js +487 -0
- package/dist-lib/chunks/inbox-VvClcCZP.js +487 -0
- package/dist-lib/chunks/registerSW-Gn8zt2XY.js +16 -0
- package/dist-lib/ezychat-web.css +2 -0
- package/dist-lib/index.js +16732 -0
- package/dist-lib/public/apple-touch-icon.png +0 -0
- package/dist-lib/public/brand/ezychat-logo.png +0 -0
- package/dist-lib/public/favicon.ico +0 -0
- package/dist-lib/public/icon-192.png +0 -0
- package/dist-lib/public/icon-512.png +0 -0
- package/dist-lib/public/icon-maskable-512.png +0 -0
- package/dist-lib/public/illustrations/empty-inbox.png +0 -0
- package/dist-lib/public/illustrations/link-whatsapp.png +0 -0
- package/dist-lib/public/illustrations/no-results.png +0 -0
- package/dist-lib/public/illustrations/tunnel.png +0 -0
- package/dist-lib/public/illustrations/welcome.png +0 -0
- package/dist-lib/public/share-app.svg +16 -0
- package/dist-lib/sw.ts +71 -0
- package/dist-lib/types/App.d.ts +2 -0
- package/dist-lib/types/access/AccessGate.d.ts +24 -0
- package/dist-lib/types/access/BannerSlot.d.ts +35 -0
- package/dist-lib/types/access/events.d.ts +16 -0
- package/dist-lib/types/admin/AdminLayout.d.ts +36 -0
- package/dist-lib/types/admin/AiConnectionBanner.d.ts +7 -0
- package/dist-lib/types/admin/AiConnectionSection.d.ts +3 -0
- package/dist-lib/types/admin/AiContextPanel.d.ts +11 -0
- package/dist-lib/types/admin/AiEditDialog.d.ts +13 -0
- package/dist-lib/types/admin/AiMemberPage.d.ts +1 -0
- package/dist-lib/types/admin/AiQuickConnect.d.ts +22 -0
- package/dist-lib/types/admin/AiTryIt.d.ts +8 -0
- package/dist-lib/types/admin/AiVoiceSection.d.ts +2 -0
- package/dist-lib/types/admin/AuditPage.d.ts +1 -0
- package/dist-lib/types/admin/CloudflareSetup.d.ts +5 -0
- package/dist-lib/types/admin/CreateTokenDialog.d.ts +13 -0
- package/dist-lib/types/admin/CustomerEnrichmentSection.d.ts +1 -0
- package/dist-lib/types/admin/EnrichmentAuditScore.d.ts +4 -0
- package/dist-lib/types/admin/IntegrationsSection.d.ts +7 -0
- package/dist-lib/types/admin/MembersPage.d.ts +2 -0
- package/dist-lib/types/admin/QuickRepliesPage.d.ts +2 -0
- package/dist-lib/types/admin/ResolveAllChatsCard.d.ts +1 -0
- package/dist-lib/types/admin/SettingsPage.d.ts +2 -0
- package/dist-lib/types/admin/TokenConnectSteps.d.ts +12 -0
- package/dist-lib/types/admin/TunnelPage.d.ts +1 -0
- package/dist-lib/types/admin/WhatsAppPage.d.ts +11 -0
- package/dist-lib/types/admin/adminUi.d.ts +62 -0
- package/dist-lib/types/admin/ai-status.d.ts +12 -0
- package/dist-lib/types/admin/audit-actions.d.ts +10 -0
- package/dist-lib/types/admin/line-diff.d.ts +26 -0
- package/dist-lib/types/admin/use-chatgpt-sign-in.d.ts +14 -0
- package/dist-lib/types/api/ai.d.ts +174 -0
- package/dist-lib/types/api/client.d.ts +22 -0
- package/dist-lib/types/api/enrichment.d.ts +8 -0
- package/dist-lib/types/api/queries.d.ts +664 -0
- package/dist-lib/types/api/resume-reconnect.d.ts +15 -0
- package/dist-lib/types/api/socket.d.ts +19 -0
- package/dist-lib/types/api/voice.d.ts +33 -0
- package/dist-lib/types/auth/AuthProvider.d.ts +15 -0
- package/dist-lib/types/auth/AuthShell.d.ts +28 -0
- package/dist-lib/types/auth/ChangePasswordPage.d.ts +2 -0
- package/dist-lib/types/auth/LoginPage.d.ts +2 -0
- package/dist-lib/types/auth/RequireAuth.d.ts +12 -0
- package/dist-lib/types/auth/UserMenu.d.ts +5 -0
- package/dist-lib/types/components/app/AboutDialog.d.ts +7 -0
- package/dist-lib/types/components/app/AppCredits.d.ts +8 -0
- package/dist-lib/types/components/app/DesktopUpdates.d.ts +3 -0
- package/dist-lib/types/components/app/DevBuildBadge.d.ts +5 -0
- package/dist-lib/types/components/app/ErrorBoundary.d.ts +23 -0
- package/dist-lib/types/components/app/FeatureRequestAction.d.ts +7 -0
- package/dist-lib/types/components/app/SearchField.d.ts +7 -0
- package/dist-lib/types/components/app/SegmentedControl.d.ts +19 -0
- package/dist-lib/types/components/app/ShareAppAction.d.ts +5 -0
- package/dist-lib/types/components/app/index.d.ts +81 -0
- package/dist-lib/types/components/ui/alert-dialog.d.ts +18 -0
- package/dist-lib/types/components/ui/avatar.d.ts +11 -0
- package/dist-lib/types/components/ui/badge.d.ts +9 -0
- package/dist-lib/types/components/ui/button.d.ts +10 -0
- package/dist-lib/types/components/ui/card.d.ts +9 -0
- package/dist-lib/types/components/ui/checkbox.d.ts +4 -0
- package/dist-lib/types/components/ui/command.d.ts +18 -0
- package/dist-lib/types/components/ui/dialog.d.ts +17 -0
- package/dist-lib/types/components/ui/drawer.d.ts +13 -0
- package/dist-lib/types/components/ui/dropdown-menu.d.ts +25 -0
- package/dist-lib/types/components/ui/input.d.ts +3 -0
- package/dist-lib/types/components/ui/label.d.ts +4 -0
- package/dist-lib/types/components/ui/popover.d.ts +10 -0
- package/dist-lib/types/components/ui/progress.d.ts +4 -0
- package/dist-lib/types/components/ui/radio-group.d.ts +5 -0
- package/dist-lib/types/components/ui/scroll-area.d.ts +5 -0
- package/dist-lib/types/components/ui/select.d.ts +15 -0
- package/dist-lib/types/components/ui/separator.d.ts +4 -0
- package/dist-lib/types/components/ui/sheet.d.ts +14 -0
- package/dist-lib/types/components/ui/skeleton.d.ts +2 -0
- package/dist-lib/types/components/ui/sonner.d.ts +4 -0
- package/dist-lib/types/components/ui/switch.d.ts +6 -0
- package/dist-lib/types/components/ui/table.d.ts +10 -0
- package/dist-lib/types/components/ui/tabs.d.ts +11 -0
- package/dist-lib/types/components/ui/textarea.d.ts +3 -0
- package/dist-lib/types/components/ui/tooltip.d.ts +7 -0
- package/dist-lib/types/create-app.d.ts +20 -0
- package/dist-lib/types/extensions/context.d.ts +8 -0
- package/dist-lib/types/extensions/i18n.d.ts +15 -0
- package/dist-lib/types/extensions/index.d.ts +4 -0
- package/dist-lib/types/extensions/routes.d.ts +12 -0
- package/dist-lib/types/extensions/types.d.ts +116 -0
- package/dist-lib/types/i18n/LanguageSelect.d.ts +4 -0
- package/dist-lib/types/i18n/LocaleSync.d.ts +2 -0
- package/dist-lib/types/i18n/date-locale.d.ts +5 -0
- package/dist-lib/types/i18n/index.d.ts +17 -0
- package/dist-lib/types/i18n/locale-store.d.ts +26 -0
- package/dist-lib/types/i18n/resources.d.ts +1711 -0
- package/dist-lib/types/i18n/use-change-locale.d.ts +9 -0
- package/dist-lib/types/inbox/ChatAvatar.d.ts +13 -0
- package/dist-lib/types/inbox/ChatFilters.d.ts +6 -0
- package/dist-lib/types/inbox/ChatList.d.ts +9 -0
- package/dist-lib/types/inbox/ChatListItem.d.ts +13 -0
- package/dist-lib/types/inbox/Composer.d.ts +30 -0
- package/dist-lib/types/inbox/Conversation.d.ts +7 -0
- package/dist-lib/types/inbox/ConversationHeader.d.ts +25 -0
- package/dist-lib/types/inbox/CustomerPanel.d.ts +32 -0
- package/dist-lib/types/inbox/EmojiPicker.d.ts +6 -0
- package/dist-lib/types/inbox/EventItem.d.ts +14 -0
- package/dist-lib/types/inbox/GettingStartedCard.d.ts +10 -0
- package/dist-lib/types/inbox/GroupPanel.d.ts +19 -0
- package/dist-lib/types/inbox/InboxPage.d.ts +2 -0
- package/dist-lib/types/inbox/MediaView.d.ts +8 -0
- package/dist-lib/types/inbox/MessageBubble.d.ts +31 -0
- package/dist-lib/types/inbox/MessageList.d.ts +21 -0
- package/dist-lib/types/inbox/NotesPanel.d.ts +15 -0
- package/dist-lib/types/inbox/PanelHeader.d.ts +13 -0
- package/dist-lib/types/inbox/ProfileImageContext.d.ts +5 -0
- package/dist-lib/types/inbox/QuickReplyPicker.d.ts +18 -0
- package/dist-lib/types/inbox/ReconnectBanner.d.ts +8 -0
- package/dist-lib/types/inbox/TagInput.d.ts +14 -0
- package/dist-lib/types/inbox/TypingIndicator.d.ts +6 -0
- package/dist-lib/types/inbox/VoiceNote.d.ts +36 -0
- package/dist-lib/types/inbox/WaBanner.d.ts +9 -0
- package/dist-lib/types/inbox/chat-title.d.ts +4 -0
- package/dist-lib/types/inbox/navigation-guard.d.ts +17 -0
- package/dist-lib/types/inbox/timeline.d.ts +26 -0
- package/dist-lib/types/inbox/useCanonicalChatRedirect.d.ts +2 -0
- package/dist-lib/types/inbox/useDirectory.d.ts +21 -0
- package/dist-lib/types/inbox/useSwipeReply.d.ts +11 -0
- package/dist-lib/types/index.d.ts +43 -0
- package/dist-lib/types/lib/ai-handoff.d.ts +4 -0
- package/dist-lib/types/lib/app-links.d.ts +9 -0
- package/dist-lib/types/lib/desktop-updates.d.ts +15 -0
- package/dist-lib/types/lib/error-reporter.d.ts +6 -0
- package/dist-lib/types/lib/format.d.ts +20 -0
- package/dist-lib/types/lib/jid.d.ts +15 -0
- package/dist-lib/types/lib/links.d.ts +40 -0
- package/dist-lib/types/lib/share-app.d.ts +18 -0
- package/dist-lib/types/lib/theme.d.ts +29 -0
- package/dist-lib/types/lib/use-media-query.d.ts +2 -0
- package/dist-lib/types/lib/utils.d.ts +2 -0
- package/dist-lib/types/lib/version.d.ts +12 -0
- package/dist-lib/types/lib/voice-recorder.d.ts +26 -0
- package/dist-lib/types/pwa/InstallHint.d.ts +9 -0
- package/dist-lib/types/pwa/PushToggle.d.ts +20 -0
- package/dist-lib/types/pwa/desktop-notifications.d.ts +18 -0
- package/dist-lib/types/pwa/push.d.ts +13 -0
- package/dist-lib/types/setup/AiAssistantStep.d.ts +9 -0
- package/dist-lib/types/setup/SetupWizard.d.ts +3 -0
- package/dist-lib/types/setup/WaLinkStep.d.ts +8 -0
- package/dist-lib/types/setup/agent-name.d.ts +8 -0
- package/dist-lib/types/setup/connected-label.d.ts +7 -0
- package/dist-lib/types/setup/username.d.ts +9 -0
- package/dist-lib/types/wa/PhoneLink.d.ts +4 -0
- package/package.json +81 -4
- package/README.md +0 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type DiffLine = {
|
|
2
|
+
type: 'same' | 'add' | 'del';
|
|
3
|
+
text: string;
|
|
4
|
+
};
|
|
5
|
+
/** Unchanged lines folded away in a review ("⋯ 12 unchanged lines"). */
|
|
6
|
+
export type DiffSkip = {
|
|
7
|
+
type: 'skip';
|
|
8
|
+
count: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A review-sized diff: each change keeps `context` unchanged lines around it; longer unchanged runs
|
|
12
|
+
* fold into one skip entry. A single unchanged line is shown rather than folded.
|
|
13
|
+
*/
|
|
14
|
+
export declare function collapseDiff(lines: DiffLine[], context?: number): Array<DiffLine | DiffSkip>;
|
|
15
|
+
/**
|
|
16
|
+
* Most line pairs compared one by one (the comparison table holds one number per pair, so this
|
|
17
|
+
* bounds it at ~8 MB). Larger changed middles show as one block out, then one block in.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DIFF_MAX_LINE_PAIRS = 1000000;
|
|
20
|
+
/**
|
|
21
|
+
* A line diff of `before` → `after`: shared first and last lines are kept as they are, and the
|
|
22
|
+
* changed middle is compared line by line (longest common subsequence) when small enough. In each
|
|
23
|
+
* changed block the removed lines come before the added ones, so a rewritten line reads "old, then
|
|
24
|
+
* new".
|
|
25
|
+
*/
|
|
26
|
+
export declare function lineDiff(before: string, after: string): DiffLine[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AiMemberStatus } from '@ezychat/shared';
|
|
2
|
+
import type { useAiMemberAction } from '../api/ai';
|
|
3
|
+
type AiAction = ReturnType<typeof useAiMemberAction>;
|
|
4
|
+
/**
|
|
5
|
+
* EXPERIMENTAL one-click ChatGPT sign-in, shared by Settings → AI and the quick connect block:
|
|
6
|
+
* save ChatGPT mode if needed, start sign-in, then open the official sign-in page in a new tab.
|
|
7
|
+
* Errors surface through `action.error`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useChatgptSignIn(action: AiAction): {
|
|
10
|
+
signIn: (status: AiMemberStatus, model?: string) => Promise<void>;
|
|
11
|
+
popupBlocked: boolean;
|
|
12
|
+
resetPopup: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type AiMemberBody, type AiConnectionBody, type AiContextPatchBody, type AiContextTextBody, type AiEditBody } from '@ezychat/shared';
|
|
2
|
+
export declare const aiMemberKey: readonly ["ai-member"];
|
|
3
|
+
export declare function useAiMember(): import("@tanstack/react-query").UseQueryResult<{
|
|
4
|
+
member: {
|
|
5
|
+
id: number;
|
|
6
|
+
username: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
role: "admin" | "agent";
|
|
9
|
+
mustChangePassword: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
locale: "en" | "ms" | "zh-CN" | null;
|
|
13
|
+
kind?: "human" | "ai" | undefined;
|
|
14
|
+
aiRole?: "sales" | undefined;
|
|
15
|
+
} | null;
|
|
16
|
+
settings: {
|
|
17
|
+
displayName: string;
|
|
18
|
+
mode: "api" | "chatgpt";
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
model: string;
|
|
21
|
+
instructions: string;
|
|
22
|
+
handoffRules?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
hasApiKey: boolean;
|
|
25
|
+
connection: {
|
|
26
|
+
state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
|
|
27
|
+
loginUrl: string | null;
|
|
28
|
+
error: string | null;
|
|
29
|
+
email?: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
documents: {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
kind: "text" | "file";
|
|
35
|
+
size: number;
|
|
36
|
+
characters: number;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
updatedAt: number;
|
|
39
|
+
}[];
|
|
40
|
+
}, Error>;
|
|
41
|
+
/** One Business context item with its text (full for text items, a preview for files). */
|
|
42
|
+
export declare function useAiDocument(id: number | null): import("@tanstack/react-query").UseQueryResult<{
|
|
43
|
+
id: number;
|
|
44
|
+
name: string;
|
|
45
|
+
kind: "text" | "file";
|
|
46
|
+
size: number;
|
|
47
|
+
characters: number;
|
|
48
|
+
createdAt: number;
|
|
49
|
+
updatedAt: number;
|
|
50
|
+
text: string;
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
}, Error>;
|
|
53
|
+
/** EXPERIMENTAL direct ChatGPT sign-in: live models for the signed-in account (or a fallback). */
|
|
54
|
+
export declare function useAiModels(enabled: boolean, connected: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
55
|
+
models: {
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
}[];
|
|
59
|
+
source: "fallback" | "live";
|
|
60
|
+
}, Error>;
|
|
61
|
+
export declare function useAiTest(): import("@tanstack/react-query").UseMutationResult<{
|
|
62
|
+
ok: boolean;
|
|
63
|
+
model: string | null;
|
|
64
|
+
reply: string | null;
|
|
65
|
+
error: string | null;
|
|
66
|
+
}, Error, void, unknown>;
|
|
67
|
+
/** Try it: answers from the page's current knowledge; never touches chats or WhatsApp. */
|
|
68
|
+
export declare function useAiTry(): import("@tanstack/react-query").UseMutationResult<{
|
|
69
|
+
ok: boolean;
|
|
70
|
+
reply: string | null;
|
|
71
|
+
action: "answer" | "ask_resolution" | "resolve" | "handoff" | null;
|
|
72
|
+
model: string | null;
|
|
73
|
+
error: string | null;
|
|
74
|
+
handoffReason?: "asked_for_human" | "missing_facts" | "sensitive" | "needs_action" | "business_rule" | "unsupported_message" | "ai_unavailable" | "lookup_failed" | null | undefined;
|
|
75
|
+
lookups?: {
|
|
76
|
+
title: string;
|
|
77
|
+
sourceLabel: string;
|
|
78
|
+
tool: string;
|
|
79
|
+
source: string;
|
|
80
|
+
ok: boolean;
|
|
81
|
+
ms: number;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
}, Error, {
|
|
84
|
+
question: string;
|
|
85
|
+
knowledge: {
|
|
86
|
+
displayName: string;
|
|
87
|
+
instructions: string;
|
|
88
|
+
handoffRules?: string | undefined;
|
|
89
|
+
};
|
|
90
|
+
}, unknown>;
|
|
91
|
+
/** Edit with AI: a suggested rewrite of one box; nothing is saved (the page's Save does that). */
|
|
92
|
+
/** Edit with AI. Pass a signal so closing the popup stops the (paid) model call. */
|
|
93
|
+
export declare function useAiEdit(): import("@tanstack/react-query").UseMutationResult<{
|
|
94
|
+
ok: boolean;
|
|
95
|
+
text: string | null;
|
|
96
|
+
error: string | null;
|
|
97
|
+
}, Error, {
|
|
98
|
+
body: AiEditBody;
|
|
99
|
+
signal: AbortSignal;
|
|
100
|
+
}, unknown>;
|
|
101
|
+
export type AiMemberAction = {
|
|
102
|
+
kind: 'save';
|
|
103
|
+
settings: AiMemberBody;
|
|
104
|
+
} | {
|
|
105
|
+
kind: 'connection';
|
|
106
|
+
settings: AiConnectionBody;
|
|
107
|
+
} | {
|
|
108
|
+
kind: 'upload';
|
|
109
|
+
file: File;
|
|
110
|
+
} | {
|
|
111
|
+
kind: 'remove';
|
|
112
|
+
id: number;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'removeMany';
|
|
115
|
+
ids: number[];
|
|
116
|
+
} | {
|
|
117
|
+
kind: 'addText';
|
|
118
|
+
body: AiContextTextBody;
|
|
119
|
+
} | {
|
|
120
|
+
kind: 'updateText';
|
|
121
|
+
id: number;
|
|
122
|
+
body: AiContextPatchBody;
|
|
123
|
+
} | {
|
|
124
|
+
kind: 'login';
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'logout';
|
|
127
|
+
} | {
|
|
128
|
+
kind: 'callback';
|
|
129
|
+
url: string;
|
|
130
|
+
};
|
|
131
|
+
/** Some items of a batch delete failed (not 404); `failedIds` are the ones to retry. */
|
|
132
|
+
export declare class BatchDeleteError extends Error {
|
|
133
|
+
readonly failedIds: number[];
|
|
134
|
+
readonly firstError: unknown;
|
|
135
|
+
constructor(failedIds: number[], firstError: unknown);
|
|
136
|
+
}
|
|
137
|
+
export declare function useAiMemberAction(): import("@tanstack/react-query").UseMutationResult<{
|
|
138
|
+
member: {
|
|
139
|
+
id: number;
|
|
140
|
+
username: string;
|
|
141
|
+
displayName: string;
|
|
142
|
+
role: "admin" | "agent";
|
|
143
|
+
mustChangePassword: boolean;
|
|
144
|
+
disabled: boolean;
|
|
145
|
+
createdAt: number;
|
|
146
|
+
locale: "en" | "ms" | "zh-CN" | null;
|
|
147
|
+
kind?: "human" | "ai" | undefined;
|
|
148
|
+
aiRole?: "sales" | undefined;
|
|
149
|
+
} | null;
|
|
150
|
+
settings: {
|
|
151
|
+
displayName: string;
|
|
152
|
+
mode: "api" | "chatgpt";
|
|
153
|
+
enabled: boolean;
|
|
154
|
+
model: string;
|
|
155
|
+
instructions: string;
|
|
156
|
+
handoffRules?: string | undefined;
|
|
157
|
+
};
|
|
158
|
+
hasApiKey: boolean;
|
|
159
|
+
connection: {
|
|
160
|
+
state: "unavailable" | "connected" | "error" | "expired" | "signed_out" | "signing_in";
|
|
161
|
+
loginUrl: string | null;
|
|
162
|
+
error: string | null;
|
|
163
|
+
email?: string | null | undefined;
|
|
164
|
+
};
|
|
165
|
+
documents: {
|
|
166
|
+
id: number;
|
|
167
|
+
name: string;
|
|
168
|
+
kind: "text" | "file";
|
|
169
|
+
size: number;
|
|
170
|
+
characters: number;
|
|
171
|
+
createdAt: number;
|
|
172
|
+
updatedAt: number;
|
|
173
|
+
}[];
|
|
174
|
+
}, Error, AiMemberAction, unknown>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
export declare const UNAUTHORIZED_EVENT = "wati:unauthorized";
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
status: number;
|
|
5
|
+
code: string;
|
|
6
|
+
constructor(status: number, code: string, message: string);
|
|
7
|
+
}
|
|
8
|
+
export interface ApiInit<T> {
|
|
9
|
+
method?: string;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
form?: FormData;
|
|
12
|
+
schema?: z.ZodType<T>;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Fetch `/api${path}` with same-origin cookies. JSON in / JSON out.
|
|
17
|
+
* Non-2xx → ApiError (code/message from the server's `{ error: { code, message } }` body).
|
|
18
|
+
* 401 additionally dispatches a `wati:unauthorized` window event.
|
|
19
|
+
*/
|
|
20
|
+
export declare function api<T = unknown>(path: string, init?: ApiInit<T>): Promise<T>;
|
|
21
|
+
/** Friendly, translated message for any thrown error. */
|
|
22
|
+
export declare function errorMessage(e: unknown): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function useEnrichment(): import("@tanstack/react-query").UseQueryResult<{
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
connected: boolean;
|
|
4
|
+
}, Error>;
|
|
5
|
+
export declare function useSaveEnrichment(): import("@tanstack/react-query").UseMutationResult<{
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
connected: boolean;
|
|
8
|
+
}, Error, boolean, unknown>;
|