@clivly/chat-widget 0.18.0 → 0.19.0
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/browser-mount.cjs +1191 -71
- package/dist/browser-mount.d.cts +36 -0
- package/dist/browser-mount.d.mts +36 -0
- package/dist/browser-mount.mjs +1191 -71
- package/dist/browser.cjs +1191 -71
- package/dist/browser.d.cts +36 -0
- package/dist/browser.d.mts +36 -0
- package/dist/browser.mjs +1191 -71
- package/dist/index.cjs +1191 -71
- package/dist/index.d.cts +37 -1
- package/dist/index.d.mts +37 -1
- package/dist/index.mjs +1191 -71
- package/dist/widget.global.js +284 -9
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -62,7 +62,18 @@ interface WidgetSummary {
|
|
|
62
62
|
name: string;
|
|
63
63
|
widgetId: string;
|
|
64
64
|
}
|
|
65
|
+
/** A file on a message. Its bytes are fetched with the attachment token. */
|
|
66
|
+
interface WidgetAttachment {
|
|
67
|
+
contentType: string;
|
|
68
|
+
filename: string;
|
|
69
|
+
id: string;
|
|
70
|
+
/** How to show it: an image or an audio player in place, else a file card. */
|
|
71
|
+
kind: "image" | "audio" | "document";
|
|
72
|
+
sizeBytes: number;
|
|
73
|
+
}
|
|
65
74
|
interface WidgetMessage {
|
|
75
|
+
/** Present only when the message carries files. */
|
|
76
|
+
attachments?: WidgetAttachment[];
|
|
66
77
|
author: string | null;
|
|
67
78
|
/**
|
|
68
79
|
* Set on messages the support assistant wrote (`greeting`, `topic`,
|
|
@@ -85,10 +96,30 @@ interface WidgetSupportTopic {
|
|
|
85
96
|
/** Guided support for one conversation. Answers stay on the server. */
|
|
86
97
|
interface WidgetSupport {
|
|
87
98
|
mode: "human" | "guided" | "ai";
|
|
99
|
+
/** The reply time the team promises, if any ("We usually reply within a day."). */
|
|
100
|
+
responseTime?: string;
|
|
88
101
|
state: WidgetSupportState | null;
|
|
89
102
|
topics: WidgetSupportTopic[];
|
|
90
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* How this conversation takes files, from the server. Absent (older server)
|
|
106
|
+
* or null (no storage configured) means the widget offers no attach button.
|
|
107
|
+
*/
|
|
108
|
+
interface WidgetAttachmentsConfig {
|
|
109
|
+
/** File picker `accept`: `.png,.jpg,…`. */
|
|
110
|
+
accept: string;
|
|
111
|
+
expiresAt: string;
|
|
112
|
+
/** Shown before a file is picked: what may be sent, and how big. */
|
|
113
|
+
hint: string;
|
|
114
|
+
maxFileBytes: number;
|
|
115
|
+
maxFiles: number;
|
|
116
|
+
/** Bearer token for the file routes only; it cannot chat. */
|
|
117
|
+
token: string;
|
|
118
|
+
/** POST files here; GET or DELETE `<url>/<id>`. */
|
|
119
|
+
url: string;
|
|
120
|
+
}
|
|
91
121
|
interface WidgetSessionPayload {
|
|
122
|
+
attachments?: WidgetAttachmentsConfig | null;
|
|
92
123
|
contact: WidgetContact | null;
|
|
93
124
|
conversation: WidgetConversation;
|
|
94
125
|
expiresAt: string;
|
|
@@ -112,6 +143,8 @@ interface GetSessionOptions {
|
|
|
112
143
|
}
|
|
113
144
|
type GetSession = (options: GetSessionOptions) => Promise<WidgetSessionPayload>;
|
|
114
145
|
interface WidgetClientCreateMessageEvent {
|
|
146
|
+
/** Uploaded files to send with the message (`body` may then be empty). */
|
|
147
|
+
attachmentIds?: string[];
|
|
115
148
|
body: string;
|
|
116
149
|
id: string;
|
|
117
150
|
type: "message.create";
|
|
@@ -155,6 +188,9 @@ interface WidgetAssistantStatusEvent {
|
|
|
155
188
|
type: "assistant.status";
|
|
156
189
|
}
|
|
157
190
|
interface WidgetErrorEvent {
|
|
191
|
+
/** The send this refuses, when it refused one in particular. */
|
|
192
|
+
clientMessageId?: string;
|
|
193
|
+
code?: string;
|
|
158
194
|
message: string;
|
|
159
195
|
type: "error";
|
|
160
196
|
}
|
|
@@ -320,4 +356,4 @@ export type CreateClivlyTransportOptions = CreateClivlyTransportOptions$1;
|
|
|
320
356
|
export declare const createClivlyTransport: typeof createClivlyTransport$1;
|
|
321
357
|
export declare const mountChatWidget: typeof mountChatWidget$1;
|
|
322
358
|
export declare const mountChatWidgetScript: typeof mountChatWidgetScript$1;
|
|
323
|
-
export type { ChatTransportConnection, ChatTransportHandlers, ChatWidgetLauncher, ChatWidgetPlacement, ChatWidgetProps, ChatWidgetTheme, ChatWidgetVisitor, CreateChatTransport, CreateChatTransportOptions, CreateLoopbackTransportOptions, CreateWebSocketTransportOptions, GetSession, GetSessionOptions, ResolvedTheme, WidgetAssistantStatusEvent, WidgetClientCreateMessageEvent, WidgetClientEvent, WidgetClientReadEvent, WidgetClientTopicEvent, WidgetConfig, WidgetContact, WidgetConversation, WidgetConversationSnapshotEvent, WidgetErrorEvent, WidgetMessage, WidgetMessageAckEvent, WidgetMessageCreatedEvent, WidgetSenderType, WidgetServerEvent, WidgetSessionPayload, WidgetSessionReadyEvent, WidgetSummary, WidgetSupport, WidgetSupportState, WidgetSupportStateEvent, WidgetSupportTopic };
|
|
359
|
+
export type { ChatTransportConnection, ChatTransportHandlers, ChatWidgetLauncher, ChatWidgetPlacement, ChatWidgetProps, ChatWidgetTheme, ChatWidgetVisitor, CreateChatTransport, CreateChatTransportOptions, CreateLoopbackTransportOptions, CreateWebSocketTransportOptions, GetSession, GetSessionOptions, ResolvedTheme, WidgetAssistantStatusEvent, WidgetAttachment, WidgetAttachmentsConfig, WidgetClientCreateMessageEvent, WidgetClientEvent, WidgetClientReadEvent, WidgetClientTopicEvent, WidgetConfig, WidgetContact, WidgetConversation, WidgetConversationSnapshotEvent, WidgetErrorEvent, WidgetMessage, WidgetMessageAckEvent, WidgetMessageCreatedEvent, WidgetSenderType, WidgetServerEvent, WidgetSessionPayload, WidgetSessionReadyEvent, WidgetSummary, WidgetSupport, WidgetSupportState, WidgetSupportStateEvent, WidgetSupportTopic };
|
package/dist/index.d.mts
CHANGED
|
@@ -62,7 +62,18 @@ interface WidgetSummary {
|
|
|
62
62
|
name: string;
|
|
63
63
|
widgetId: string;
|
|
64
64
|
}
|
|
65
|
+
/** A file on a message. Its bytes are fetched with the attachment token. */
|
|
66
|
+
interface WidgetAttachment {
|
|
67
|
+
contentType: string;
|
|
68
|
+
filename: string;
|
|
69
|
+
id: string;
|
|
70
|
+
/** How to show it: an image or an audio player in place, else a file card. */
|
|
71
|
+
kind: "image" | "audio" | "document";
|
|
72
|
+
sizeBytes: number;
|
|
73
|
+
}
|
|
65
74
|
interface WidgetMessage {
|
|
75
|
+
/** Present only when the message carries files. */
|
|
76
|
+
attachments?: WidgetAttachment[];
|
|
66
77
|
author: string | null;
|
|
67
78
|
/**
|
|
68
79
|
* Set on messages the support assistant wrote (`greeting`, `topic`,
|
|
@@ -85,10 +96,30 @@ interface WidgetSupportTopic {
|
|
|
85
96
|
/** Guided support for one conversation. Answers stay on the server. */
|
|
86
97
|
interface WidgetSupport {
|
|
87
98
|
mode: "human" | "guided" | "ai";
|
|
99
|
+
/** The reply time the team promises, if any ("We usually reply within a day."). */
|
|
100
|
+
responseTime?: string;
|
|
88
101
|
state: WidgetSupportState | null;
|
|
89
102
|
topics: WidgetSupportTopic[];
|
|
90
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* How this conversation takes files, from the server. Absent (older server)
|
|
106
|
+
* or null (no storage configured) means the widget offers no attach button.
|
|
107
|
+
*/
|
|
108
|
+
interface WidgetAttachmentsConfig {
|
|
109
|
+
/** File picker `accept`: `.png,.jpg,…`. */
|
|
110
|
+
accept: string;
|
|
111
|
+
expiresAt: string;
|
|
112
|
+
/** Shown before a file is picked: what may be sent, and how big. */
|
|
113
|
+
hint: string;
|
|
114
|
+
maxFileBytes: number;
|
|
115
|
+
maxFiles: number;
|
|
116
|
+
/** Bearer token for the file routes only; it cannot chat. */
|
|
117
|
+
token: string;
|
|
118
|
+
/** POST files here; GET or DELETE `<url>/<id>`. */
|
|
119
|
+
url: string;
|
|
120
|
+
}
|
|
91
121
|
interface WidgetSessionPayload {
|
|
122
|
+
attachments?: WidgetAttachmentsConfig | null;
|
|
92
123
|
contact: WidgetContact | null;
|
|
93
124
|
conversation: WidgetConversation;
|
|
94
125
|
expiresAt: string;
|
|
@@ -112,6 +143,8 @@ interface GetSessionOptions {
|
|
|
112
143
|
}
|
|
113
144
|
type GetSession = (options: GetSessionOptions) => Promise<WidgetSessionPayload>;
|
|
114
145
|
interface WidgetClientCreateMessageEvent {
|
|
146
|
+
/** Uploaded files to send with the message (`body` may then be empty). */
|
|
147
|
+
attachmentIds?: string[];
|
|
115
148
|
body: string;
|
|
116
149
|
id: string;
|
|
117
150
|
type: "message.create";
|
|
@@ -155,6 +188,9 @@ interface WidgetAssistantStatusEvent {
|
|
|
155
188
|
type: "assistant.status";
|
|
156
189
|
}
|
|
157
190
|
interface WidgetErrorEvent {
|
|
191
|
+
/** The send this refuses, when it refused one in particular. */
|
|
192
|
+
clientMessageId?: string;
|
|
193
|
+
code?: string;
|
|
158
194
|
message: string;
|
|
159
195
|
type: "error";
|
|
160
196
|
}
|
|
@@ -320,4 +356,4 @@ export type CreateClivlyTransportOptions = CreateClivlyTransportOptions$1;
|
|
|
320
356
|
export declare const createClivlyTransport: typeof createClivlyTransport$1;
|
|
321
357
|
export declare const mountChatWidget: typeof mountChatWidget$1;
|
|
322
358
|
export declare const mountChatWidgetScript: typeof mountChatWidgetScript$1;
|
|
323
|
-
export type { ChatTransportConnection, ChatTransportHandlers, ChatWidgetLauncher, ChatWidgetPlacement, ChatWidgetProps, ChatWidgetTheme, ChatWidgetVisitor, CreateChatTransport, CreateChatTransportOptions, CreateLoopbackTransportOptions, CreateWebSocketTransportOptions, GetSession, GetSessionOptions, ResolvedTheme, WidgetAssistantStatusEvent, WidgetClientCreateMessageEvent, WidgetClientEvent, WidgetClientReadEvent, WidgetClientTopicEvent, WidgetConfig, WidgetContact, WidgetConversation, WidgetConversationSnapshotEvent, WidgetErrorEvent, WidgetMessage, WidgetMessageAckEvent, WidgetMessageCreatedEvent, WidgetSenderType, WidgetServerEvent, WidgetSessionPayload, WidgetSessionReadyEvent, WidgetSummary, WidgetSupport, WidgetSupportState, WidgetSupportStateEvent, WidgetSupportTopic };
|
|
359
|
+
export type { ChatTransportConnection, ChatTransportHandlers, ChatWidgetLauncher, ChatWidgetPlacement, ChatWidgetProps, ChatWidgetTheme, ChatWidgetVisitor, CreateChatTransport, CreateChatTransportOptions, CreateLoopbackTransportOptions, CreateWebSocketTransportOptions, GetSession, GetSessionOptions, ResolvedTheme, WidgetAssistantStatusEvent, WidgetAttachment, WidgetAttachmentsConfig, WidgetClientCreateMessageEvent, WidgetClientEvent, WidgetClientReadEvent, WidgetClientTopicEvent, WidgetConfig, WidgetContact, WidgetConversation, WidgetConversationSnapshotEvent, WidgetErrorEvent, WidgetMessage, WidgetMessageAckEvent, WidgetMessageCreatedEvent, WidgetSenderType, WidgetServerEvent, WidgetSessionPayload, WidgetSessionReadyEvent, WidgetSummary, WidgetSupport, WidgetSupportState, WidgetSupportStateEvent, WidgetSupportTopic };
|