@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/browser-mount.d.cts
CHANGED
|
@@ -48,7 +48,18 @@ interface WidgetSummary {
|
|
|
48
48
|
name: string;
|
|
49
49
|
widgetId: string;
|
|
50
50
|
}
|
|
51
|
+
/** A file on a message. Its bytes are fetched with the attachment token. */
|
|
52
|
+
interface WidgetAttachment {
|
|
53
|
+
contentType: string;
|
|
54
|
+
filename: string;
|
|
55
|
+
id: string;
|
|
56
|
+
/** How to show it: an image or an audio player in place, else a file card. */
|
|
57
|
+
kind: "image" | "audio" | "document";
|
|
58
|
+
sizeBytes: number;
|
|
59
|
+
}
|
|
51
60
|
interface WidgetMessage {
|
|
61
|
+
/** Present only when the message carries files. */
|
|
62
|
+
attachments?: WidgetAttachment[];
|
|
52
63
|
author: string | null;
|
|
53
64
|
/**
|
|
54
65
|
* Set on messages the support assistant wrote (`greeting`, `topic`,
|
|
@@ -71,10 +82,30 @@ interface WidgetSupportTopic {
|
|
|
71
82
|
/** Guided support for one conversation. Answers stay on the server. */
|
|
72
83
|
interface WidgetSupport {
|
|
73
84
|
mode: "human" | "guided" | "ai";
|
|
85
|
+
/** The reply time the team promises, if any ("We usually reply within a day."). */
|
|
86
|
+
responseTime?: string;
|
|
74
87
|
state: WidgetSupportState | null;
|
|
75
88
|
topics: WidgetSupportTopic[];
|
|
76
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* How this conversation takes files, from the server. Absent (older server)
|
|
92
|
+
* or null (no storage configured) means the widget offers no attach button.
|
|
93
|
+
*/
|
|
94
|
+
interface WidgetAttachmentsConfig {
|
|
95
|
+
/** File picker `accept`: `.png,.jpg,…`. */
|
|
96
|
+
accept: string;
|
|
97
|
+
expiresAt: string;
|
|
98
|
+
/** Shown before a file is picked: what may be sent, and how big. */
|
|
99
|
+
hint: string;
|
|
100
|
+
maxFileBytes: number;
|
|
101
|
+
maxFiles: number;
|
|
102
|
+
/** Bearer token for the file routes only; it cannot chat. */
|
|
103
|
+
token: string;
|
|
104
|
+
/** POST files here; GET or DELETE `<url>/<id>`. */
|
|
105
|
+
url: string;
|
|
106
|
+
}
|
|
77
107
|
interface WidgetSessionPayload {
|
|
108
|
+
attachments?: WidgetAttachmentsConfig | null;
|
|
78
109
|
contact: WidgetContact | null;
|
|
79
110
|
conversation: WidgetConversation;
|
|
80
111
|
expiresAt: string;
|
|
@@ -98,6 +129,8 @@ interface GetSessionOptions {
|
|
|
98
129
|
}
|
|
99
130
|
type GetSession = (options: GetSessionOptions) => Promise<WidgetSessionPayload>;
|
|
100
131
|
interface WidgetClientCreateMessageEvent {
|
|
132
|
+
/** Uploaded files to send with the message (`body` may then be empty). */
|
|
133
|
+
attachmentIds?: string[];
|
|
101
134
|
body: string;
|
|
102
135
|
id: string;
|
|
103
136
|
type: "message.create";
|
|
@@ -136,6 +169,9 @@ interface WidgetAssistantStatusEvent {
|
|
|
136
169
|
type: "assistant.status";
|
|
137
170
|
}
|
|
138
171
|
interface WidgetErrorEvent {
|
|
172
|
+
/** The send this refuses, when it refused one in particular. */
|
|
173
|
+
clientMessageId?: string;
|
|
174
|
+
code?: string;
|
|
139
175
|
message: string;
|
|
140
176
|
type: "error";
|
|
141
177
|
}
|
package/dist/browser-mount.d.mts
CHANGED
|
@@ -48,7 +48,18 @@ interface WidgetSummary {
|
|
|
48
48
|
name: string;
|
|
49
49
|
widgetId: string;
|
|
50
50
|
}
|
|
51
|
+
/** A file on a message. Its bytes are fetched with the attachment token. */
|
|
52
|
+
interface WidgetAttachment {
|
|
53
|
+
contentType: string;
|
|
54
|
+
filename: string;
|
|
55
|
+
id: string;
|
|
56
|
+
/** How to show it: an image or an audio player in place, else a file card. */
|
|
57
|
+
kind: "image" | "audio" | "document";
|
|
58
|
+
sizeBytes: number;
|
|
59
|
+
}
|
|
51
60
|
interface WidgetMessage {
|
|
61
|
+
/** Present only when the message carries files. */
|
|
62
|
+
attachments?: WidgetAttachment[];
|
|
52
63
|
author: string | null;
|
|
53
64
|
/**
|
|
54
65
|
* Set on messages the support assistant wrote (`greeting`, `topic`,
|
|
@@ -71,10 +82,30 @@ interface WidgetSupportTopic {
|
|
|
71
82
|
/** Guided support for one conversation. Answers stay on the server. */
|
|
72
83
|
interface WidgetSupport {
|
|
73
84
|
mode: "human" | "guided" | "ai";
|
|
85
|
+
/** The reply time the team promises, if any ("We usually reply within a day."). */
|
|
86
|
+
responseTime?: string;
|
|
74
87
|
state: WidgetSupportState | null;
|
|
75
88
|
topics: WidgetSupportTopic[];
|
|
76
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* How this conversation takes files, from the server. Absent (older server)
|
|
92
|
+
* or null (no storage configured) means the widget offers no attach button.
|
|
93
|
+
*/
|
|
94
|
+
interface WidgetAttachmentsConfig {
|
|
95
|
+
/** File picker `accept`: `.png,.jpg,…`. */
|
|
96
|
+
accept: string;
|
|
97
|
+
expiresAt: string;
|
|
98
|
+
/** Shown before a file is picked: what may be sent, and how big. */
|
|
99
|
+
hint: string;
|
|
100
|
+
maxFileBytes: number;
|
|
101
|
+
maxFiles: number;
|
|
102
|
+
/** Bearer token for the file routes only; it cannot chat. */
|
|
103
|
+
token: string;
|
|
104
|
+
/** POST files here; GET or DELETE `<url>/<id>`. */
|
|
105
|
+
url: string;
|
|
106
|
+
}
|
|
77
107
|
interface WidgetSessionPayload {
|
|
108
|
+
attachments?: WidgetAttachmentsConfig | null;
|
|
78
109
|
contact: WidgetContact | null;
|
|
79
110
|
conversation: WidgetConversation;
|
|
80
111
|
expiresAt: string;
|
|
@@ -98,6 +129,8 @@ interface GetSessionOptions {
|
|
|
98
129
|
}
|
|
99
130
|
type GetSession = (options: GetSessionOptions) => Promise<WidgetSessionPayload>;
|
|
100
131
|
interface WidgetClientCreateMessageEvent {
|
|
132
|
+
/** Uploaded files to send with the message (`body` may then be empty). */
|
|
133
|
+
attachmentIds?: string[];
|
|
101
134
|
body: string;
|
|
102
135
|
id: string;
|
|
103
136
|
type: "message.create";
|
|
@@ -136,6 +169,9 @@ interface WidgetAssistantStatusEvent {
|
|
|
136
169
|
type: "assistant.status";
|
|
137
170
|
}
|
|
138
171
|
interface WidgetErrorEvent {
|
|
172
|
+
/** The send this refuses, when it refused one in particular. */
|
|
173
|
+
clientMessageId?: string;
|
|
174
|
+
code?: string;
|
|
139
175
|
message: string;
|
|
140
176
|
type: "error";
|
|
141
177
|
}
|