@epam/ai-dial-chat-overlay 1.1.0-dev.78 → 1.1.0-dev.87

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/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { ChatOverlay, ChatOverlayRequestError } from './lib/ChatOverlay';
2
2
  export { ChatOverlayManager, OverlayPosition } from './lib/ChatOverlayManager';
3
3
  export type { ChatOverlayManagerOptions } from './lib/ChatOverlayManager';
4
- export type { ChatOverlayOptions, CreateConversationPayload, CreateConversationResponse, CreateLocalConversationResponse, DeleteConversationPayload, DeleteConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, OverlayChatMessage, OverlayConversation, OverlayConversationError, OverlayRequestError, RenameConversationPayload, RenameConversationResponse, SelectConversationPayload, SelectConversationResponse, SendMessageResponse, SetOverlayOptionsResponse, SetSystemPromptResponse, SetTemperatureResponse, } from '@epam/ai-dial-chat-shared';
5
- export { OverlayAuthUiMode, OverlayEventType, OverlayFeature, OverlayRequestErrorCode, OverlayRequestType, } from '@epam/ai-dial-chat-shared';
4
+ export * from './protocol';
6
5
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/E,YAAY,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,gCAAgC,EAChC,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/E,YAAY,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,cAAc,YAAY,CAAC"}
package/index.js CHANGED
@@ -1,6 +1,30 @@
1
- import { OverlayAuthUiMode as e, OverlayEventType as t, OverlayEventType as n, OverlayFeature as r, OverlayFeature as i, OverlayRequestErrorCode as a, OverlayRequestType as o, OverlayRequestType as s, isOverlayMessageEvent as c, isOverlayMessageResponse as l } from "@epam/ai-dial-chat-shared";
2
- //#region src/lib/internal/default-loader.ts
3
- var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentation\" aria-hidden=\"true\"><circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-dasharray=\"31.4 31.4\"><animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"1s\" repeatCount=\"indefinite\" /></circle></svg>", d = 0, f = () => (d += 1, `dial-overlay-${Date.now()}-${d}`), p = class {
1
+ //#region src/protocol/overlay-protocol.ts
2
+ var e = "@DIAL_OVERLAY", t = /* @__PURE__ */ function(e) {
3
+ return e.GetMessages = "@DIAL_OVERLAY/GET_MESSAGES", e.SendMessage = "@DIAL_OVERLAY/SEND_MESSAGE", e.SetInputContent = "@DIAL_OVERLAY/SET_INPUT_CONTENT", e.SetSystemPrompt = "@DIAL_OVERLAY/SET_SYSTEM_PROMPT", e.SetTemperature = "@DIAL_OVERLAY/SET_TEMPERATURE", e.SetOverlayOptions = "@DIAL_OVERLAY/SET_OVERLAY_OPTIONS", e.GetConversations = "@DIAL_OVERLAY/GET_CONVERSATIONS", e.GetSelectedConversations = "@DIAL_OVERLAY/GET_SELECTED_CONVERSATIONS", e.SelectConversation = "@DIAL_OVERLAY/SELECT_CONVERSATION", e.CreateConversation = "@DIAL_OVERLAY/CREATE_CONVERSATION", e.CreateLocalConversation = "@DIAL_OVERLAY/CREATE_LOCAL_CONVERSATION", e.DeleteConversation = "@DIAL_OVERLAY/DELETE_CONVERSATION", e.RenameConversation = "@DIAL_OVERLAY/RENAME_CONVERSATION", e;
4
+ }({}), n = /* @__PURE__ */ function(e) {
5
+ return e.InitReady = "@DIAL_OVERLAY/INIT_READY", e.Ready = "@DIAL_OVERLAY/READY", e.ReadyToInteract = "@DIAL_OVERLAY/READY_TO_INTERACT", e.SelectedConversationLoaded = "@DIAL_OVERLAY/SELECTED_CONVERSATION_LOADED", e.GptStartGenerating = "@DIAL_OVERLAY/GPT_START_GENERATING", e.GptEndGenerating = "@DIAL_OVERLAY/GPT_END_GENERATING", e.StopGenerating = "@DIAL_OVERLAY/STOP_GENERATING", e.ConversationsUpdated = "@DIAL_OVERLAY/CONVERSATIONS_UPDATED", e;
6
+ }({}), r = /* @__PURE__ */ function(e) {
7
+ return e.CodeApps = "code-apps", e.CustomApplications = "custom-applications", e.HideCustomAppCreation = "hide-custom-app-creation", e.DisabledSend = "disabled-send", e.SkipFocusChatInputOnload = "skip-focus-chat-input-onload", e.DislikeComment = "dislike-comment", e.InputFiles = "input-files", e.Likes = "likes", e.LiveChatInteraction = "live-chat-interaction", e.DisallowChangeAgent = "disallow-change-agent", e.HideNewConversation = "hide-new-conversation", e.EmptyChatSettings = "empty-chat-settings", e.HideEmptyChatChangeAgent = "hide-empty-chat-change-agent", e.AttachmentsManager = "attachments-manager", e.ConversationsPanelToggle = "conversations-panel-toggle", e.ConversationsSection = "conversations-section", e.Header = "header", e.ShowConversationsSectionByDefault = "showConversationsSectionByDefault", e.Catalog = "catalog", e.CatalogHideMyApps = "catalog-hide-my-apps", e.CatalogTableView = "catalog-table-view", e.HideDeleteUserMessage = "hide-delete-user-message", e.HideEditUserMessage = "hide-edit-user-message", e.HideRegenerateAssistantMessage = "hide-regenerate-assistant-message", e.ConversationsPublishing = "conversations-publishing", e.ApplicationsSharing = "applications-sharing", e.ConversationsSharing = "conversations-sharing", e.ToolsetsSharing = "toolsets-sharing", e.Toolsets = "toolsets", e.HideUserMenu = "hide-user-menu", e.HideUserSettings = "hide-user-settings", e.VoiceInput = "voice-input", e;
8
+ }({}), i = /* @__PURE__ */ function(e) {
9
+ return e.External = "external", e.SameWindow = "sameWindow", e;
10
+ }({}), a = /* @__PURE__ */ function(e) {
11
+ return e.ActiveConversationUnavailable = "ACTIVE_CONVERSATION_UNAVAILABLE", e.ConversationListUnavailable = "CONVERSATION_LIST_UNAVAILABLE", e.InvalidPayload = "INVALID_PAYLOAD", e.RequestExecutionFailed = "REQUEST_EXECUTION_FAILED", e;
12
+ }({}), o = (e) => {
13
+ if (typeof e != "object" || !e) return !1;
14
+ let n = e;
15
+ return typeof n.type == "string" && Object.values(t).includes(n.type) && typeof n.requestId == "string" && (!("expiresAt" in n) || typeof n.expiresAt == "number" && Number.isFinite(n.expiresAt));
16
+ }, s = (e) => {
17
+ if (typeof e != "object" || !e) return !1;
18
+ let n = e;
19
+ if (typeof n.type != "string" || typeof n.requestId != "string" || !Object.values(t).some((e) => n.type === `${e}/RESPONSE`)) return !1;
20
+ if (!("error" in n)) return !0;
21
+ let r = n.error;
22
+ return typeof r == "object" && !!r && typeof r.code == "string" && Object.values(a).includes(r.code) && typeof r.message == "string";
23
+ }, c = (e) => {
24
+ if (typeof e != "object" || !e) return !1;
25
+ let t = e;
26
+ return typeof t.type == "string" && Object.values(n).includes(t.type) && !("requestId" in t);
27
+ }, l = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentation\" aria-hidden=\"true\"><circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-dasharray=\"31.4 31.4\"><animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"1s\" repeatCount=\"indefinite\" /></circle></svg>", u = 0, d = () => (u += 1, `dial-overlay-${Date.now()}-${u}`), f = class {
4
28
  requestType;
5
29
  requestId;
6
30
  responseType;
@@ -10,7 +34,7 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
10
34
  settled = !1;
11
35
  timeoutHandle;
12
36
  constructor(e, t) {
13
- this.requestType = e, this.requestId = f(), this.responseType = `${e}/RESPONSE`, this.promise = new Promise((e, t) => {
37
+ this.requestType = e, this.requestId = d(), this.responseType = `${e}/RESPONSE`, this.promise = new Promise((e, t) => {
14
38
  this.resolveFn = e, this.rejectFn = t;
15
39
  }), this.timeoutHandle = setTimeout(() => {
16
40
  this.reject(/* @__PURE__ */ Error(`ChatOverlay: request "${e}" timed out after ${t}ms`));
@@ -25,9 +49,9 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
25
49
  reject(e) {
26
50
  this.settled || (this.settled = !0, clearTimeout(this.timeoutHandle), this.rejectFn(e));
27
51
  }
28
- }, m = (e, t) => {
52
+ }, p = (e, t) => {
29
53
  Object.assign(e.style, t);
30
- }, h = class {
54
+ }, m = class {
31
55
  promise;
32
56
  resolveFn;
33
57
  rejectFn;
@@ -43,30 +67,30 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
43
67
  reject(e) {
44
68
  this.settled || (this.settled = !0, this.rejectFn(e));
45
69
  }
46
- }, g = 1e4, _ = "data-dial-overlay-loader", v = class extends Error {
70
+ }, h = 1e4, g = "data-dial-overlay-loader", _ = class extends Error {
47
71
  code;
48
72
  requestType;
49
73
  constructor(e, t) {
50
74
  super(`ChatOverlay: request "${e}" failed [${t.code}]: ${t.message}`), this.name = "ChatOverlayRequestError", this.code = t.code, this.requestType = e;
51
75
  }
52
- }, y = (e) => {
76
+ }, v = (e) => {
53
77
  if (typeof e != "string") return e;
54
78
  let t = document.querySelector(e);
55
79
  if (!t) throw Error(`ChatOverlay: no element matches selector "${e}"`);
56
80
  return t;
57
- }, b = (e) => {
81
+ }, y = (e) => {
58
82
  let t = document.createElement("iframe");
59
83
  t.src = e.domain, t.name = "overlay", t.setAttribute("aria-label", "DIAL Chat"), t.setAttribute("sandbox", "allow-same-origin allow-scripts allow-modals allow-forms allow-popups allow-downloads allow-popups-to-escape-sandbox");
60
84
  let n = ["clipboard-write"];
61
- return e.enabledFeatures?.includes(i.VoiceInput) && n.push("microphone"), t.setAttribute("allow", n.join("; ")), m(t, {
85
+ return e.enabledFeatures?.includes(r.VoiceInput) && n.push("microphone"), t.setAttribute("allow", n.join("; ")), p(t, {
62
86
  border: "none",
63
87
  display: "block",
64
88
  width: "100%",
65
89
  height: "100%"
66
90
  }), t;
67
- }, x = (e) => {
91
+ }, b = (e) => {
68
92
  let t = document.createElement("div");
69
- return t.setAttribute(_, ""), t.innerHTML = e.loaderInnerHTML ?? u, m(t, {
93
+ return t.setAttribute(g, ""), t.innerHTML = e.loaderInnerHTML ?? l, p(t, {
70
94
  position: "absolute",
71
95
  inset: "0",
72
96
  zIndex: "2",
@@ -76,14 +100,14 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
76
100
  boxSizing: "border-box",
77
101
  background: "#ffffff",
78
102
  color: "#2764d9"
79
- }), e.loaderClass && (t.className = e.loaderClass), e.loaderStyles && m(t, e.loaderStyles), t;
80
- }, S = class {
103
+ }), e.loaderClass && (t.className = e.loaderClass), e.loaderStyles && p(t, e.loaderStyles), t;
104
+ }, x = class {
81
105
  root;
82
106
  iframe;
83
107
  loader;
84
108
  options;
85
109
  targetOrigin;
86
- readyGate = new h();
110
+ readyGate = new m();
87
111
  pendingRequests = /* @__PURE__ */ new Map();
88
112
  eventSubscribers = /* @__PURE__ */ new Map();
89
113
  messageListener = (e) => {
@@ -91,59 +115,59 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
91
115
  };
92
116
  isDestroyed = !1;
93
117
  constructor(e, t) {
94
- this.root = y(e), this.options = { ...t }, this.targetOrigin = new URL(t.domain).origin, this.iframe = b(this.options), this.loader = x(this.options);
118
+ this.root = v(e), this.options = { ...t }, this.targetOrigin = new URL(t.domain).origin, this.iframe = y(this.options), this.loader = b(this.options);
95
119
  let n = window.getComputedStyle(this.root).position;
96
- (n === "static" || n === "") && m(this.root, { position: "relative" }), this.root.appendChild(this.loader), this.root.appendChild(this.iframe), window.addEventListener("message", this.messageListener), this.readyGate.promise.catch(() => void 0);
120
+ (n === "static" || n === "") && p(this.root, { position: "relative" }), this.root.appendChild(this.loader), this.root.appendChild(this.iframe), window.addEventListener("message", this.messageListener), this.readyGate.promise.catch(() => void 0);
97
121
  }
98
122
  ready() {
99
123
  return this.readyGate.promise;
100
124
  }
101
125
  getMessages() {
102
- return this.send(s.GetMessages);
126
+ return this.send(t.GetMessages);
103
127
  }
104
128
  sendMessage(e) {
105
- let t = { content: e };
106
- return this.send(s.SendMessage, t);
129
+ let n = { content: e };
130
+ return this.send(t.SendMessage, n);
107
131
  }
108
132
  setInputContent(e) {
109
- let t = { content: e };
110
- return this.send(s.SetInputContent, t);
133
+ let n = { content: e };
134
+ return this.send(t.SetInputContent, n);
111
135
  }
112
136
  setSystemPrompt(e) {
113
- let t = { systemPrompt: e };
114
- return this.send(s.SetSystemPrompt, t);
137
+ let n = { systemPrompt: e };
138
+ return this.send(t.SetSystemPrompt, n);
115
139
  }
116
140
  setTemperature(e) {
117
- let t = { temperature: e };
118
- return this.send(s.SetTemperature, t);
141
+ let n = { temperature: e };
142
+ return this.send(t.SetTemperature, n);
119
143
  }
120
144
  getConversations() {
121
- return this.send(s.GetConversations);
145
+ return this.send(t.GetConversations);
122
146
  }
123
147
  getSelectedConversations() {
124
- return this.send(s.GetSelectedConversations);
148
+ return this.send(t.GetSelectedConversations);
125
149
  }
126
150
  selectConversation(e) {
127
- let t = { id: e };
128
- return this.send(s.SelectConversation, t);
151
+ let n = { id: e };
152
+ return this.send(t.SelectConversation, n);
129
153
  }
130
154
  createConversation(e) {
131
- let t = { ...e };
132
- return this.send(s.CreateConversation, t);
155
+ let n = { ...e };
156
+ return this.send(t.CreateConversation, n);
133
157
  }
134
158
  createLocalConversation() {
135
- return this.send(s.CreateLocalConversation);
159
+ return this.send(t.CreateLocalConversation);
136
160
  }
137
161
  deleteConversation(e) {
138
- let t = { id: e };
139
- return this.send(s.DeleteConversation, t);
162
+ let n = { id: e };
163
+ return this.send(t.DeleteConversation, n);
140
164
  }
141
- renameConversation(e, t) {
142
- let n = {
165
+ renameConversation(e, n) {
166
+ let r = {
143
167
  id: e,
144
- newName: t
168
+ newName: n
145
169
  };
146
- return this.send(s.RenameConversation, n);
170
+ return this.send(t.RenameConversation, r);
147
171
  }
148
172
  setOverlayOptions(e) {
149
173
  return this.options.theme = e.theme ?? this.options.theme, this.options.modelId = e.modelId ?? this.options.modelId, this.options.overlayConversationId = e.overlayConversationId ?? this.options.overlayConversationId, this.options.enabledFeatures = e.enabledFeatures ?? this.options.enabledFeatures, Object.hasOwn(e, "auth") && (this.options.auth = e.auth), this.sendCurrentOverlayOptions();
@@ -170,15 +194,15 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
170
194
  sendCurrentOverlayOptions() {
171
195
  let e = { hostDomain: window.location.origin };
172
196
  this.options.theme !== void 0 && (e.theme = this.options.theme), this.options.modelId !== void 0 && (e.modelId = this.options.modelId), this.options.overlayConversationId !== void 0 && (e.overlayConversationId = this.options.overlayConversationId), this.options.enabledFeatures !== void 0 && (e.enabledFeatures = this.options.enabledFeatures);
173
- let t = this.options.auth?.providerUiModes;
174
- return t !== void 0 && Object.keys(t).length > 0 && (e.authProviderUiModes = t), this.send(s.SetOverlayOptions, e, { bypassReadyGate: !0 });
197
+ let n = this.options.auth?.providerUiModes;
198
+ return n !== void 0 && Object.keys(n).length > 0 && (e.authProviderUiModes = n), this.send(t.SetOverlayOptions, e, { bypassReadyGate: !0 });
175
199
  }
176
200
  send(e, t, n) {
177
201
  return this.isDestroyed ? Promise.reject(/* @__PURE__ */ Error("ChatOverlay: instance was destroyed")) : n?.bypassReadyGate ? this.dispatchRequest(e, t) : this.readyGate.promise.then(() => this.dispatchRequest(e, t));
178
202
  }
179
203
  dispatchRequest(e, t) {
180
204
  if (this.isDestroyed) return Promise.reject(/* @__PURE__ */ Error("ChatOverlay: instance was destroyed"));
181
- let n = this.options.requestTimeout ?? g, r = new p(e, n);
205
+ let n = this.options.requestTimeout ?? h, r = new f(e, n);
182
206
  this.pendingRequests.set(r.requestId, r), r.promise.finally(() => {
183
207
  this.pendingRequests.delete(r.requestId);
184
208
  }).catch(() => void 0);
@@ -193,7 +217,7 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
193
217
  handleMessage(e) {
194
218
  if (e.source !== this.iframe.contentWindow) return;
195
219
  let t = e.data;
196
- if (l(t)) {
220
+ if (s(t)) {
197
221
  this.handleResponse(t);
198
222
  return;
199
223
  }
@@ -203,7 +227,7 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
203
227
  let t = this.pendingRequests.get(e.requestId);
204
228
  if (!(!t || !t.matches(e.type, e.requestId))) {
205
229
  if (this.pendingRequests.delete(e.requestId), e.error) {
206
- t.reject(new v(t.requestType, e.error));
230
+ t.reject(new _(t.requestType, e.error));
207
231
  return;
208
232
  }
209
233
  t.resolve(e.payload);
@@ -219,41 +243,41 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
219
243
  notifySubscribers(e, t) {
220
244
  this.eventSubscribers.get(e)?.forEach((e) => e(t));
221
245
  }
222
- }, C = 768, w = 380, T = 600, E = 999999, D = "24px", O = "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M4 4h16v12H7l-3 3V4z\"/></svg>", k = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71 12 12.01l-6.3-6.3-1.4 1.41 6.29 6.29-6.29 6.29 1.4 1.41 6.3-6.3 6.3 6.3 1.4-1.41-6.29-6.29 6.29-6.29z\"/></svg>", A = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M4 4h6v2H6v4H4V4zm10 0h6v6h-2V6h-4V4zM4 14h2v4h4v2H4v-6zm14 0h2v6h-6v-2h4v-4z\"/></svg>", j = "dial-overlay-manager-styles", M = () => {
223
- if (document.getElementById(j)) return;
246
+ }, S = 768, C = 380, w = 600, T = 999999, E = "24px", D = "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M4 4h16v12H7l-3 3V4z\"/></svg>", O = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71 12 12.01l-6.3-6.3-1.4 1.41 6.29 6.29-6.29 6.29 1.4 1.41 6.3-6.3 6.3 6.3 1.4-1.41-6.29-6.29 6.29-6.29z\"/></svg>", k = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M4 4h6v2H6v4H4V4zm10 0h6v6h-2V6h-4V4zM4 14h2v4h4v2H4v-6zm14 0h2v6h-6v-2h4v-4z\"/></svg>", A = "dial-overlay-manager-styles", j = () => {
247
+ if (document.getElementById(A)) return;
224
248
  let e = document.createElement("style");
225
- e.id = j, e.textContent = "\n.dial-overlay-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border: none;\n border-radius: 999px;\n cursor: pointer;\n background: #2764d9;\n color: #ffffff;\n}\n.dial-overlay-btn:hover,\n.dial-overlay-btn:focus-visible {\n background: #1d4fb8;\n outline: 2px solid #1d4fb8;\n outline-offset: 2px;\n}\n", document.head.appendChild(e);
226
- }, N = (e, t) => {
249
+ e.id = A, e.textContent = "\n.dial-overlay-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n border: none;\n border-radius: 999px;\n cursor: pointer;\n background: #2764d9;\n color: #ffffff;\n}\n.dial-overlay-btn:hover,\n.dial-overlay-btn:focus-visible {\n background: #1d4fb8;\n outline: 2px solid #1d4fb8;\n outline-offset: 2px;\n}\n", document.head.appendChild(e);
250
+ }, M = (e, t) => {
227
251
  let n = document.createElement("button");
228
252
  return n.type = "button", n.className = "dial-overlay-btn", n.setAttribute("aria-label", e), n.innerHTML = t, n;
229
- }, P = (e) => typeof e == "number" ? `${e}px` : e, F = /* @__PURE__ */ function(e) {
253
+ }, N = (e) => typeof e == "number" ? `${e}px` : e, P = /* @__PURE__ */ function(e) {
230
254
  return e.LeftBottom = "left-bottom", e.LeftTop = "left-top", e.RightBottom = "right-bottom", e.RightTop = "right-top", e;
231
- }({}), I = {
255
+ }({}), F = {
232
256
  "right-bottom": {
233
- insetInlineEnd: D,
234
- insetBlockEnd: D,
257
+ insetInlineEnd: E,
258
+ insetBlockEnd: E,
235
259
  insetInlineStart: "auto",
236
260
  insetBlockStart: "auto"
237
261
  },
238
262
  "right-top": {
239
- insetInlineEnd: D,
240
- insetBlockStart: D,
263
+ insetInlineEnd: E,
264
+ insetBlockStart: E,
241
265
  insetInlineStart: "auto",
242
266
  insetBlockEnd: "auto"
243
267
  },
244
268
  "left-bottom": {
245
- insetInlineStart: D,
246
- insetBlockEnd: D,
269
+ insetInlineStart: E,
270
+ insetBlockEnd: E,
247
271
  insetInlineEnd: "auto",
248
272
  insetBlockStart: "auto"
249
273
  },
250
274
  "left-top": {
251
- insetInlineStart: D,
252
- insetBlockStart: D,
275
+ insetInlineStart: E,
276
+ insetBlockStart: E,
253
277
  insetInlineEnd: "auto",
254
278
  insetBlockEnd: "auto"
255
279
  }
256
- }, L = class {
280
+ }, I = class {
257
281
  overlays = /* @__PURE__ */ new Map();
258
282
  abortController = new AbortController();
259
283
  isDestroyed = !1;
@@ -265,9 +289,9 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
265
289
  }
266
290
  createOverlay(e) {
267
291
  if (this.overlays.has(e.overlayId)) throw Error(`ChatOverlayManager: overlay "${e.overlayId}" already exists`);
268
- M();
292
+ j();
269
293
  let t = document.createElement("div");
270
- t.setAttribute("data-dial-overlay-container", e.overlayId), m(t, {
294
+ t.setAttribute("data-dial-overlay-container", e.overlayId), p(t, {
271
295
  display: "flex",
272
296
  flexDirection: "column",
273
297
  overflow: "hidden",
@@ -276,24 +300,24 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
276
300
  background: "#ffffff"
277
301
  });
278
302
  let n = document.createElement("div");
279
- m(n, {
303
+ p(n, {
280
304
  display: "flex",
281
305
  justifyContent: "flex-end",
282
306
  gap: "8px",
283
307
  padding: "8px"
284
308
  });
285
- let r = N(e.closeButtonAriaLabel ?? "Collapse", k);
309
+ let r = M(e.closeButtonAriaLabel ?? "Collapse", O);
286
310
  n.appendChild(r);
287
311
  let i;
288
- e.allowFullscreen && (i = N(e.fullscreenButtonAriaLabel ?? "Open full screen", A), n.appendChild(i));
312
+ e.allowFullscreen && (i = M(e.fullscreenButtonAriaLabel ?? "Open full screen", k), n.appendChild(i));
289
313
  let a = document.createElement("div");
290
- m(a, {
314
+ p(a, {
291
315
  flex: "1",
292
316
  minHeight: "0"
293
317
  }), t.appendChild(n), t.appendChild(a), document.body.appendChild(t);
294
- let o = new S(a, e);
318
+ let o = new x(a, e);
295
319
  e.allowFullscreen && o.allowFullscreen();
296
- let s = N(e.toggleButtonAriaLabel ?? "Open chat", O);
320
+ let s = M(e.toggleButtonAriaLabel ?? "Open chat", D);
297
321
  document.body.appendChild(s);
298
322
  let c = {
299
323
  overlay: o,
@@ -378,16 +402,16 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
378
402
  return t;
379
403
  }
380
404
  applyLayout(e) {
381
- let { options: t, container: n, toggleButton: r } = e, i = t.position ?? "right-bottom", a = String(t.zIndex ?? E);
382
- if (m(r, {
405
+ let { options: t, container: n, toggleButton: r } = e, i = t.position ?? "right-bottom", a = String(t.zIndex ?? T);
406
+ if (p(r, {
383
407
  position: "fixed",
384
408
  zIndex: a,
385
- ...I[i]
386
- }), m(n, {
409
+ ...F[i]
410
+ }), p(n, {
387
411
  position: "fixed",
388
412
  zIndex: a
389
- }), window.innerWidth <= C) {
390
- m(n, {
413
+ }), window.innerWidth <= S) {
414
+ p(n, {
391
415
  insetInlineStart: "0",
392
416
  insetInlineEnd: "0",
393
417
  insetBlockStart: "0",
@@ -398,12 +422,12 @@ var u = "<svg viewBox=\"0 0 50 50\" width=\"32\" height=\"32\" role=\"presentati
398
422
  });
399
423
  return;
400
424
  }
401
- m(n, {
402
- width: P(t.width ?? w),
403
- height: P(t.height ?? T),
404
- ...I[i]
425
+ p(n, {
426
+ width: N(t.width ?? C),
427
+ height: N(t.height ?? w),
428
+ ...F[i]
405
429
  });
406
430
  }
407
431
  };
408
432
  //#endregion
409
- export { S as ChatOverlay, L as ChatOverlayManager, v as ChatOverlayRequestError, e as OverlayAuthUiMode, t as OverlayEventType, r as OverlayFeature, F as OverlayPosition, a as OverlayRequestErrorCode, o as OverlayRequestType };
433
+ export { x as ChatOverlay, I as ChatOverlayManager, _ as ChatOverlayRequestError, e as DIAL_OVERLAY_NAMESPACE, i as OverlayAuthUiMode, n as OverlayEventType, r as OverlayFeature, P as OverlayPosition, a as OverlayRequestErrorCode, t as OverlayRequestType, c as isOverlayMessageEvent, o as isOverlayMessageRequest, s as isOverlayMessageResponse };
@@ -1,4 +1,4 @@
1
- import { ChatOverlayOptions, CreateConversationResponse, CreateLocalConversationResponse, DeleteConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, OverlayRequestError, OverlayEventType, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetOverlayOptionsResponse, SetSystemPromptResponse, SetTemperatureResponse } from '@epam/ai-dial-chat-shared';
1
+ import { ChatOverlayOptions, CreateConversationResponse, CreateLocalConversationResponse, DeleteConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, OverlayRequestError, OverlayEventType, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetOverlayOptionsResponse, SetSystemPromptResponse, SetTemperatureResponse } from '../protocol';
2
2
  /** Error returned by the embedded chat for a well-formed overlay request. */
3
3
  export declare class ChatOverlayRequestError extends Error {
4
4
  /** Stable embedded-chat error code. */
@@ -1 +1 @@
1
- {"version":3,"file":"ChatOverlay.d.ts","sourceRoot":"","sources":["../../src/lib/ChatOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EAEpC,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EAIrC,KAAK,mBAAmB,EACxB,gBAAgB,EAIhB,KAAK,0BAA0B,EAE/B,KAAK,0BAA0B,EAE/B,KAAK,mBAAmB,EAGxB,KAAK,yBAAyB,EAE9B,KAAK,uBAAuB,EAE5B,KAAK,sBAAsB,EAG5B,MAAM,2BAA2B,CAAC;AASnC,6EA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I,CACF,kBAAkB,EAChB,OAAO,GACP,SAAS,GACT,uBAAuB,GACvB,iBAAiB,GACjB,MAAM,CACT,CACF,GACA,OAAO,CAAC,yBAAyB,CAAC;IAarC,gFAAgF;IAChF,SAAS,CAAC,CAAC,GAAG,OAAO,EACnB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAC7B,MAAM,IAAI;IAYb,wDAAwD;IACxD,eAAe,IAAI,IAAI;IAWvB,iDAAiD;IAC3C,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAMrC;;;OAGG;IACH,OAAO,IAAI,IAAI;IAef,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,IAAI;IAkBZ,OAAO,CAAC,eAAe;IA+BvB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,iBAAiB;CAO1B"}
@@ -1,4 +1,4 @@
1
- import { ChatOverlayOptions, CreateConversationResponse, CreateLocalConversationResponse, DeleteConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, OverlayEventType, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetOverlayOptionsResponse, SetSystemPromptResponse, SetTemperatureResponse } from '@epam/ai-dial-chat-shared';
1
+ import { ChatOverlayOptions, CreateConversationResponse, CreateLocalConversationResponse, DeleteConversationResponse, GetConversationsResponse, GetMessagesResponse, GetSelectedConversationsResponse, OverlayEventType, RenameConversationResponse, SelectConversationResponse, SendMessageResponse, SetOverlayOptionsResponse, SetSystemPromptResponse, SetTemperatureResponse } from '../protocol';
2
2
  /** Fixed-position placement for a `ChatOverlayManager`-created overlay. */
3
3
  export declare enum OverlayPosition {
4
4
  /** Anchored to the start (left in LTR) edge, bottom corner. */
@@ -1 +1 @@
1
- {"version":3,"file":"ChatOverlayManager.d.ts","sourceRoot":"","sources":["../../src/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AC;IAItC,2EAA2E;IAC3E,kBAAkB,CAChB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,0BAA0B,CAAC;IAItC,gEAAgE;IAChE,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CACd,IAAI,CACF,kBAAkB,EAClB,OAAO,GAAG,SAAS,GAAG,uBAAuB,GAAG,iBAAiB,CAClE,CACF,GACA,OAAO,CAAC,yBAAyB,CAAC;IAIrC,8DAA8D;IAC9D,SAAS,CAAC,CAAC,GAAG,OAAO,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAC7B,MAAM,IAAI;IAIb,2CAA2C;IAC3C,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD,wFAAwF;IACxF,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,WAAW;CAgCpB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-overlay",
3
3
  "description": "Embeddable postMessage-based ChatOverlay/ChatOverlayManager widget for hosting a DIAL Chat instance inside a third-party page",
4
- "version": "1.1.0-dev.78",
4
+ "version": "1.1.0-dev.87",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -15,9 +15,6 @@
15
15
  "default": "./index.js"
16
16
  }
17
17
  },
18
- "peerDependencies": {
19
- "@epam/ai-dial-chat-shared": "1.1.0-dev.78"
20
- },
21
18
  "repository": {
22
19
  "type": "git",
23
20
  "url": "git+https://github.com/epam/ai-dial-chat.git",
@@ -0,0 +1,378 @@
1
+ /** Namespace prefix for every `@DIAL_OVERLAY` postMessage type string. */
2
+ export declare const DIAL_OVERLAY_NAMESPACE = "@DIAL_OVERLAY";
3
+ /** Request message types the host can send to the embedded app. */
4
+ export declare enum OverlayRequestType {
5
+ /** Fetch the active conversation's messages. */
6
+ GetMessages = "@DIAL_OVERLAY/GET_MESSAGES",
7
+ /** Send a new message in the active conversation. */
8
+ SendMessage = "@DIAL_OVERLAY/SEND_MESSAGE",
9
+ /** Set the current text content of the message input. */
10
+ SetInputContent = "@DIAL_OVERLAY/SET_INPUT_CONTENT",
11
+ /** Set the active conversation's system prompt. */
12
+ SetSystemPrompt = "@DIAL_OVERLAY/SET_SYSTEM_PROMPT",
13
+ /** Set the active conversation's temperature. */
14
+ SetTemperature = "@DIAL_OVERLAY/SET_TEMPERATURE",
15
+ /** Set host-provided options (theme, model, conversation, host domain). */
16
+ SetOverlayOptions = "@DIAL_OVERLAY/SET_OVERLAY_OPTIONS",
17
+ /** Fetch the current user's conversation list. */
18
+ GetConversations = "@DIAL_OVERLAY/GET_CONVERSATIONS",
19
+ /** Fetch the currently displayed (active) conversation(s). */
20
+ GetSelectedConversations = "@DIAL_OVERLAY/GET_SELECTED_CONVERSATIONS",
21
+ /** Navigate to and load a specific conversation by id. */
22
+ SelectConversation = "@DIAL_OVERLAY/SELECT_CONVERSATION",
23
+ /** Create a new conversation, persisting immediately if a first message is given. */
24
+ CreateConversation = "@DIAL_OVERLAY/CREATE_CONVERSATION",
25
+ /** Open the conversation composer without persisting anything. */
26
+ CreateLocalConversation = "@DIAL_OVERLAY/CREATE_LOCAL_CONVERSATION",
27
+ /** Delete a conversation by id. */
28
+ DeleteConversation = "@DIAL_OVERLAY/DELETE_CONVERSATION",
29
+ /** Rename a conversation by id. */
30
+ RenameConversation = "@DIAL_OVERLAY/RENAME_CONVERSATION"
31
+ }
32
+ /** Event message types the embedded app sends to the host. */
33
+ export declare enum OverlayEventType {
34
+ /** Sent once, immediately, before any host identity is known. */
35
+ InitReady = "@DIAL_OVERLAY/INIT_READY",
36
+ /** Sent once, after auth/model-load state resolves. */
37
+ Ready = "@DIAL_OVERLAY/READY",
38
+ /** Sent once, after the active conversation has been selected/loaded for the first time. */
39
+ ReadyToInteract = "@DIAL_OVERLAY/READY_TO_INTERACT",
40
+ /** Sent whenever the app finishes loading a conversation (initial load or navigation). */
41
+ SelectedConversationLoaded = "@DIAL_OVERLAY/SELECTED_CONVERSATION_LOADED",
42
+ /** Sent when a generation starts for the active conversation. */
43
+ GptStartGenerating = "@DIAL_OVERLAY/GPT_START_GENERATING",
44
+ /** Sent when a generation completes for the active conversation. */
45
+ GptEndGenerating = "@DIAL_OVERLAY/GPT_END_GENERATING",
46
+ /** Sent when a user (or host) stops an in-flight generation. */
47
+ StopGenerating = "@DIAL_OVERLAY/STOP_GENERATING",
48
+ /** Sent whenever the app's conversation list changes. */
49
+ ConversationsUpdated = "@DIAL_OVERLAY/CONVERSATIONS_UPDATED"
50
+ }
51
+ /** Optional embed-time features a host can opt into via `ChatOverlayOptions.enabledFeatures`. */
52
+ export declare enum OverlayFeature {
53
+ /** Enables the "Add app" menu's Code Apps entry. */
54
+ CodeApps = "code-apps",
55
+ /** Enables the "Add app" menu's custom-application creation entry point. */
56
+ CustomApplications = "custom-applications",
57
+ /** Hides the "Custom app" creation entry in the "Add app" menu. */
58
+ HideCustomAppCreation = "hide-custom-app-creation",
59
+ /** Disables the send action on the chat input without removing the button. */
60
+ DisabledSend = "disabled-send",
61
+ /** Suppresses the chat input's auto-focus effect on load. */
62
+ SkipFocusChatInputOnload = "skip-focus-chat-input-onload",
63
+ /** Enables the comment field in the negative-feedback (dislike) modal. */
64
+ DislikeComment = "dislike-comment",
65
+ /** Enables attaching files to a message via the conversation input. */
66
+ InputFiles = "input-files",
67
+ /** Enables like/dislike actions on assistant messages. */
68
+ Likes = "likes",
69
+ /** Enables the live-chat-interaction sign-in UI affordance. */
70
+ LiveChatInteraction = "live-chat-interaction",
71
+ /** Restricts (disables) changing the selected agent/model on the conversation top bar. */
72
+ DisallowChangeAgent = "disallow-change-agent",
73
+ /** Hides the new-conversation controls in the header/layout. */
74
+ HideNewConversation = "hide-new-conversation",
75
+ /** Enables the empty-chat (new conversation composer) settings UI. */
76
+ EmptyChatSettings = "empty-chat-settings",
77
+ /** Hides the model selector on the empty-chat composer screen. */
78
+ HideEmptyChatChangeAgent = "hide-empty-chat-change-agent",
79
+ /** Enables the attachments-manager (`AttachmentCanvasProvider`) mount. */
80
+ AttachmentsManager = "attachments-manager",
81
+ /** Enables the conversations-panel toggle button. */
82
+ ConversationsPanelToggle = "conversations-panel-toggle",
83
+ /** Enables the conversations sidebar section. */
84
+ ConversationsSection = "conversations-section",
85
+ /** Enables the app header. */
86
+ Header = "header",
87
+ /** Makes the conversations sidebar section open by default. */
88
+ ShowConversationsSectionByDefault = "showConversationsSectionByDefault",
89
+ /** Enables the catalog (`/catalog`) route. */
90
+ Catalog = "catalog",
91
+ /** Restricts the catalog to hide the current user's own/shared-with-me apps. */
92
+ CatalogHideMyApps = "catalog-hide-my-apps",
93
+ /** Makes the catalog's table view the initial default (instead of grid). */
94
+ CatalogTableView = "catalog-table-view",
95
+ /** Hides the delete action on a user's own messages. */
96
+ HideDeleteUserMessage = "hide-delete-user-message",
97
+ /** Hides the edit action on a user's own messages. */
98
+ HideEditUserMessage = "hide-edit-user-message",
99
+ /** Hides the regenerate action on assistant messages. */
100
+ HideRegenerateAssistantMessage = "hide-regenerate-assistant-message",
101
+ /** Enables the conversation-publishing entry point. */
102
+ ConversationsPublishing = "conversations-publishing",
103
+ /** Enables the application-sharing entry point. */
104
+ ApplicationsSharing = "applications-sharing",
105
+ /** Enables the conversation-sharing entry point. */
106
+ ConversationsSharing = "conversations-sharing",
107
+ /** Enables the toolset-sharing entry point. */
108
+ ToolsetsSharing = "toolsets-sharing",
109
+ /** Enables toolsets functionality. */
110
+ Toolsets = "toolsets",
111
+ /** Hides the user avatar/menu button in the header. */
112
+ HideUserMenu = "hide-user-menu",
113
+ /** Hides the settings entry in the user menu. */
114
+ HideUserSettings = "hide-user-settings",
115
+ /** Enables the `microphone` permission on the iframe's `allow` attribute for voice input. */
116
+ VoiceInput = "voice-input"
117
+ }
118
+ /** Controls how an overlay starts authentication for a configured provider. */
119
+ export declare enum OverlayAuthUiMode {
120
+ /** Opens authentication in a separate browser window or tab. */
121
+ External = "external",
122
+ /** Navigates the embedded overlay window through authentication. */
123
+ SameWindow = "sameWindow"
124
+ }
125
+ /** Machine-readable reasons why an overlay request could not be completed. */
126
+ export declare enum OverlayRequestErrorCode {
127
+ /** The method requires an open conversation, but the composer is currently shown. */
128
+ ActiveConversationUnavailable = "ACTIVE_CONVERSATION_UNAVAILABLE",
129
+ /** The method requires the conversation-list integration, but it is not available. */
130
+ ConversationListUnavailable = "CONVERSATION_LIST_UNAVAILABLE",
131
+ /** The request payload does not match the method contract. */
132
+ InvalidPayload = "INVALID_PAYLOAD",
133
+ /** The embedded chat failed while executing the requested operation. */
134
+ RequestExecutionFailed = "REQUEST_EXECUTION_FAILED"
135
+ }
136
+ /** Structured failure returned for an overlay request. */
137
+ export interface OverlayRequestError {
138
+ /** Stable code suitable for programmatic handling. */
139
+ code: OverlayRequestErrorCode;
140
+ /** Human-readable explanation suitable for logs and diagnostics. */
141
+ message: string;
142
+ }
143
+ /** Minimal message shape carried in overlay protocol payloads. */
144
+ export interface OverlayChatMessage {
145
+ /** Message id. */
146
+ id: string;
147
+ /** Author role, e.g. `'user'`, `'assistant'`, or `'system'`. */
148
+ role: string;
149
+ /** Message text content. */
150
+ content: string;
151
+ }
152
+ /** Host-agnostic conversation projection for the overlay protocol. */
153
+ export interface OverlayConversation {
154
+ /** Conversation id. */
155
+ id: string;
156
+ /** Conversation title. */
157
+ title: string;
158
+ /** Epoch milliseconds of the conversation's last update. */
159
+ updatedAt: number;
160
+ /** Whether the conversation is pinned. */
161
+ isPinned: boolean;
162
+ /** Whether the current user has read-only access. */
163
+ isReadonly: boolean;
164
+ /** Whether the conversation was shared with the current user. */
165
+ sharedWithMe: boolean;
166
+ /** Whether the conversation was published with the current user. */
167
+ publishedWithMe: boolean;
168
+ }
169
+ /** Error signal carried by conversation-list method responses. */
170
+ export interface OverlayConversationError {
171
+ /** `NOT_FOUND` for an unknown/inaccessible id, `FORBIDDEN` for a read-only/shared-without-write-access conversation, `INVALID_ARGUMENT` for a rejected value (e.g. blank rename). */
172
+ code: 'NOT_FOUND' | 'FORBIDDEN' | 'INVALID_ARGUMENT';
173
+ /** Human-readable description of the failure. */
174
+ message: string;
175
+ }
176
+ /** Options passed to `ChatOverlay`'s constructor. */
177
+ export interface ChatOverlayOptions {
178
+ /** Full URL of the chat app instance to embed (origin + optional path). */
179
+ domain: string;
180
+ /** Milliseconds to wait for a request's response before rejecting. Defaults to `10000`. */
181
+ requestTimeout?: number;
182
+ /** Inline CSS properties applied to the loader element while it is visible. */
183
+ loaderStyles?: Record<string, string>;
184
+ /** CSS class applied to the loader element. */
185
+ loaderClass?: string;
186
+ /** Custom HTML rendered inside the loader element, replacing the default spinner. */
187
+ loaderInnerHTML?: string;
188
+ /** Event whose receipt hides the loader. Defaults to `OverlayEventType.Ready`. */
189
+ loaderHideEvent?: OverlayEventType;
190
+ /** Embed-time features to enable, e.g. microphone access for voice input. */
191
+ enabledFeatures?: OverlayFeature[];
192
+ /** Theme name applied to the embedded app. */
193
+ theme?: string;
194
+ /** Deployment/model id to select in the embedded app. */
195
+ modelId?: string;
196
+ /** Conversation id the embedded app should load and display. */
197
+ overlayConversationId?: string;
198
+ /** Per-provider authentication UI behavior configured by the embedding host. */
199
+ auth?: {
200
+ providerUiModes?: Record<string, OverlayAuthUiMode>;
201
+ };
202
+ }
203
+ /** Payload of a `SET_OVERLAY_OPTIONS` request. */
204
+ export interface SetOverlayOptionsPayload {
205
+ /** Origin of the host page, used by the app to target responses/events. */
206
+ hostDomain: string;
207
+ /** Theme name to apply, if provided. */
208
+ theme?: string;
209
+ /** Deployment/model id to select, if provided. */
210
+ modelId?: string;
211
+ /** Conversation id to navigate to and load, if provided. */
212
+ overlayConversationId?: string;
213
+ /**
214
+ * UI-feature keys that replace (not merge with) the app's current effective
215
+ * UI-feature set, if provided. Array only — no comma-separated-string form.
216
+ */
217
+ enabledFeatures?: string[];
218
+ /** Opaque per-provider authentication UI modes supplied by the host. */
219
+ authProviderUiModes?: Record<string, string>;
220
+ }
221
+ /** Payload of a `SEND_MESSAGE` request. */
222
+ export interface SendMessagePayload {
223
+ /** Text content of the message to send. */
224
+ content: string;
225
+ }
226
+ /** Payload of a `SET_INPUT_CONTENT` request. */
227
+ export interface SetInputContentPayload {
228
+ /** Text content to set in the message input. */
229
+ content: string;
230
+ }
231
+ /** Payload of a `SET_SYSTEM_PROMPT` request. */
232
+ export interface SetSystemPromptPayload {
233
+ /** System prompt to persist on the active conversation. */
234
+ systemPrompt: string;
235
+ }
236
+ /** Payload of a `SET_TEMPERATURE` request. */
237
+ export interface SetTemperaturePayload {
238
+ /** Temperature value to persist on the active conversation. */
239
+ temperature: number;
240
+ }
241
+ /** Payload of a `SELECT_CONVERSATION` request. */
242
+ export interface SelectConversationPayload {
243
+ /** Id of the conversation to select. */
244
+ id: string;
245
+ }
246
+ /** Payload of a `DELETE_CONVERSATION` request. */
247
+ export interface DeleteConversationPayload {
248
+ /** Id of the conversation to delete. */
249
+ id: string;
250
+ }
251
+ /** Payload of a `RENAME_CONVERSATION` request. */
252
+ export interface RenameConversationPayload {
253
+ /** Id of the conversation to rename. */
254
+ id: string;
255
+ /** New title for the conversation. */
256
+ newName: string;
257
+ }
258
+ /** Payload of a `CREATE_CONVERSATION` request. */
259
+ export interface CreateConversationPayload {
260
+ /** Deployment/model id to create the conversation with, if given. */
261
+ deploymentId?: string;
262
+ /** Initial message to persist immediately. Omitted/blank opens the composer instead. */
263
+ firstMessage?: string;
264
+ }
265
+ /** Response payload of a `GET_MESSAGES` request. */
266
+ export interface GetMessagesResponse {
267
+ /** Messages in the active conversation. */
268
+ messages: OverlayChatMessage[];
269
+ }
270
+ /** Response payload of a `SEND_MESSAGE` request. */
271
+ export interface SendMessageResponse {
272
+ /** Messages in the active conversation after the send. */
273
+ messages: OverlayChatMessage[];
274
+ }
275
+ /** Response payload of a `SET_SYSTEM_PROMPT` request. */
276
+ export interface SetSystemPromptResponse {
277
+ /** System prompt value that was persisted. */
278
+ systemPrompt: string;
279
+ }
280
+ /** Response payload of a `SET_TEMPERATURE` request. */
281
+ export interface SetTemperatureResponse {
282
+ /** Temperature value that was persisted. */
283
+ temperature: number;
284
+ }
285
+ /** Response payload of a `SET_OVERLAY_OPTIONS` request. */
286
+ export interface SetOverlayOptionsResponse {
287
+ /** Whether the supplied options were applied (`false` only signals a fallback, never a thrown error). */
288
+ applied: boolean;
289
+ }
290
+ /** Response payload of a `GET_CONVERSATIONS` request. */
291
+ export interface GetConversationsResponse {
292
+ /** The current user's conversation list. */
293
+ conversations: OverlayConversation[];
294
+ }
295
+ /** Response payload of a `GET_SELECTED_CONVERSATIONS` request. */
296
+ export interface GetSelectedConversationsResponse {
297
+ /** Currently displayed conversation(s); empty when no conversation is mounted. */
298
+ conversations: OverlayConversation[];
299
+ }
300
+ /** Response payload of a `SELECT_CONVERSATION` request. */
301
+ export interface SelectConversationResponse {
302
+ /** The now-selected conversation's projection, present on success. */
303
+ conversation?: OverlayConversation;
304
+ /** Present when the selection failed. */
305
+ error?: OverlayConversationError;
306
+ }
307
+ /** Response payload of a `CREATE_CONVERSATION` request. */
308
+ export interface CreateConversationResponse {
309
+ /** The created conversation's projection, or `null` when the composer path was taken. */
310
+ conversation: OverlayConversation | null;
311
+ /** Present when creation failed. */
312
+ error?: OverlayConversationError;
313
+ }
314
+ /** Response payload of a `CREATE_LOCAL_CONVERSATION` request. */
315
+ export interface CreateLocalConversationResponse {
316
+ /** Always `null` — the composer opens without persisting anything. */
317
+ conversation: null;
318
+ }
319
+ /** Response payload of a `DELETE_CONVERSATION` request. */
320
+ export interface DeleteConversationResponse {
321
+ /** Present when deletion failed. */
322
+ error?: OverlayConversationError;
323
+ }
324
+ /** Response payload of a `RENAME_CONVERSATION` request. */
325
+ export interface RenameConversationResponse {
326
+ /** The renamed conversation's projection, present on success. */
327
+ conversation?: OverlayConversation;
328
+ /** Present when the rename failed. */
329
+ error?: OverlayConversationError;
330
+ }
331
+ /**
332
+ * A request message sent from the host (library) to the embedded app.
333
+ * `type` is always `'${OverlayRequestType}'`.
334
+ */
335
+ export interface OverlayMessageRequest<TPayload = unknown> {
336
+ /** Full wire type string, one of the `OverlayRequestType` values. */
337
+ type: `${OverlayRequestType}`;
338
+ /** Unique id used to match this request to its response. */
339
+ requestId: string;
340
+ /**
341
+ * Epoch milliseconds after which the embedded app must stop waiting for
342
+ * prerequisites (such as an active conversation bridge) and drop the request.
343
+ */
344
+ expiresAt?: number;
345
+ /** Request-specific payload. */
346
+ payload?: TPayload;
347
+ }
348
+ /**
349
+ * A response message sent from the embedded app to the host (library),
350
+ * answering a specific request by `requestId`.
351
+ */
352
+ export interface OverlayMessageResponse<TPayload = unknown> {
353
+ /** Full wire type string, always `'${OverlayRequestType}/RESPONSE'`. */
354
+ type: `${OverlayRequestType}/RESPONSE`;
355
+ /** `requestId` of the request this message answers. */
356
+ requestId: string;
357
+ /** Response-specific payload. */
358
+ payload?: TPayload;
359
+ /** Present when the embedded chat could not complete the request. */
360
+ error?: OverlayRequestError;
361
+ }
362
+ /**
363
+ * An event message sent from the embedded app to the host (library),
364
+ * with no associated request (no `requestId` field).
365
+ */
366
+ export interface OverlayMessageEvent<TPayload = unknown> {
367
+ /** Full wire type string, one of the `OverlayEventType` values. */
368
+ type: `${OverlayEventType}`;
369
+ /** Event-specific payload. */
370
+ payload?: TPayload;
371
+ }
372
+ /** Narrows an arbitrary value to a well-formed `OverlayMessageRequest`. */
373
+ export declare const isOverlayMessageRequest: (data: unknown) => data is OverlayMessageRequest;
374
+ /** Narrows an arbitrary value to a well-formed `OverlayMessageResponse`. */
375
+ export declare const isOverlayMessageResponse: (data: unknown) => data is OverlayMessageResponse;
376
+ /** Narrows an arbitrary value to a well-formed `OverlayMessageEvent`. */
377
+ export declare const isOverlayMessageEvent: (data: unknown) => data is OverlayMessageEvent;
378
+ //# sourceMappingURL=overlay-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-protocol.d.ts","sourceRoot":"","sources":["../../src/protocol/overlay-protocol.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAEtD,mEAAmE;AACnE,oBAAY,kBAAkB;IAC5B,gDAAgD;IAChD,WAAW,+BAA+B;IAC1C,qDAAqD;IACrD,WAAW,+BAA+B;IAC1C,yDAAyD;IACzD,eAAe,oCAAoC;IACnD,mDAAmD;IACnD,eAAe,oCAAoC;IACnD,iDAAiD;IACjD,cAAc,kCAAkC;IAChD,2EAA2E;IAC3E,iBAAiB,sCAAsC;IACvD,kDAAkD;IAClD,gBAAgB,oCAAoC;IACpD,8DAA8D;IAC9D,wBAAwB,6CAA6C;IACrE,0DAA0D;IAC1D,kBAAkB,sCAAsC;IACxD,qFAAqF;IACrF,kBAAkB,sCAAsC;IACxD,kEAAkE;IAClE,uBAAuB,4CAA4C;IACnE,mCAAmC;IACnC,kBAAkB,sCAAsC;IACxD,mCAAmC;IACnC,kBAAkB,sCAAsC;CACzD;AAED,8DAA8D;AAC9D,oBAAY,gBAAgB;IAC1B,iEAAiE;IACjE,SAAS,6BAA6B;IACtC,uDAAuD;IACvD,KAAK,wBAAwB;IAC7B,4FAA4F;IAC5F,eAAe,oCAAoC;IACnD,0FAA0F;IAC1F,0BAA0B,+CAA+C;IACzE,iEAAiE;IACjE,kBAAkB,uCAAuC;IACzD,oEAAoE;IACpE,gBAAgB,qCAAqC;IACrD,gEAAgE;IAChE,cAAc,kCAAkC;IAChD,yDAAyD;IACzD,oBAAoB,wCAAwC;CAC7D;AAED,iGAAiG;AACjG,oBAAY,cAAc;IACxB,oDAAoD;IACpD,QAAQ,cAAc;IACtB,4EAA4E;IAC5E,kBAAkB,wBAAwB;IAC1C,mEAAmE;IACnE,qBAAqB,6BAA6B;IAClD,8EAA8E;IAC9E,YAAY,kBA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AAC,EAAE,QAAQ,CAAC;CACpB;AAED,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,GAClC,MAAM,OAAO,KACZ,IAAI,IAAI,qBAaV,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,GACnC,MAAM,OAAO,KACZ,IAAI,IAAI,sBA8BV,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,GAChC,MAAM,OAAO,KACZ,IAAI,IAAI,mBAUV,CAAC"}
package/protocol.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './protocol/overlay-protocol';
2
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}