@opencx/widget 3.0.99 → 4.0.17
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 +3 -73
- package/dist-embed/script.js +151 -194
- package/dist-embed/script.js.map +1 -1
- package/package.json +11 -173
- package/dist/designs.cjs +0 -79
- package/dist/designs.cjs.map +0 -1
- package/dist/designs.d.ts +0 -2
- package/dist/designs.js +0 -17770
- package/dist/designs.js.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/is-exhaustive-9o43S91P.cjs +0 -2
- package/dist/is-exhaustive-9o43S91P.cjs.map +0 -1
- package/dist/is-exhaustive-DGJzQK69.js +0 -7
- package/dist/is-exhaustive-DGJzQK69.js.map +0 -1
- package/dist/react.cjs +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.d.ts +0 -2
- package/dist/react.js +0 -34
- package/dist/react.js.map +0 -1
- package/dist/src/designs/react/WidgetPopoverAnchor.d.ts +0 -2
- package/dist/src/designs/react/WidgetPopoverContent.d.ts +0 -3
- package/dist/src/designs/react/WidgetPopoverTrigger.d.ts +0 -3
- package/dist/src/designs/react/components/AgentOrBotAvatar.d.ts +0 -6
- package/dist/src/designs/react/components/AttachmentPreview.d.ts +0 -7
- package/dist/src/designs/react/components/BotOrAgentMessage.d.ts +0 -7
- package/dist/src/designs/react/components/BotOrAgentMessageGroup.d.ts +0 -7
- package/dist/src/designs/react/components/Header.d.ts +0 -3
- package/dist/src/designs/react/components/MightSolveUserIssueSuggestedReplies.d.ts +0 -2
- package/dist/src/designs/react/components/PoweredByOpen.d.ts +0 -4
- package/dist/src/designs/react/components/SuggestedReplyButton.d.ts +0 -5
- package/dist/src/designs/react/components/UserMessage.d.ts +0 -8
- package/dist/src/designs/react/components/UserMessageGroup.d.ts +0 -5
- package/dist/src/designs/react/components/VoteButtons.d.ts +0 -8
- package/dist/src/designs/react/components/custom-components/BotOrAgentTextResponse.component.d.ts +0 -16
- package/dist/src/designs/react/components/custom-components/Fallback.component.d.ts +0 -6
- package/dist/src/designs/react/components/custom-components/Handoff.component.d.ts +0 -3
- package/dist/src/designs/react/components/custom-components/Loading.component.d.ts +0 -6
- package/dist/src/designs/react/components/lib/DynamicIcon.d.ts +0 -6
- package/dist/src/designs/react/components/lib/LoadingSpinner.d.ts +0 -4
- package/dist/src/designs/react/components/lib/MotionDiv.d.ts +0 -19
- package/dist/src/designs/react/components/lib/avatar.d.ts +0 -6
- package/dist/src/designs/react/components/lib/button.d.ts +0 -11
- package/dist/src/designs/react/components/lib/dialog.d.ts +0 -24
- package/dist/src/designs/react/components/lib/dropdown-menu.d.ts +0 -27
- package/dist/src/designs/react/components/lib/input.d.ts +0 -4
- package/dist/src/designs/react/components/lib/popover.d.ts +0 -8
- package/dist/src/designs/react/components/lib/skeleton.d.ts +0 -3
- package/dist/src/designs/react/components/lib/switch.d.ts +0 -4
- package/dist/src/designs/react/components/lib/tooltip.d.ts +0 -10
- package/dist/src/designs/react/components/lib/utils/cn.d.ts +0 -2
- package/dist/src/designs/react/components/lib/widget-portal.d.ts +0 -9
- package/dist/src/designs/react/components/lib/wobble.d.ts +0 -26
- package/dist/src/designs/react/components/markdown.d.ts +0 -3
- package/dist/src/designs/react/components/svg/ChatBubbleSvg.d.ts +0 -5
- package/dist/src/designs/react/components/svg/OpenLogoSvg.d.ts +0 -4
- package/dist/src/designs/react/hooks/useCanvas.d.ts +0 -3
- package/dist/src/designs/react/hooks/useIsSmallScreen.d.ts +0 -3
- package/dist/src/designs/react/hooks/useLocale.d.ts +0 -6
- package/dist/src/designs/react/hooks/useSetWidgetSize.d.ts +0 -8
- package/dist/src/designs/react/hooks/useTheme.d.ts +0 -62
- package/dist/src/designs/react/hooks/useWidgetContentHeight.d.ts +0 -3
- package/dist/src/designs/react/index.d.ts +0 -9
- package/dist/src/designs/react/screens/chat/ChatCanvas.d.ts +0 -2
- package/dist/src/designs/react/screens/chat/ChatFooter.d.ts +0 -2
- package/dist/src/designs/react/screens/chat/ChatMain.d.ts +0 -2
- package/dist/src/designs/react/screens/chat/index.d.ts +0 -2
- package/dist/src/designs/react/screens/index.d.ts +0 -2
- package/dist/src/designs/react/screens/sessions/index.d.ts +0 -2
- package/dist/src/designs/react/screens/welcome/index.d.ts +0 -2
- package/dist/src/designs/react/utils/data-component.d.ts +0 -7
- package/dist/src/designs/react/utils/group-messages-by-type.d.ts +0 -5
- package/dist/src/designs/translation/ar.locale.d.ts +0 -2
- package/dist/src/designs/translation/de.locale.d.ts +0 -2
- package/dist/src/designs/translation/en.locale.d.ts +0 -2
- package/dist/src/designs/translation/es.locale.d.ts +0 -2
- package/dist/src/designs/translation/fr.locale.d.ts +0 -2
- package/dist/src/designs/translation/index.d.ts +0 -16
- package/dist/src/designs/translation/nl.locale.d.ts +0 -2
- package/dist/src/designs/translation/pt.locale.d.ts +0 -2
- package/dist/src/designs/translation/tr.locale.d.ts +0 -2
- package/dist/src/designs/translation/translation.types.d.ts +0 -4
- package/dist/src/embedded/index.d.ts +0 -11
- package/dist/src/headless/core/__tests__/api-caller.mock.d.ts +0 -1
- package/dist/src/headless/core/__tests__/context/contact/auth/auto-create-unverified-anonymous.spec.d.ts +0 -0
- package/dist/src/headless/core/__tests__/context/contact/auth/auto-create-unverified-with-user-data-provided-by-org.spec.d.ts +0 -0
- package/dist/src/headless/core/__tests__/context/contact/auth/manually-create-unverified-with-user-data-provided-by-user.spec.d.ts +0 -0
- package/dist/src/headless/core/__tests__/context/contact/auth/with-secure-token.spec.d.ts +0 -0
- package/dist/src/headless/core/__tests__/context/contact/should-collect-data.spec.d.ts +0 -0
- package/dist/src/headless/core/__tests__/test-utils.d.ts +0 -419
- package/dist/src/headless/core/__tests__/utils/Poller.spec.d.ts +0 -1
- package/dist/src/headless/core/__tests__/utils/PrimitiveState.spec.d.ts +0 -1
- package/dist/src/headless/core/__tests__/utils/uuid.spec.d.ts +0 -1
- package/dist/src/headless/core/api/api-caller.d.ts +0 -437
- package/dist/src/headless/core/api/client.d.ts +0 -12
- package/dist/src/headless/core/api/schema.d.ts +0 -928
- package/dist/src/headless/core/context/active-session-polling.ctx.d.ts +0 -25
- package/dist/src/headless/core/context/contact.ctx.d.ts +0 -30
- package/dist/src/headless/core/context/message.ctx.d.ts +0 -38
- package/dist/src/headless/core/context/router.ctx.d.ts +0 -33
- package/dist/src/headless/core/context/session.ctx.d.ts +0 -119
- package/dist/src/headless/core/context/storage.ctx.d.ts +0 -15
- package/dist/src/headless/core/context/widget.ctx.d.ts +0 -27
- package/dist/src/headless/core/index.d.ts +0 -15
- package/dist/src/headless/core/types/agent-or-bot.d.ts +0 -6
- package/dist/src/headless/core/types/component-name.d.ts +0 -1
- package/dist/src/headless/core/types/dtos.d.ts +0 -12
- package/dist/src/headless/core/types/external-storage.d.ts +0 -5
- package/dist/src/headless/core/types/helpers.d.ts +0 -2
- package/dist/src/headless/core/types/icons.d.ts +0 -3
- package/dist/src/headless/core/types/json-value.d.ts +0 -7
- package/dist/src/headless/core/types/messages.d.ts +0 -55
- package/dist/src/headless/core/types/widget-config.d.ts +0 -400
- package/dist/src/headless/core/utils/Poller.d.ts +0 -12
- package/dist/src/headless/core/utils/PrimitiveState.d.ts +0 -13
- package/dist/src/headless/core/utils/is-exhaustive.d.ts +0 -1
- package/dist/src/headless/core/utils/run-catching.d.ts +0 -13
- package/dist/src/headless/core/utils/uuid.d.ts +0 -1
- package/dist/src/headless/react/ComponentRegistry.d.ts +0 -10
- package/dist/src/headless/react/WidgetProvider.d.ts +0 -25
- package/dist/src/headless/react/hooks/useConfig.d.ts +0 -1
- package/dist/src/headless/react/hooks/useContact.d.ts +0 -12
- package/dist/src/headless/react/hooks/useDocumentDir.d.ts +0 -3
- package/dist/src/headless/react/hooks/useIsAwaitingBotReply.d.ts +0 -3
- package/dist/src/headless/react/hooks/useMessages.d.ts +0 -14
- package/dist/src/headless/react/hooks/useModes.d.ts +0 -15
- package/dist/src/headless/react/hooks/usePreludeData.d.ts +0 -38
- package/dist/src/headless/react/hooks/usePrimitiveState.d.ts +0 -2
- package/dist/src/headless/react/hooks/useSessions.d.ts +0 -104
- package/dist/src/headless/react/hooks/useUploadFiles.d.ts +0 -21
- package/dist/src/headless/react/hooks/useVote.d.ts +0 -18
- package/dist/src/headless/react/hooks/useWidgetRouter.d.ts +0 -7
- package/dist/src/headless/react/hooks/useWidgetTrigger.d.ts +0 -10
- package/dist/src/headless/react/index.d.ts +0 -14
- package/dist/src/headless/react/types/components.d.ts +0 -7
- package/dist/useModes-CtIywY2i.cjs +0 -2
- package/dist/useModes-CtIywY2i.cjs.map +0 -1
- package/dist/useModes-GTENcGQD.js +0 -259
- package/dist/useModes-GTENcGQD.js.map +0 -1
- package/dist/widget.ctx-B-jCTG4Y.js +0 -698
- package/dist/widget.ctx-B-jCTG4Y.js.map +0 -1
- package/dist/widget.ctx-XvIjOOOZ.cjs +0 -5
- package/dist/widget.ctx-XvIjOOOZ.cjs.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ApiCaller } from '../api/api-caller';
|
|
2
|
-
import { MessageType } from '../types/messages';
|
|
3
|
-
import { ActionCallDto, MessageDto } from '../types/dtos';
|
|
4
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
5
|
-
import { MessageCtx } from './message.ctx';
|
|
6
|
-
import { SessionCtx } from './session.ctx';
|
|
7
|
-
export declare class ActiveSessionPollingCtx {
|
|
8
|
-
private api;
|
|
9
|
-
private config;
|
|
10
|
-
private sessionCtx;
|
|
11
|
-
private messageCtx;
|
|
12
|
-
private sessionPollingIntervalSeconds;
|
|
13
|
-
private poller;
|
|
14
|
-
constructor({ api, config, sessionCtx, messageCtx, sessionPollingIntervalSeconds, }: {
|
|
15
|
-
api: ApiCaller;
|
|
16
|
-
config: WidgetConfig;
|
|
17
|
-
sessionCtx: SessionCtx;
|
|
18
|
-
messageCtx: MessageCtx;
|
|
19
|
-
sessionPollingIntervalSeconds: number;
|
|
20
|
-
});
|
|
21
|
-
private registerPolling;
|
|
22
|
-
private hackAndSlash;
|
|
23
|
-
mapHistoryToMessage: (history: MessageDto) => MessageType;
|
|
24
|
-
extractActionResult: (action: ActionCallDto) => any;
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PrimitiveState } from '../utils/PrimitiveState';
|
|
2
|
-
import { ApiCaller } from '../api/api-caller';
|
|
3
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
4
|
-
import { Dto } from '../api/client';
|
|
5
|
-
import { StorageCtx } from './storage.ctx';
|
|
6
|
-
type ContactState = {
|
|
7
|
-
contact: {
|
|
8
|
-
token: string;
|
|
9
|
-
externalId: string | undefined;
|
|
10
|
-
} | null;
|
|
11
|
-
extraCollectedData: Record<string, string> | undefined;
|
|
12
|
-
isCreatingUnverifiedContact: boolean;
|
|
13
|
-
isErrorCreatingUnverifiedContact: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare class ContactCtx {
|
|
16
|
-
private config;
|
|
17
|
-
private storageCtx?;
|
|
18
|
-
private api;
|
|
19
|
-
state: PrimitiveState<ContactState>;
|
|
20
|
-
constructor({ config, api, storageCtx, }: {
|
|
21
|
-
api: ApiCaller;
|
|
22
|
-
config: WidgetConfig;
|
|
23
|
-
storageCtx?: StorageCtx;
|
|
24
|
-
});
|
|
25
|
-
shouldCollectData: () => boolean;
|
|
26
|
-
private autoCreateUnverifiedUserIfNotExists;
|
|
27
|
-
createUnverifiedContact: (payload: Dto["CreateUnverifiedContactDto"], extraCollectedData?: Record<string, string>) => Promise<void>;
|
|
28
|
-
setUnverifiedContact: (token: string) => Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ApiCaller } from '../api/api-caller';
|
|
2
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
3
|
-
import { MessageType } from '../types/messages';
|
|
4
|
-
import { SendMessageDto } from '../types/dtos';
|
|
5
|
-
import { PrimitiveState } from '../utils/PrimitiveState';
|
|
6
|
-
import { SessionCtx } from './session.ctx';
|
|
7
|
-
import { ContactCtx } from './contact.ctx';
|
|
8
|
-
type MessageCtxState = {
|
|
9
|
-
messages: MessageType[];
|
|
10
|
-
isSendingMessage: boolean;
|
|
11
|
-
lastAIResMightSolveUserIssue: boolean;
|
|
12
|
-
isInitialFetchLoading: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare class MessageCtx {
|
|
15
|
-
private config;
|
|
16
|
-
private api;
|
|
17
|
-
private contactCtx;
|
|
18
|
-
private sessionCtx;
|
|
19
|
-
state: PrimitiveState<MessageCtxState>;
|
|
20
|
-
private sendMessageAbortController;
|
|
21
|
-
constructor({ config, api, sessionCtx, contactCtx, }: {
|
|
22
|
-
config: WidgetConfig;
|
|
23
|
-
api: ApiCaller;
|
|
24
|
-
sessionCtx: SessionCtx;
|
|
25
|
-
contactCtx: ContactCtx;
|
|
26
|
-
});
|
|
27
|
-
reset: () => void;
|
|
28
|
-
sendMessage: (input: {
|
|
29
|
-
content: SendMessageDto["content"];
|
|
30
|
-
attachments?: SendMessageDto["attachments"];
|
|
31
|
-
customData?: SendMessageDto["custom_data"];
|
|
32
|
-
exitModePrompt?: string;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
private toUserMessage;
|
|
35
|
-
private toBotMessage;
|
|
36
|
-
private toBotErrorMessage;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
2
|
-
import { PrimitiveState } from '../utils/PrimitiveState';
|
|
3
|
-
import { ContactCtx } from './contact.ctx';
|
|
4
|
-
import { SessionCtx } from './session.ctx';
|
|
5
|
-
import { WidgetCtx } from './widget.ctx';
|
|
6
|
-
export type ScreenU = /** A welcome screen to collect user data. Useful in public non-logged-in environments */ 'welcome'
|
|
7
|
-
/** Show a list of the user's previous sessions */
|
|
8
|
-
| 'sessions'
|
|
9
|
-
/** Self-explanatory */
|
|
10
|
-
| 'chat';
|
|
11
|
-
type RouterState = {
|
|
12
|
-
screen: ScreenU;
|
|
13
|
-
};
|
|
14
|
-
export declare class RouterCtx {
|
|
15
|
-
state: PrimitiveState<RouterState>;
|
|
16
|
-
private config;
|
|
17
|
-
private contactCtx;
|
|
18
|
-
private sessionCtx;
|
|
19
|
-
private resetChat;
|
|
20
|
-
constructor({ config, contactCtx, sessionCtx, resetChat, }: {
|
|
21
|
-
config: WidgetConfig;
|
|
22
|
-
contactCtx: ContactCtx;
|
|
23
|
-
sessionCtx: SessionCtx;
|
|
24
|
-
resetChat: WidgetCtx['resetChat'];
|
|
25
|
-
});
|
|
26
|
-
private registerRoutingListener;
|
|
27
|
-
toSessionsScreen: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* @param sessionId The ID of the session to open, or `undefined` if it is a new chat session
|
|
30
|
-
*/
|
|
31
|
-
toChatScreen: (sessionId?: string) => void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ApiCaller } from '../api/api-caller';
|
|
2
|
-
import { Dto } from '../api/client';
|
|
3
|
-
import { SessionDto } from '../types/dtos';
|
|
4
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
5
|
-
import { PrimitiveState } from '../utils/PrimitiveState';
|
|
6
|
-
import { ContactCtx } from './contact.ctx';
|
|
7
|
-
type SessionState = {
|
|
8
|
-
/**
|
|
9
|
-
* The currently selected session.
|
|
10
|
-
* Can be null if no session is selected, or if in chat screen and the session is not created yet.
|
|
11
|
-
*/
|
|
12
|
-
session: SessionDto | null;
|
|
13
|
-
isCreatingSession: boolean;
|
|
14
|
-
isResolvingSession: boolean;
|
|
15
|
-
};
|
|
16
|
-
type SessionsState = {
|
|
17
|
-
/** List of all user sessions */
|
|
18
|
-
data: SessionDto[];
|
|
19
|
-
/** A cursor to get the next page of sessions */
|
|
20
|
-
cursor: string | undefined;
|
|
21
|
-
/** Indicates if no more pages are left */
|
|
22
|
-
isLastPage: boolean;
|
|
23
|
-
/** Did fetch for the first time */
|
|
24
|
-
didStartInitialFetch: boolean;
|
|
25
|
-
isInitialFetchLoading: boolean;
|
|
26
|
-
};
|
|
27
|
-
export declare class SessionCtx {
|
|
28
|
-
private config;
|
|
29
|
-
private api;
|
|
30
|
-
private contactCtx;
|
|
31
|
-
private sessionsPollingIntervalSeconds;
|
|
32
|
-
private sessionsRefresher;
|
|
33
|
-
sessionState: PrimitiveState<SessionState>;
|
|
34
|
-
sessionsState: PrimitiveState<SessionsState>;
|
|
35
|
-
constructor({ config, api, contactCtx, sessionsPollingIntervalSeconds, }: {
|
|
36
|
-
config: WidgetConfig;
|
|
37
|
-
api: ApiCaller;
|
|
38
|
-
contactCtx: ContactCtx;
|
|
39
|
-
sessionsPollingIntervalSeconds: number;
|
|
40
|
-
});
|
|
41
|
-
/** Clears the session and stops polling */
|
|
42
|
-
reset: () => Promise<void>;
|
|
43
|
-
private registerSessionsRefresherWrapper;
|
|
44
|
-
private registerSessionsRefresher;
|
|
45
|
-
createSession: () => Promise<{
|
|
46
|
-
id: string;
|
|
47
|
-
createdAt: string;
|
|
48
|
-
updatedAt: string;
|
|
49
|
-
isHandedOff: boolean;
|
|
50
|
-
isOpened: boolean;
|
|
51
|
-
assignee: {
|
|
52
|
-
kind: "human" | "ai" | "none" | "unknown";
|
|
53
|
-
name: string | null;
|
|
54
|
-
avatarUrl: string | null;
|
|
55
|
-
};
|
|
56
|
-
channel: string;
|
|
57
|
-
isVerified: boolean;
|
|
58
|
-
lastMessage: string | null;
|
|
59
|
-
modeId: string | null;
|
|
60
|
-
latestStateCheckpointPayload: {
|
|
61
|
-
[key: string]: unknown;
|
|
62
|
-
} | null;
|
|
63
|
-
} | null>;
|
|
64
|
-
loadMoreSessions: () => Promise<void>;
|
|
65
|
-
private getSessions;
|
|
66
|
-
setSessions: (data: SessionDto[]) => void;
|
|
67
|
-
refreshSessions: () => Promise<void>;
|
|
68
|
-
resolveSession: () => Promise<{
|
|
69
|
-
readonly success: false;
|
|
70
|
-
readonly error: "Session is not opened";
|
|
71
|
-
readonly data?: undefined;
|
|
72
|
-
} | {
|
|
73
|
-
readonly success: true;
|
|
74
|
-
readonly data: {
|
|
75
|
-
id: string;
|
|
76
|
-
createdAt: string;
|
|
77
|
-
updatedAt: string;
|
|
78
|
-
isHandedOff: boolean;
|
|
79
|
-
isOpened: boolean;
|
|
80
|
-
assignee: {
|
|
81
|
-
kind: "human" | "ai" | "none" | "unknown";
|
|
82
|
-
name: string | null;
|
|
83
|
-
avatarUrl: string | null;
|
|
84
|
-
};
|
|
85
|
-
channel: string;
|
|
86
|
-
isVerified: boolean;
|
|
87
|
-
lastMessage: string | null;
|
|
88
|
-
modeId: string | null;
|
|
89
|
-
latestStateCheckpointPayload: {
|
|
90
|
-
[key: string]: unknown;
|
|
91
|
-
} | null;
|
|
92
|
-
};
|
|
93
|
-
readonly error?: undefined;
|
|
94
|
-
} | {
|
|
95
|
-
readonly success: false;
|
|
96
|
-
readonly error: {
|
|
97
|
-
statusCode?: number;
|
|
98
|
-
message?: string;
|
|
99
|
-
error?: string;
|
|
100
|
-
};
|
|
101
|
-
readonly data?: undefined;
|
|
102
|
-
}>;
|
|
103
|
-
createStateCheckpoint: (payload: Dto["WidgetCreateStateCheckpointInputDto"]["payload"]) => Promise<{
|
|
104
|
-
readonly data: {
|
|
105
|
-
success: boolean;
|
|
106
|
-
};
|
|
107
|
-
readonly success?: undefined;
|
|
108
|
-
readonly error?: undefined;
|
|
109
|
-
} | {
|
|
110
|
-
readonly success: false;
|
|
111
|
-
readonly error: {
|
|
112
|
-
statusCode?: number;
|
|
113
|
-
message?: string;
|
|
114
|
-
error?: string;
|
|
115
|
-
};
|
|
116
|
-
readonly data?: undefined;
|
|
117
|
-
} | undefined>;
|
|
118
|
-
}
|
|
119
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ExternalStorage } from '../types/external-storage';
|
|
2
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
3
|
-
export declare class StorageCtx {
|
|
4
|
-
private storage;
|
|
5
|
-
private config;
|
|
6
|
-
private KEYS;
|
|
7
|
-
constructor({ storage, config, }: {
|
|
8
|
-
storage: ExternalStorage;
|
|
9
|
-
config: WidgetConfig;
|
|
10
|
-
});
|
|
11
|
-
setContactToken: (token: string) => Promise<void>;
|
|
12
|
-
getContactToken: () => Promise<string | null>;
|
|
13
|
-
setExternalContactId: (id: string) => Promise<void>;
|
|
14
|
-
getExternalContactId: () => Promise<string | null>;
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ApiCaller } from '../api/api-caller';
|
|
2
|
-
import { ModeDto } from '../types/dtos';
|
|
3
|
-
import { ExternalStorage } from '../types/external-storage';
|
|
4
|
-
import { WidgetConfig } from '../types/widget-config';
|
|
5
|
-
import { ContactCtx } from './contact.ctx';
|
|
6
|
-
import { MessageCtx } from './message.ctx';
|
|
7
|
-
import { RouterCtx } from './router.ctx';
|
|
8
|
-
import { SessionCtx } from './session.ctx';
|
|
9
|
-
import { StorageCtx } from './storage.ctx';
|
|
10
|
-
export declare class WidgetCtx {
|
|
11
|
-
config: WidgetConfig;
|
|
12
|
-
api: ApiCaller;
|
|
13
|
-
contactCtx: ContactCtx;
|
|
14
|
-
sessionCtx: SessionCtx;
|
|
15
|
-
messageCtx: MessageCtx;
|
|
16
|
-
routerCtx: RouterCtx;
|
|
17
|
-
storageCtx?: StorageCtx;
|
|
18
|
-
modes: ModeDto[];
|
|
19
|
-
private static pollingIntervalsSeconds;
|
|
20
|
-
private activeSessionPollingCtx;
|
|
21
|
-
private constructor();
|
|
22
|
-
static initialize: ({ config, storage, }: {
|
|
23
|
-
config: WidgetConfig;
|
|
24
|
-
storage?: ExternalStorage;
|
|
25
|
-
}) => Promise<WidgetCtx>;
|
|
26
|
-
resetChat: () => void;
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type { AgentOrBotType } from './types/agent-or-bot';
|
|
2
|
-
export type { SafeExtract, StringOrLiteral } from './types/helpers';
|
|
3
|
-
export type { LiteralWidgetComponentKey, WidgetComponentKey, UserMessageType, AgentMessageType, BotMessageType, MessageType, } from './types/messages';
|
|
4
|
-
export type { MessageAttachmentType, MessageDto, PreludeDto, SendMessageDto, SendMessageOutputDto, ResolveSessionDto, SessionDto, VoteInputDto, VoteOutputDto, ActionCallDto, ModeDto, } from './types/dtos';
|
|
5
|
-
export type { WidgetConfig, HeaderButtonU, ModeComponent, ModeComponentProps, } from './types/widget-config';
|
|
6
|
-
export type { ExternalStorage } from './types/external-storage';
|
|
7
|
-
export type { OpenCxComponentNameU } from './types/component-name';
|
|
8
|
-
export type { IconNameU } from './types/icons';
|
|
9
|
-
export { WidgetCtx } from './context/widget.ctx';
|
|
10
|
-
export type { ContactCtx } from './context/contact.ctx';
|
|
11
|
-
export type { SessionCtx } from './context/session.ctx';
|
|
12
|
-
export type { MessageCtx } from './context/message.ctx';
|
|
13
|
-
export type { RouterCtx, ScreenU } from './context/router.ctx';
|
|
14
|
-
export { PrimitiveState } from './utils/PrimitiveState';
|
|
15
|
-
export { isExhaustive } from './utils/is-exhaustive';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type OpenCxComponentNameU = 'ui_lib/btn' | 'trigger/btn' | 'sessions/root' | 'sessions/header' | 'sessions/new_conversation_btn' | 'chat/root' | 'chat/header' | 'chat/main/root' | 'chat/canvas/root' | 'chat/msgs/root' | 'chat/agent_msg_group/root' | 'chat/agent_msg_group/avatar_and_msgs/root' | 'chat/agent_msg_group/avatar_and_msgs/avatar' | 'chat/agent_msg_group/avatar_and_msgs/msgs' | 'chat/agent_msg_group/root/avatar' | 'chat/agent_msg_group/suggestions' | 'chat/agent_msg/root' | 'chat/agent_msg/msg' | 'chat/persistent_initial_msgs/root' | 'chat/persistent_initial_msg/root' | 'chat/persistent_initial_msg/msg' | 'chat/user_msg_group/root' | 'chat/user_msg_group/avatar/root' | 'chat/user_msg/root' | 'chat/user_msg/msg' | 'chat/input_box/root' | 'chat/input_box/inner_root' | 'chat/input_box/textarea_and_attachments_container' | 'chat/input_box/textarea' | 'chat/input_box/attachments_container' | 'chat/bot_loading/root' | 'chat/bot_loading/bouncing_dots_container' | 'chat/suggested_reply_btn' | 'chat/might_solve_user_issue_suggested_replies_container';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Dto } from '../api/client';
|
|
2
|
-
export type VoteInputDto = Dto['WidgetVoteDto'];
|
|
3
|
-
export type VoteOutputDto = Dto['WidgetVoteResponseDto'];
|
|
4
|
-
export type SendMessageDto = Dto['WidgetSendMessageInputDto'];
|
|
5
|
-
export type SendMessageOutputDto = Dto['WidgetSendMessageOutputDto'];
|
|
6
|
-
export type ResolveSessionDto = Dto['WidgetResolveSessionInputDto'];
|
|
7
|
-
export type SessionDto = Dto['WidgetSessionDto'];
|
|
8
|
-
export type MessageDto = Dto['WidgetHistoryDto'];
|
|
9
|
-
export type PreludeDto = Dto['WidgetPreludeDto'];
|
|
10
|
-
export type MessageAttachmentType = NonNullable<Dto['WidgetHistoryDto']['attachments']>[number];
|
|
11
|
-
export type ActionCallDto = NonNullable<Dto['WidgetHistoryDto']['actionCalls']>[number];
|
|
12
|
-
export type ModeDto = Dto['WidgetConfigDto']['modes'][number];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { icons } from 'lucide';
|
|
2
|
-
import { SafeExtract } from './helpers';
|
|
3
|
-
export type IconNameU = SafeExtract<keyof typeof icons, 'Maximize' | 'Maximize2' | 'Minimize' | 'Minimize2' | 'Expand' | 'Shrink' | 'X' | 'SquareX' | 'CircleX' | 'Check' | 'CheckCheck' | 'CircleCheck' | 'CircleCheckBig' | 'SquareCheck' | 'SquareCheckBig'>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { MessageAttachmentType, MessageDto } from './dtos';
|
|
2
|
-
import { SafeExtract, StringOrLiteral } from './helpers';
|
|
3
|
-
import { AgentOrBotType } from './agent-or-bot';
|
|
4
|
-
export type LiteralWidgetComponentKey = 'bot_message' | 'agent_message' | 'loading' | 'fallback';
|
|
5
|
-
export type WidgetComponentKey = StringOrLiteral<LiteralWidgetComponentKey>;
|
|
6
|
-
export type UserMessageType = {
|
|
7
|
-
id: string;
|
|
8
|
-
type: 'FROM_USER';
|
|
9
|
-
content: string;
|
|
10
|
-
deliveredAt: string | null;
|
|
11
|
-
attachments?: MessageAttachmentType[] | null;
|
|
12
|
-
timestamp: string;
|
|
13
|
-
user?: {
|
|
14
|
-
name?: string;
|
|
15
|
-
email?: string;
|
|
16
|
-
phone?: string;
|
|
17
|
-
customData?: Record<string, string>;
|
|
18
|
-
avatarUrl?: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export type BotMessageType<TActionData = unknown> = {
|
|
22
|
-
id: string;
|
|
23
|
-
type: 'FROM_BOT';
|
|
24
|
-
/**
|
|
25
|
-
* The type is a bot_message literal string or other strings that correspond to the UI responses from AI action calls
|
|
26
|
-
*/
|
|
27
|
-
component: StringOrLiteral<SafeExtract<WidgetComponentKey, 'bot_message'>>;
|
|
28
|
-
data: {
|
|
29
|
-
message: string;
|
|
30
|
-
variant?: 'default' | 'error';
|
|
31
|
-
action?: {
|
|
32
|
-
name: string;
|
|
33
|
-
data: TActionData;
|
|
34
|
-
} | null;
|
|
35
|
-
};
|
|
36
|
-
timestamp: string;
|
|
37
|
-
original?: MessageDto;
|
|
38
|
-
agent?: AgentOrBotType;
|
|
39
|
-
attachments?: MessageAttachmentType[];
|
|
40
|
-
};
|
|
41
|
-
export type AgentMessageType = {
|
|
42
|
-
id: string;
|
|
43
|
-
type: 'FROM_AGENT';
|
|
44
|
-
component: SafeExtract<LiteralWidgetComponentKey, 'agent_message'>;
|
|
45
|
-
data: {
|
|
46
|
-
message: string;
|
|
47
|
-
variant?: 'default' | 'error';
|
|
48
|
-
action?: undefined;
|
|
49
|
-
};
|
|
50
|
-
timestamp?: string;
|
|
51
|
-
original?: MessageDto;
|
|
52
|
-
agent?: AgentOrBotType;
|
|
53
|
-
attachments?: MessageAttachmentType[];
|
|
54
|
-
};
|
|
55
|
-
export type MessageType = UserMessageType | BotMessageType | AgentMessageType;
|