@customer-agent/sdk 0.5.6-test.g260612164307
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/assets/emoji/en-emojibase-data.json +1 -0
- package/chunks/App-DTjTPofP.js +2 -0
- package/chunks/DockNavigation-CI9i1n3W.js +1 -0
- package/chunks/InterviewChatScreen-IQAQHn-E.js +2 -0
- package/chunks/InterviewInvitePrompt-DaJfNLz_.js +1 -0
- package/chunks/MarkdownText-CXKW_2Ol.js +29 -0
- package/chunks/MobileDockDrawer-ZIdezZML.js +1 -0
- package/chunks/Panel-Cfjcp7iD.js +7 -0
- package/chunks/WidgetComposer-CJtPQVbr.js +92 -0
- package/chunks/WidgetGlobalLoading-B_z-6_yk.js +1 -0
- package/chunks/classNames-3q0x02_x.js +1 -0
- package/chunks/client-duvjg9sB.js +9 -0
- package/chunks/constants-BVd2SKDq.js +1 -0
- package/chunks/controller-D2LKL4eu.js +1 -0
- package/chunks/conversationRegistry-Y5Ouo35n.js +1 -0
- package/chunks/createLucideIcon-B1BLVEeA.js +1 -0
- package/chunks/dist-dzGCY2H5.js +41 -0
- package/chunks/dist-gFPJclVl.js +1 -0
- package/chunks/emoji-picker-element-H87_ifwm.js +4 -0
- package/chunks/floating-ui.dom-Cs9alM6A.js +1 -0
- package/chunks/i18n-Q8u2wtW4.js +1 -0
- package/chunks/interviewTypes-Ch2NsXKB.js +1 -0
- package/chunks/jsx-runtime-S2ZBQkZm.js +1 -0
- package/chunks/launcherAnchorStore-JMTZZGKC.js +1 -0
- package/chunks/navigationState-LdqG_Osx.js +1 -0
- package/chunks/panel-DEg2n0VX.js +2 -0
- package/chunks/react-CKmEJ8Ba.js +1 -0
- package/chunks/routes-Dh46ka4-.js +1 -0
- package/chunks/useSmooth-CYGvfMVe.js +3 -0
- package/chunks/x-CcuT5rCV.js +1 -0
- package/index.js +1 -0
- package/messages/de.json +28 -0
- package/messages/en.json +28 -0
- package/messages/es.json +28 -0
- package/messages/fr.json +28 -0
- package/messages/it.json +28 -0
- package/messages/ja.json +28 -0
- package/messages/ko.json +28 -0
- package/messages/pt-BR.json +28 -0
- package/messages/zh-TW.json +28 -0
- package/messages/zh.json +28 -0
- package/package.json +36 -0
- package/react.js +1 -0
- package/runtime.es.js +1 -0
- package/sdk.js +1 -0
- package/types/main.d.ts +0 -0
- package/types/messages/en.json.d.ts +31 -0
- package/types/messages/index.d.ts +53 -0
- package/types/runtime/interview/interviewApiClient.d.ts +2 -0
- package/types/runtime/interview/interviewSessionCache.d.ts +5 -0
- package/types/runtime/interview/interviewSessionService.d.ts +93 -0
- package/types/runtime/interview/interviewTypes.d.ts +115 -0
- package/types/runtime/support/supportApiClient.d.ts +2 -0
- package/types/runtime/support/supportSessionCache.d.ts +4 -0
- package/types/runtime/support/supportSessionService.d.ts +43 -0
- package/types/runtime/support/supportTypes.d.ts +35 -0
- package/types/sdk/apiClient.d.ts +103 -0
- package/types/sdk/config.d.ts +4 -0
- package/types/sdk/constants.d.ts +28 -0
- package/types/sdk/controller.d.ts +36 -0
- package/types/sdk/conversation.d.ts +56 -0
- package/types/sdk/events.d.ts +106 -0
- package/types/sdk/hooks.d.ts +37 -0
- package/types/sdk/i18n.d.ts +9 -0
- package/types/sdk/index.d.ts +8 -0
- package/types/sdk/launcherAnchorStore.d.ts +7 -0
- package/types/sdk/launcherState.d.ts +21 -0
- package/types/sdk/navigationState.d.ts +25 -0
- package/types/sdk/public-types.d.ts +152 -0
- package/types/sdk/runtime.d.ts +37 -0
- package/types/sdk/script.d.ts +16 -0
- package/types/sdk/version.d.ts +7 -0
- package/types/sdk/viewport.d.ts +3 -0
- package/types/types.d.ts +64 -0
- package/types/ui/App.d.ts +55 -0
- package/types/ui/Iframe.d.ts +16 -0
- package/types/ui/Launcher.d.ts +12 -0
- package/types/ui/MarkdownText.d.ts +1 -0
- package/types/ui/Panel.d.ts +52 -0
- package/types/ui/WidgetComposer.d.ts +40 -0
- package/types/ui/WidgetGlobalLoading.d.ts +4 -0
- package/types/ui/WidgetPanelCloseButton.d.ts +4 -0
- package/types/ui/classNames.d.ts +1 -0
- package/types/ui/hostStyle.d.ts +7 -0
- package/types/ui/panel/DockNavigation.d.ts +14 -0
- package/types/ui/panel/MobileDockDrawer.d.ts +13 -0
- package/types/ui/panel/PanelShell.d.ts +26 -0
- package/types/ui/panel/RouteTransition.d.ts +7 -0
- package/types/ui/panel/agentSessionState.d.ts +21 -0
- package/types/ui/registry/conversationRegistry.d.ts +73 -0
- package/types/ui/router/reducer.d.ts +24 -0
- package/types/ui/router/routeNames.d.ts +9 -0
- package/types/ui/router/routeStorage.d.ts +6 -0
- package/types/ui/router/routes.d.ts +32 -0
- package/types/ui/router/targetRoute.d.ts +3 -0
- package/types/ui/screens/interview/InterviewChatScreen.d.ts +18 -0
- package/types/ui/screens/interview/InterviewInvitePrompt.d.ts +13 -0
- package/types/ui/screens/interview/interviewSessionCache.d.ts +10 -0
- package/types/ui/screens/interview/interviewSessionController.d.ts +89 -0
- package/types/ui/screens/interview/interviewUiAdapter.d.ts +3 -0
- package/types/ui/screens/interview/interviewWidgetClient.d.ts +2 -0
- package/types/ui/transcript.d.ts +17 -0
- package/types/ui/useWidgetEmojiPicker.d.ts +20 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
export type WidgetComposerRootProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
isHidden?: boolean;
|
|
6
|
+
onSubmit?(): void;
|
|
7
|
+
};
|
|
8
|
+
export type WidgetComposerInputProps = {
|
|
9
|
+
inputAriaLabel: string;
|
|
10
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function WidgetComposerAttachments({ removeAttachmentLabel }: {
|
|
14
|
+
removeAttachmentLabel?: string;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export declare function WidgetComposerRoot({ children, className, isHidden, onSubmit }: WidgetComposerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function WidgetComposerInput({ inputAriaLabel, inputRef, placeholder }: WidgetComposerInputProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function WidgetComposerActions({ children }: {
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function WidgetComposerTools({ children }: {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function WidgetComposerAttachmentButton({ attachmentLabel }: {
|
|
25
|
+
attachmentLabel?: string;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function WidgetComposerEmojiPopover({ children, hostRef, isLoading, onOpenChange, open }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
hostRef?: Ref<HTMLDivElement>;
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
onOpenChange?(open: boolean): void;
|
|
32
|
+
open?: boolean;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function WidgetComposerEmojiButton({ emojiLabel, emojiTitle }: {
|
|
35
|
+
emojiLabel?: string;
|
|
36
|
+
emojiTitle?: string;
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function WidgetComposerSubmit({ sendLabel }: {
|
|
39
|
+
sendLabel: string;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cx(...classNames: Array<false | null | string | undefined>): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CurrentCustomerAgentOptions } from '../sdk/config';
|
|
2
|
+
export declare const HOST_PANEL_EXPANDED_HEIGHT_OFFSET = 104;
|
|
3
|
+
export declare const HOST_PANEL_EXPANDED_WIDTH = 716;
|
|
4
|
+
export declare const HOST_PANEL_MAX_HEIGHT = 704;
|
|
5
|
+
export declare const HOST_PANEL_SAFE_MARGIN = 20;
|
|
6
|
+
export declare const HOST_PANEL_WIDTH = 460;
|
|
7
|
+
export declare function createHostStyleText(_widgetId: string, options: CurrentCustomerAgentOptions): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConversationEntry, ConversationEntryPrompt } from '../registry/conversationRegistry';
|
|
2
|
+
export type DockNavigationProps = {
|
|
3
|
+
activeEntryId: string;
|
|
4
|
+
entries: ConversationEntry[];
|
|
5
|
+
enableEntryIntroAnimation?: boolean;
|
|
6
|
+
invitePortalContainer?: HTMLElement | null;
|
|
7
|
+
invitePrompt?: ConversationEntryPrompt | null;
|
|
8
|
+
isInvitePromptOpen?: boolean;
|
|
9
|
+
onEntrySelect(entryId: string): void;
|
|
10
|
+
onInviteClose?(invitationId: string): void;
|
|
11
|
+
onInviteLater?(invitationId: string): void;
|
|
12
|
+
onInviteStart?(invitationId: string): void;
|
|
13
|
+
};
|
|
14
|
+
export declare function DockNavigation({ activeEntryId, enableEntryIntroAnimation, entries, invitePortalContainer, invitePrompt, isInvitePromptOpen, onEntrySelect, onInviteClose, onInviteLater, onInviteStart }: DockNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConversationEntry, ConversationEntryPrompt } from '../registry/conversationRegistry';
|
|
2
|
+
export type MobileDockDrawerProps = {
|
|
3
|
+
activeEntryId: string;
|
|
4
|
+
entries: ConversationEntry[];
|
|
5
|
+
invitePrompt?: ConversationEntryPrompt | null;
|
|
6
|
+
isInvitePromptOpen?: boolean;
|
|
7
|
+
onEntrySelect(entryId: string): void;
|
|
8
|
+
onInviteClose?(invitationId: string): void;
|
|
9
|
+
onInviteLater?(invitationId: string): void;
|
|
10
|
+
onInviteStart?(invitationId: string): void;
|
|
11
|
+
onOpenChange(open: boolean): void;
|
|
12
|
+
};
|
|
13
|
+
export declare function MobileDockDrawer({ activeEntryId, entries, invitePrompt, isInvitePromptOpen, onEntrySelect, onInviteClose, onInviteLater, onInviteStart, onOpenChange }: MobileDockDrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ConversationEntry, ConversationEntryPrompt } from '../registry/conversationRegistry';
|
|
3
|
+
import { WidgetRoute } from '../router/routes';
|
|
4
|
+
export declare const INVITE_PROMPT_OPEN_DELAY_MS = 280;
|
|
5
|
+
export type PanelShellProps = {
|
|
6
|
+
activeEntryId: string;
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
entries: ConversationEntry[];
|
|
10
|
+
invitePrompt?: ConversationEntryPrompt | null;
|
|
11
|
+
interviewChat?: ReactNode;
|
|
12
|
+
isChatLoading?: boolean;
|
|
13
|
+
isExpanded: boolean;
|
|
14
|
+
isMobileDockOpen: boolean;
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
route: WidgetRoute;
|
|
17
|
+
routeTransitionKey?: number;
|
|
18
|
+
style: CSSProperties;
|
|
19
|
+
viewportMode: "desktop" | "mobile";
|
|
20
|
+
onEntrySelect(entryId: string): void;
|
|
21
|
+
onInviteClose?(invitationId: string): void;
|
|
22
|
+
onInviteLater?(invitationId: string): void;
|
|
23
|
+
onInviteStart?(invitationId: string): void;
|
|
24
|
+
onMobileDockOpenChange(open: boolean): void;
|
|
25
|
+
};
|
|
26
|
+
export declare function PanelShell({ activeEntryId, ariaLabel, children, entries, invitePrompt, interviewChat, isChatLoading, isExpanded, isMobileDockOpen, isOpen, route, routeTransitionKey, style, viewportMode, onEntrySelect, onInviteClose, onInviteLater, onInviteStart, onMobileDockOpenChange }: PanelShellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type RouteTransitionProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
scope: "chat" | "shell";
|
|
5
|
+
transitionKey: number | string;
|
|
6
|
+
};
|
|
7
|
+
export declare function RouteTransition({ children, scope, transitionKey }: RouteTransitionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InterviewInvitationChoice } from '../../runtime/interview/interviewTypes';
|
|
2
|
+
import { ConversationEntry, ConversationEntryPrompt } from '../registry/conversationRegistry';
|
|
3
|
+
export type AgentSessionState = {
|
|
4
|
+
handledInviteChoices: Record<string, InterviewInvitationChoice>;
|
|
5
|
+
entries: ConversationEntry[];
|
|
6
|
+
invitePrompt: ConversationEntryPrompt | null;
|
|
7
|
+
isMobileDockOpen: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function createInitialAgentSessionState(): AgentSessionState;
|
|
10
|
+
export declare function applyDiscoveredInterviewEntry(state: AgentSessionState, entry: ConversationEntry | null, viewportMode: "desktop" | "mobile", options?: {
|
|
11
|
+
canShowPrompt?: boolean;
|
|
12
|
+
}): AgentSessionState;
|
|
13
|
+
export declare function applyRestoredInterviewSessionEntry(state: AgentSessionState, entry: ConversationEntry | null): AgentSessionState;
|
|
14
|
+
export declare function markConversationEntrySeen(state: AgentSessionState, entryId: string): AgentSessionState;
|
|
15
|
+
export declare function dismissInterviewInvite(state: AgentSessionState, invitationId: string, mode: InterviewInvitationChoice): AgentSessionState;
|
|
16
|
+
export declare function replaceInviteWithInterviewSessionEntry(state: AgentSessionState, { invitationId, sessionId, subtitle, title }: {
|
|
17
|
+
invitationId: string;
|
|
18
|
+
sessionId: string;
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
title: string;
|
|
21
|
+
}): AgentSessionState;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ThreadMessageLike } from '@assistant-ui/react';
|
|
2
|
+
export type ConversationKind = "interview" | "support" | (string & {});
|
|
3
|
+
export declare const CONVERSATION_ENTRY_STATUS: Readonly<{
|
|
4
|
+
ACTIVE: "active";
|
|
5
|
+
AVAILABLE: "available";
|
|
6
|
+
COMPLETED: "completed";
|
|
7
|
+
ERROR: "error";
|
|
8
|
+
INVITABLE: "invitable";
|
|
9
|
+
LOCKED: "locked";
|
|
10
|
+
}>;
|
|
11
|
+
export type ConversationEntryStatus = (typeof CONVERSATION_ENTRY_STATUS)[keyof typeof CONVERSATION_ENTRY_STATUS];
|
|
12
|
+
export type ConversationEntryPrompt = {
|
|
13
|
+
anchor: "dock";
|
|
14
|
+
body?: string;
|
|
15
|
+
campaignId: string;
|
|
16
|
+
closeLabel: string;
|
|
17
|
+
invitationId: string;
|
|
18
|
+
kind: "interview-invite";
|
|
19
|
+
laterLabel: string;
|
|
20
|
+
startLabel: string;
|
|
21
|
+
};
|
|
22
|
+
export type ConversationEntry = {
|
|
23
|
+
id: string;
|
|
24
|
+
kind: ConversationKind;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
priority?: number;
|
|
27
|
+
prompt?: ConversationEntryPrompt;
|
|
28
|
+
status: ConversationEntryStatus;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
title: string;
|
|
31
|
+
unread?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type ConversationCapabilities = {
|
|
34
|
+
attachments?: boolean;
|
|
35
|
+
dismiss?: boolean;
|
|
36
|
+
emoji?: boolean;
|
|
37
|
+
transcriptDownload?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationState = {
|
|
40
|
+
capabilities: ConversationCapabilities;
|
|
41
|
+
entry: ConversationEntry;
|
|
42
|
+
error?: string;
|
|
43
|
+
isSending: boolean;
|
|
44
|
+
messages: ThreadMessageLike[];
|
|
45
|
+
};
|
|
46
|
+
export type SendInput = {
|
|
47
|
+
attachments?: Array<{
|
|
48
|
+
id: string;
|
|
49
|
+
}>;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
export type ConversationAdapter = {
|
|
53
|
+
close?(): Promise<void>;
|
|
54
|
+
load(): Promise<ConversationState>;
|
|
55
|
+
refresh?(): Promise<void>;
|
|
56
|
+
send(input: SendInput): Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
export type ConversationProvider = {
|
|
59
|
+
getAdapter(entryId: string): ConversationAdapter | null;
|
|
60
|
+
listEntries(): Promise<ConversationEntry[]>;
|
|
61
|
+
};
|
|
62
|
+
export type ConversationRegistry = ReturnType<typeof createConversationRegistry>;
|
|
63
|
+
export declare function createSupportConversationProvider({ adapter, entry }: {
|
|
64
|
+
adapter: ConversationAdapter;
|
|
65
|
+
entry: Partial<ConversationEntry> & {
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
68
|
+
}): ConversationProvider;
|
|
69
|
+
export declare function createConversationRegistry(providers: ConversationProvider[]): {
|
|
70
|
+
getAdapter(entryId: string): ConversationAdapter | null;
|
|
71
|
+
getEntries(): ConversationEntry[];
|
|
72
|
+
refreshEntries(): Promise<ConversationEntry[]>;
|
|
73
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WidgetRoute } from './routes';
|
|
2
|
+
export type WidgetRouterState = {
|
|
3
|
+
action: "back" | "push" | "replace" | "reset";
|
|
4
|
+
current: WidgetRoute;
|
|
5
|
+
previous?: WidgetRoute;
|
|
6
|
+
stack: WidgetRoute[];
|
|
7
|
+
transitionKey: number;
|
|
8
|
+
};
|
|
9
|
+
export type WidgetRouterAction = {
|
|
10
|
+
route: WidgetRoute;
|
|
11
|
+
type: "push";
|
|
12
|
+
} | {
|
|
13
|
+
route: WidgetRoute;
|
|
14
|
+
type: "replace";
|
|
15
|
+
} | {
|
|
16
|
+
fallback?: WidgetRoute;
|
|
17
|
+
type: "back";
|
|
18
|
+
} | {
|
|
19
|
+
route: WidgetRoute;
|
|
20
|
+
type: "reset";
|
|
21
|
+
};
|
|
22
|
+
export declare function getDefaultAgentsConversationsRoute(): WidgetRoute;
|
|
23
|
+
export declare function createInitialWidgetRouterState(): WidgetRouterState;
|
|
24
|
+
export declare function widgetRouterReducer(state: WidgetRouterState, action: WidgetRouterAction): WidgetRouterState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const WIDGET_ROUTE_NAMES: {
|
|
2
|
+
readonly AGENTS_CONVERSATIONS: "agents.conversations";
|
|
3
|
+
readonly GLOBAL_ERROR: "global.error";
|
|
4
|
+
readonly GLOBAL_LOADING: "global.loading";
|
|
5
|
+
};
|
|
6
|
+
export declare const WIDGET_ROUTE_CHILD_NAMES: {
|
|
7
|
+
readonly CHAT: "chat";
|
|
8
|
+
readonly INTERVIEW_STARTING: "interview.starting";
|
|
9
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WidgetOptions } from '../../types';
|
|
2
|
+
import { WidgetRoute } from './routes';
|
|
3
|
+
export declare function getWidgetRouteStorageKey(options: WidgetOptions): string;
|
|
4
|
+
export declare function isPersistableWidgetRoute(route: WidgetRoute): boolean;
|
|
5
|
+
export declare function readStoredWidgetRoute(options: WidgetOptions): WidgetRoute | null;
|
|
6
|
+
export declare function writeStoredWidgetRoute(options: WidgetOptions, route: WidgetRoute): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WIDGET_ROUTE_CHILD_NAMES, WIDGET_ROUTE_NAMES } from './routeNames';
|
|
2
|
+
export type AgentsConversationsRoute = {
|
|
3
|
+
entryId: string;
|
|
4
|
+
name: typeof WIDGET_ROUTE_CHILD_NAMES.CHAT;
|
|
5
|
+
} | {
|
|
6
|
+
entryId: string;
|
|
7
|
+
invitationId: string;
|
|
8
|
+
name: typeof WIDGET_ROUTE_CHILD_NAMES.INTERVIEW_STARTING;
|
|
9
|
+
};
|
|
10
|
+
export type WidgetRoute = {
|
|
11
|
+
name: typeof WIDGET_ROUTE_NAMES.GLOBAL_LOADING;
|
|
12
|
+
target?: AgentsConversationsWidgetRoute;
|
|
13
|
+
} | {
|
|
14
|
+
name: typeof WIDGET_ROUTE_NAMES.GLOBAL_ERROR;
|
|
15
|
+
retryTo?: WidgetRoute;
|
|
16
|
+
} | AgentsConversationsWidgetRoute;
|
|
17
|
+
export type AgentsConversationsWidgetRoute = {
|
|
18
|
+
child: AgentsConversationsRoute;
|
|
19
|
+
name: typeof WIDGET_ROUTE_NAMES.AGENTS_CONVERSATIONS;
|
|
20
|
+
};
|
|
21
|
+
export type InterviewSessionWidgetRoute = AgentsConversationsWidgetRoute & {
|
|
22
|
+
child: AgentsConversationsRoute & {
|
|
23
|
+
entryId: `interview/session/${string}`;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function isInterviewSessionEntryId(entryId: string): boolean;
|
|
27
|
+
export declare function createSupportSessionEntryId(conversationId: string): `support/session/${string}`;
|
|
28
|
+
export declare function isSupportSessionEntryId(entryId: string): boolean;
|
|
29
|
+
export declare function isSupportEntryId(entryId: string): boolean;
|
|
30
|
+
export declare function getSupportConversationIdFromEntryId(entryId: string): string | null;
|
|
31
|
+
export declare function isInterviewSessionRoute(route: WidgetRoute | null | undefined): route is InterviewSessionWidgetRoute;
|
|
32
|
+
export declare function createChatRoute(entryId: string): AgentsConversationsWidgetRoute;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CustomerAgentEventBus } from '../../../sdk/events';
|
|
2
|
+
import { ResolvedWidgetLocale } from '../../../sdk/i18n';
|
|
3
|
+
import { InterviewSessionController } from './interviewSessionController';
|
|
4
|
+
export declare function InterviewChatScreen({ controller, eventBus, locale, description, isExpanded, isOpen, onDownloadTranscript, onOpenMobileDock, onToggleExpanded, title, transcriptAppName, visitorName, viewportMode }: {
|
|
5
|
+
controller: InterviewSessionController;
|
|
6
|
+
description?: string;
|
|
7
|
+
eventBus?: CustomerAgentEventBus;
|
|
8
|
+
isExpanded?: boolean;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
locale: ResolvedWidgetLocale;
|
|
11
|
+
onDownloadTranscript?(): void;
|
|
12
|
+
onOpenMobileDock?(): void;
|
|
13
|
+
onToggleExpanded?(): void;
|
|
14
|
+
title: string;
|
|
15
|
+
transcriptAppName?: string;
|
|
16
|
+
visitorName?: string;
|
|
17
|
+
viewportMode?: "desktop" | "mobile";
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ConversationEntryPrompt } from '../../registry/conversationRegistry';
|
|
3
|
+
export type InterviewInvitePromptProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
portalContainer?: HTMLElement | null;
|
|
7
|
+
prompt: ConversationEntryPrompt;
|
|
8
|
+
title: string;
|
|
9
|
+
onClose(invitationId: string): void;
|
|
10
|
+
onLater(invitationId: string): void;
|
|
11
|
+
onStart(invitationId: string): void;
|
|
12
|
+
};
|
|
13
|
+
export declare function InterviewInvitePrompt({ children, isOpen, portalContainer, prompt, title, onClose, onLater, onStart }: InterviewInvitePromptProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WidgetOptions } from '../../../types';
|
|
2
|
+
export type CachedInterviewSession = {
|
|
3
|
+
entryId: string;
|
|
4
|
+
priority: number;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function readCachedInterviewSession(options: WidgetOptions): CachedInterviewSession | null;
|
|
9
|
+
export declare function writeCachedInterviewSession(options: WidgetOptions, session: CachedInterviewSession): void;
|
|
10
|
+
export declare function clearCachedInterviewSession(options: WidgetOptions): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ThreadMessageLike } from '@assistant-ui/react';
|
|
2
|
+
import { CUSTOMER_AGENT_INTERVIEW_STATUS, InterviewInvitationChoice, InterviewSessionResponse, InterviewStatus } from '../../../runtime/interview/interviewTypes';
|
|
3
|
+
import { ConversationContextPayload } from '../../../sdk/conversation';
|
|
4
|
+
import { WidgetOptions } from '../../../types';
|
|
5
|
+
import { ConversationEntry } from '../../registry/conversationRegistry';
|
|
6
|
+
type InvitationCard = {
|
|
7
|
+
body: string;
|
|
8
|
+
laterCta: string;
|
|
9
|
+
startCta: string;
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
type EligibilityResponse = {
|
|
13
|
+
eligible: false;
|
|
14
|
+
status?: string;
|
|
15
|
+
} | {
|
|
16
|
+
campaignId: string;
|
|
17
|
+
eligible: true;
|
|
18
|
+
invitation: InvitationCard;
|
|
19
|
+
showRequestId: string;
|
|
20
|
+
status?: typeof CUSTOMER_AGENT_INTERVIEW_STATUS.AVAILABLE | string;
|
|
21
|
+
variantKey?: string | null;
|
|
22
|
+
};
|
|
23
|
+
export type InterviewClient = {
|
|
24
|
+
checkEligibility(payload: Record<string, unknown>): Promise<EligibilityResponse>;
|
|
25
|
+
chooseInvitation(id: string, payload: {
|
|
26
|
+
choice: InterviewInvitationChoice;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
createInvitation(payload: Record<string, unknown>): Promise<{
|
|
29
|
+
invitationId: string;
|
|
30
|
+
}>;
|
|
31
|
+
getReward(sessionId: string): Promise<unknown>;
|
|
32
|
+
getSession(sessionId: string): Promise<InterviewSessionResponse>;
|
|
33
|
+
sendMessage(sessionId: string, payload: {
|
|
34
|
+
clientMessageId: string;
|
|
35
|
+
content: string;
|
|
36
|
+
locale?: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
assistantMessage: string;
|
|
39
|
+
completion?: {
|
|
40
|
+
reason: string;
|
|
41
|
+
};
|
|
42
|
+
duplicate?: true;
|
|
43
|
+
sessionStatus: InterviewStatus;
|
|
44
|
+
}>;
|
|
45
|
+
startInvitation(id: string, payload: ConversationContextPayload): Promise<InterviewSessionResponse>;
|
|
46
|
+
};
|
|
47
|
+
export declare const INTERVIEW_SESSION_PHASE: Readonly<{
|
|
48
|
+
ACTIVE: "active";
|
|
49
|
+
ERROR: "error";
|
|
50
|
+
IDLE: "idle";
|
|
51
|
+
LOADING: "loading";
|
|
52
|
+
SENDING: "sending";
|
|
53
|
+
TERMINAL: "terminal";
|
|
54
|
+
}>;
|
|
55
|
+
export type InterviewSessionPhase = (typeof INTERVIEW_SESSION_PHASE)[keyof typeof INTERVIEW_SESSION_PHASE];
|
|
56
|
+
export type InterviewSessionState = {
|
|
57
|
+
completion?: {
|
|
58
|
+
reason: string;
|
|
59
|
+
};
|
|
60
|
+
messages: ThreadMessageLike[];
|
|
61
|
+
phase: InterviewSessionPhase;
|
|
62
|
+
reward?: InterviewSessionReward | null;
|
|
63
|
+
sessionId?: string;
|
|
64
|
+
status?: InterviewStatus;
|
|
65
|
+
};
|
|
66
|
+
export type InterviewSessionController = ReturnType<typeof createInterviewSessionController>;
|
|
67
|
+
export type InterviewSessionReward = {
|
|
68
|
+
amount?: unknown;
|
|
69
|
+
currency?: unknown;
|
|
70
|
+
status?: unknown;
|
|
71
|
+
};
|
|
72
|
+
export declare function createInterviewSessionController({ client, options }: {
|
|
73
|
+
client: InterviewClient;
|
|
74
|
+
options: WidgetOptions;
|
|
75
|
+
}): {
|
|
76
|
+
chooseInvitation(invitationId: string, choice: InterviewInvitationChoice): Promise<void>;
|
|
77
|
+
discoverInvitation(): Promise<ConversationEntry | null>;
|
|
78
|
+
getState(): InterviewSessionState;
|
|
79
|
+
hydrateSession(session: InterviewSessionResponse): void;
|
|
80
|
+
loadReward(sessionId: string): Promise<InterviewSessionReward | null>;
|
|
81
|
+
sendMessage(content: string): Promise<void>;
|
|
82
|
+
startInvitation(invitationId: string): Promise<{
|
|
83
|
+
entryId: string;
|
|
84
|
+
sessionId: string;
|
|
85
|
+
}>;
|
|
86
|
+
restoreCachedSession(): Promise<ConversationEntry | null>;
|
|
87
|
+
subscribe(listener: (state: InterviewSessionState) => void): () => void;
|
|
88
|
+
};
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CustomerAgentInterviewState } from '../../../sdk/public-types';
|
|
2
|
+
import { ConversationEntry } from '../../registry/conversationRegistry';
|
|
3
|
+
export declare function createInterviewEntryFromRuntimeState(interview: CustomerAgentInterviewState): ConversationEntry | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WidgetOptions } from '../types';
|
|
2
|
+
export type TranscriptMessage = {
|
|
3
|
+
createdAt: Date;
|
|
4
|
+
role: "assistant" | "user";
|
|
5
|
+
speaker?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function getTranscriptVisitorName(options?: Partial<WidgetOptions> | null): string;
|
|
9
|
+
export declare function buildIntercomStyleTranscript({ conversationName, exportedAt, exportSourceName, locale, messages, startedAt, userSpeaker }: {
|
|
10
|
+
conversationName: string;
|
|
11
|
+
exportedAt: Date;
|
|
12
|
+
exportSourceName?: string;
|
|
13
|
+
locale: string;
|
|
14
|
+
messages: readonly TranscriptMessage[];
|
|
15
|
+
startedAt?: Date;
|
|
16
|
+
userSpeaker?: string;
|
|
17
|
+
}): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ThreadComposerRuntime } from '@assistant-ui/react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
export declare function resolveEmojiPickerDataSourceUrl({ bundledDataSourceUrl, isDev, moduleUrl, pageUrl, sdkFormat }: {
|
|
4
|
+
bundledDataSourceUrl?: string;
|
|
5
|
+
isDev: boolean;
|
|
6
|
+
moduleUrl: string | undefined;
|
|
7
|
+
pageUrl: string;
|
|
8
|
+
sdkFormat: string | undefined;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function useWidgetEmojiPicker({ composerRuntime, inputRef, shouldSuppressComposerFocus }: {
|
|
11
|
+
composerRuntime: ThreadComposerRuntime;
|
|
12
|
+
inputRef: RefObject<HTMLTextAreaElement | null>;
|
|
13
|
+
shouldSuppressComposerFocus?: boolean;
|
|
14
|
+
}): {
|
|
15
|
+
closeEmojiPicker(): void;
|
|
16
|
+
emojiPickerHostRef: import('react').Dispatch<import('react').SetStateAction<HTMLDivElement | null>>;
|
|
17
|
+
isEmojiPickerLoading: boolean;
|
|
18
|
+
isEmojiPickerOpen: boolean;
|
|
19
|
+
onEmojiOpenChange(nextIsOpen: boolean): void;
|
|
20
|
+
};
|