@epam/ai-dial-visualizer-connector 1.3.0-dev.96 → 1.3.0-rc.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/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
+ export { ChatVisualizerConnector, type ChatVisualizerEventType, } from './lib/ChatVisualizerConnector';
1
2
  export { VisualizerConnector } from './lib/VisualizerConnector';
2
- export type { VisualizerConnectorLoaderStyles, VisualizerConnectorOptions, VisualizerConnectorRequest, } from './models/visualizer-connector';
3
- export { VisualizerConnectorEvents, VisualizerConnectorRequests, } from './types/visualizer-connector';
3
+ export { AppsEditorHost, type AppsEditorHostOptions, } from './lib/AppsEditorHost';
4
+ export { AppsEditorClient, type AppsEditorClientOptions, } from './lib/AppsEditorClient';
5
+ export { parseAppsEditorClientMessage, parseAppsEditorHostMessage, serializeAppsEditorClientMessage, } from './lib/apps-editor-protocol';
6
+ export type { AppsEditorClientMessage, AppsEditorHostMessage, AppsEditorTriggerSaveMessage, AppsEditorToolsetResultMessage, AppsEditorLifecycleMessage, AppsEditorUpdatedMessage, AppsEditorSaveSuccessMessage, AppsEditorSaveErrorMessage, AppsEditorValidityMessage, AppsEditorDirtyMessage, AppsEditorToolsetRequestMessage, AppsEditorCredentialsRequestMessage, AppsEditorExternalServiceLoginRequestMessage, AppsEditorExternalServiceLoginResultMessage, } from './models/apps-editor';
7
+ export type { AppsEditorMessage, ChatVisualizerCallbacks, VisualizerAttachmentData, VisualizerGroupedAttachmentItem, VisualizerGroupedAttachmentsData, VisualizerConnectorLoaderStyles, VisualizerConnectorOptions, VisualizerConnectorRequest, } from './models/visualizer-connector';
8
+ export { AppsEditorEvents, AppsEditorMessages, VisualizerConnectorEvents, VisualizerConnectorRequests, } from './types/visualizer-connector';
4
9
  //# 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,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,uBAAuB,EACvB,qBAAqB,EACrB,4BAA4B,EAC5B,8BAA8B,EAC9B,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,EACtB,+BAA+B,EAC/B,mCAAmC,EACnC,4CAA4C,EAC5C,2CAA2C,GAC5C,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC"}
package/index.js CHANGED
@@ -3,24 +3,111 @@ var e = /* @__PURE__ */ function(e) {
3
3
  return e.SendVisualizeData = "SEND_VISUALIZE_DATA", e.SendGroupedVisualizeData = "SEND_GROUPED_VISUALIZE_DATA", e.SetVisualizerOptions = "SET_VISUALIZER_OPTIONS", e;
4
4
  }({}), t = /* @__PURE__ */ function(e) {
5
5
  return e.InitReady = "INIT_READY", e.Ready = "READY", e.ReadyToInteract = "READY_TO_INTERACT", e.SendMessage = "SEND_MESSAGE", e.CreatedConversationSuccess = "CREATED_CONVERSATION_SUCCESS", e.UpdatedConversationSuccess = "UPDATED_CONVERSATION_SUCCESS", e.UpdatedApplicationSuccess = "UPDATED_APPLICATION_SUCCESS", e;
6
- }({}), n = "<svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M24 39V46.5\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.4\" d=\"M9 24H1.5\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.5\" d=\"M8.0918 8.0918L13.3994 13.3994\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.6\" d=\"M24 1.5V9\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.7\" d=\"M39.9121 8.08594L37.2607 10.7373L34.6094 13.3887\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.8\" d=\"M46.5 24H39\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.9\" d=\"M34.6055 34.6055L39.9082 39.9082\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.3\" d=\"M13.3936 34.6055L8.08594 39.9131\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<animateTransform attributeName=\"transform\" attributeType=\"XML\" type=\"rotate\" from=\"0 0 0\" to=\"360 0 0\" dur=\"1s\" repeatCount=\"indefinite\" />\n</svg>\n", r = 1e4, i = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
6
+ }({}), n = /* @__PURE__ */ function(e) {
7
+ return e.ReadyToInteract = "readyToInteract", e.ReadyToSave = "readyToSave", e.LoggedOut = "loggedOut", e.UpdatedApplicationSuccess = "updatedApplicationSuccess", e;
8
+ }({}), r = /* @__PURE__ */ function(e) {
9
+ return e.TriggerSave = "TRIGGER_SAVE", e.SaveSuccess = "SAVE_SUCCESS", e.SaveError = "SAVE_ERROR", e.ValidityState = "VALIDITY_STATE", e.DirtyState = "DIRTY_STATE", e.RequestToolsetLogin = "REQUEST_TOOLSET_LOGIN", e.ToolsetLoginResult = "TOOLSET_LOGIN_RESULT", e.RequestToolsetLogout = "REQUEST_TOOLSET_LOGOUT", e.ToolsetLogoutResult = "TOOLSET_LOGOUT_RESULT", e.RequestApplicationCredentials = "REQUEST_APPLICATION_CREDENTIALS", e.RequestExternalServiceLogin = "REQUEST_EXTERNAL_SERVICE_LOGIN", e.ExternalServiceLoginResult = "EXTERNAL_SERVICE_LOGIN_RESULT", e;
10
+ }({}), i = "*", a = new Set(Object.values(r)), o = "/RESPONSE", s = (e) => typeof e == "object" && !!e, c = (e, t) => t.every((t) => Object.prototype.hasOwnProperty.call(e, t)), l = (e) => {
11
+ let t = e.length;
12
+ for (; t > 0 && e[t - 1] === "/";) t--;
13
+ return e.slice(0, t);
14
+ }, u = class {
15
+ dialHosts;
16
+ dialHost;
17
+ appName;
18
+ callbacks;
19
+ constructor(e, t, n) {
20
+ let r = (Array.isArray(e) ? e : [e]).map(l);
21
+ if (!r.length) throw Error("[ChatVisualizerConnector] No dial host(s) provided");
22
+ this.dialHosts = r, this.dialHost = r[0], this.appName = t, this.callbacks = typeof n == "function" ? { onData: n } : n, window.addEventListener("message", this.postMessageListener, !1);
23
+ }
24
+ send({ type: e, payload: t, dialHost: n }) {
25
+ if (!window?.parent) throw Error(`[${this.appName}] There is no parent window to send requests`);
26
+ (n ? [n] : this.dialHosts).forEach((n) => {
27
+ window.parent.postMessage({
28
+ type: `${this.appName}/${e}`,
29
+ payload: t
30
+ }, n);
31
+ });
32
+ }
33
+ sendEditorMessage(e, t) {
34
+ if (!window?.parent) throw Error(`[${this.appName}] There is no parent window to send requests`);
35
+ (t ? [t] : this.dialHosts).forEach((t) => window.parent.postMessage(e, t));
36
+ }
37
+ sendPMResponse({ type: e, requestId: t, payload: n, dialHost: r }) {
38
+ window?.parent.postMessage({
39
+ type: `${e}${o}`,
40
+ requestId: t,
41
+ payload: n
42
+ }, r);
43
+ }
44
+ postMessageListener = (t) => {
45
+ if (t.source === window || !this.isAllowedOrigin(t.origin)) return;
46
+ let { data: n } = t;
47
+ if (!s(n) || typeof n.type != "string") return;
48
+ if (a.has(n.type)) {
49
+ this.callbacks.onEditorMessage?.(n, t.origin);
50
+ return;
51
+ }
52
+ if (!n.type.startsWith(`${this.appName}/`) || n.type.endsWith(o)) return;
53
+ let r = s(n.payload) ? n.payload : null;
54
+ switch (n.type.slice(this.appName.length + 1)) {
55
+ case e.SendVisualizeData:
56
+ r && c(r, ["visualizerData"]) && this.callbacks.onData?.(r);
57
+ break;
58
+ case e.SendGroupedVisualizeData:
59
+ r && c(r, ["attachments", "layout"]) && this.callbacks.onGroupedData?.(r);
60
+ break;
61
+ default: if (n.requestId === void 0) return;
62
+ }
63
+ this.sendPMResponse({
64
+ type: n.type,
65
+ requestId: n.requestId,
66
+ dialHost: t.origin
67
+ });
68
+ };
69
+ sendReady() {
70
+ this.send({ type: t.Ready });
71
+ }
72
+ sendReadyToInteract() {
73
+ this.send({ type: t.ReadyToInteract });
74
+ }
75
+ sendReadyToSave() {
76
+ this.send({ type: n.ReadyToSave });
77
+ }
78
+ sendLoggedOut() {
79
+ this.send({ type: n.LoggedOut });
80
+ }
81
+ async sendMessage(e) {
82
+ this.send({
83
+ type: t.SendMessage,
84
+ payload: { message: e }
85
+ });
86
+ }
87
+ destroy() {
88
+ window.removeEventListener("message", this.postMessageListener);
89
+ }
90
+ isAllowedOrigin(e) {
91
+ return this.dialHosts[0] === i || this.dialHosts.includes(e);
92
+ }
93
+ }, d = 1e4, f = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
7
94
  let t = Math.random() * 16 | 0;
8
95
  return (e === "x" ? t : t & 3 | 8).toString(16);
9
- }), a = class {
96
+ }), p = class {
10
97
  type;
11
98
  payload;
12
99
  promise;
13
- requestId = i();
100
+ requestId = f();
14
101
  resolveFn;
15
102
  timeoutHandle;
16
103
  replied = !1;
17
- constructor(e, t, n, i) {
104
+ constructor(e, t, n, r) {
18
105
  this.type = e, this.payload = t;
19
- let a = n || r;
106
+ let i = n || d;
20
107
  this.promise = new Promise((t, n) => {
21
108
  this.resolveFn = t, this.timeoutHandle = setTimeout(() => {
22
- n(`[${i}] Request ${e} failed. Timeout ${a}`);
23
- }, a);
109
+ n(`[${r}] Request ${e} failed. Timeout ${i}`);
110
+ }, i);
24
111
  });
25
112
  }
26
113
  get isReplied() {
@@ -39,12 +126,12 @@ var e = /* @__PURE__ */ function(e) {
39
126
  requestId: this.requestId
40
127
  };
41
128
  }
42
- }, o = (e, t) => {
129
+ }, m = (e, t) => {
43
130
  for (let n of Object.keys(t)) {
44
131
  let r = t[n];
45
132
  r && (e.style[n] = r);
46
133
  }
47
- }, s = class {
134
+ }, h = class {
48
135
  promise;
49
136
  resolveFn;
50
137
  rejectFn;
@@ -63,7 +150,7 @@ var e = /* @__PURE__ */ function(e) {
63
150
  ready() {
64
151
  return this.promise;
65
152
  }
66
- }, c = "VisualizerConnector", l = "Chat Visualizer destroyed", u = [
153
+ }, g = "VisualizerConnector", _ = "Chat Visualizer destroyed", v = [
67
154
  "allow-same-origin",
68
155
  "allow-scripts",
69
156
  "allow-modals",
@@ -71,18 +158,18 @@ var e = /* @__PURE__ */ function(e) {
71
158
  "allow-downloads",
72
159
  "allow-popups",
73
160
  "allow-presentation"
74
- ], d = "clipboard-write *; fullscreen *; accelerometer *; gyroscope *; autoplay *; web-share *; encrypted-media *", f = class {
161
+ ], y = "clipboard-write *; fullscreen *; accelerometer *; gyroscope *; autoplay *; web-share *; encrypted-media *", b = class {
75
162
  root;
76
163
  subscriptions = [];
77
164
  iframe;
78
165
  loader;
79
166
  loaderDisplayCss = "flex";
80
- iframeInteraction = new s();
167
+ iframeInteraction = new h();
81
168
  requests = [];
82
169
  options;
83
170
  isDestroyed = !1;
84
171
  constructor(e, t) {
85
- this.options = t, this.root = this.getRoot(e), this.iframe = this.initIframe(), this.loader = this.initLoader(t.loaderStyles ?? {}, t.loaderClass, t.loaderInnerHTML), this.root.appendChild(this.loader), this.root.appendChild(this.iframe), o(this.root, { position: "relative" }), this.showLoader(), window.addEventListener("message", this.process);
172
+ this.options = t, this.root = this.getRoot(e), this.iframe = this.initIframe(), this.loader = this.initLoader(t.loaderStyles ?? {}, t.loaderClass, t.loaderInnerHTML), this.root.appendChild(this.loader), this.root.appendChild(this.iframe), m(this.root, { position: "relative" }), this.showLoader(), window.addEventListener("message", this.process);
86
173
  }
87
174
  async ready() {
88
175
  return this.iframeInteraction.ready();
@@ -91,12 +178,12 @@ var e = /* @__PURE__ */ function(e) {
91
178
  if (n) try {
92
179
  await this.iframeInteraction.ready();
93
180
  } catch (e) {
94
- if (e === l) return;
181
+ if (e === _) return;
95
182
  throw e;
96
183
  }
97
184
  let r = this.iframe.contentWindow;
98
185
  if (!this.iframe.isConnected || !r) return;
99
- let i = new a(`${this.options.visualizerName}/${e}`, t, this.options.requestTimeout, c);
186
+ let i = new p(`${this.options.visualizerName}/${e}`, t, this.options.requestTimeout, g);
100
187
  return this.requests.push(i), r.postMessage(i.toPostMessage(), this.options.domain), i.promise;
101
188
  }
102
189
  subscribe(e, t) {
@@ -111,15 +198,15 @@ var e = /* @__PURE__ */ function(e) {
111
198
  this.options = e;
112
199
  }
113
200
  destroy() {
114
- this.isDestroyed || (this.isDestroyed = !0, window.removeEventListener("message", this.process), this.iframeInteraction.ready().catch(() => void 0), this.iframeInteraction.fail(l), this.iframe.remove(), this.loader.remove());
201
+ this.isDestroyed || (this.isDestroyed = !0, window.removeEventListener("message", this.process), this.iframeInteraction.ready().catch(() => void 0), this.iframeInteraction.fail(_), this.iframe.remove(), this.loader.remove());
115
202
  }
116
203
  initIframe() {
117
204
  let e = document.createElement("iframe");
118
- return e.src = this.options.domain, e.setAttribute("sandbox", u.join(" ")), e.setAttribute("allow", d), e.style.height = "100%", e.style.width = "100%", e.style.border = "none", e.loading = "lazy", e;
205
+ return e.src = this.options.domain, e.setAttribute("sandbox", v.join(" ")), e.setAttribute("allow", y), e.style.height = "100%", e.style.width = "100%", e.style.border = "none", e.loading = "lazy", e;
119
206
  }
120
- initLoader(e, t, r) {
121
- let i = document.createElement("div");
122
- return i.innerHTML = r ?? n, t && (i.className = t), e.display && (this.loaderDisplayCss = e.display), o(i, {
207
+ initLoader(e, t, n) {
208
+ let r = document.createElement("div");
209
+ return r.innerHTML = n ?? "<svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M24 39V46.5\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.4\" d=\"M9 24H1.5\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.5\" d=\"M8.0918 8.0918L13.3994 13.3994\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.6\" d=\"M24 1.5V9\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.7\" d=\"M39.9121 8.08594L37.2607 10.7373L34.6094 13.3887\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.8\" d=\"M46.5 24H39\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.9\" d=\"M34.6055 34.6055L39.9082 39.9082\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path opacity=\"0.3\" d=\"M13.3936 34.6055L8.08594 39.9131\" stroke=\"#7F8792\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<animateTransform attributeName=\"transform\" attributeType=\"XML\" type=\"rotate\" from=\"0 0 0\" to=\"360 0 0\" dur=\"1s\" repeatCount=\"indefinite\" />\n</svg>\n", t && (r.className = t), e.display && (this.loaderDisplayCss = e.display), m(r, {
123
210
  position: "absolute",
124
211
  background: "white",
125
212
  display: this.loaderDisplayCss,
@@ -131,12 +218,12 @@ var e = /* @__PURE__ */ function(e) {
131
218
  bottom: "0",
132
219
  zIndex: "2",
133
220
  ...e
134
- }), i;
221
+ }), r;
135
222
  }
136
223
  getRoot(e) {
137
224
  if (typeof e != "string") return e;
138
225
  let t = document.querySelector(e);
139
- if (!t) throw Error(`[${c}] There is no element with selector ${e} to append iframe`);
226
+ if (!t) throw Error(`[${g}] There is no element with selector ${e} to append iframe`);
140
227
  return t;
141
228
  }
142
229
  process = (e) => {
@@ -152,21 +239,219 @@ var e = /* @__PURE__ */ function(e) {
152
239
  return;
153
240
  }
154
241
  let { requestId: i, payload: a } = e.data;
155
- if (!i) {
156
- this.processEvent(n, a);
157
- return;
158
- }
159
- this.requests.find((e) => e.match(n, i))?.reply(a), this.requests = this.requests.filter((e) => !e.isReplied);
242
+ i ? (this.requests.find((e) => e.match(n, i))?.reply(a), this.requests = this.requests.filter((e) => !e.isReplied)) : this.processEvent(n, a);
160
243
  };
161
244
  processEvent(e, t) {
162
245
  for (let n of this.subscriptions) n.eventType === e && n.callback(t);
163
246
  }
164
247
  showLoader() {
165
- o(this.loader, { display: this.loaderDisplayCss });
248
+ m(this.loader, { display: this.loaderDisplayCss });
166
249
  }
167
250
  hideLoader() {
168
- o(this.loader, { display: "none" });
251
+ m(this.loader, { display: "none" });
252
+ }
253
+ }, x = (e) => typeof e == "object" && !!e && !Array.isArray(e), S = (e) => typeof e == "string" && e.length > 0, C = (e) => {
254
+ let t = new URL(e).origin;
255
+ if (t === "null") throw Error("An application editor requires a non-opaque origin");
256
+ return t;
257
+ }, w = (e, t) => {
258
+ if (!x(e)) return null;
259
+ let i = x(e.payload) ? e.payload : void 0;
260
+ switch (e.type) {
261
+ case `${t}/${n.ReadyToInteract}`: return { type: n.ReadyToInteract };
262
+ case `${t}/${n.ReadyToSave}`: return { type: n.ReadyToSave };
263
+ case `${t}/${n.LoggedOut}`: return { type: n.LoggedOut };
264
+ case `${t}/${n.UpdatedApplicationSuccess}`: return {
265
+ type: n.UpdatedApplicationSuccess,
266
+ ...i ? { payload: { application: i.application } } : {}
267
+ };
268
+ case r.SaveSuccess: return {
269
+ type: r.SaveSuccess,
270
+ hasChanges: e.hasChanges === !0
271
+ };
272
+ case r.SaveError: {
273
+ let t = e.error ?? i?.error ?? "";
274
+ return typeof t == "string" ? {
275
+ type: r.SaveError,
276
+ error: t
277
+ } : null;
278
+ }
279
+ case r.ValidityState: return typeof i?.isValid == "boolean" ? {
280
+ type: r.ValidityState,
281
+ payload: { isValid: i.isValid }
282
+ } : null;
283
+ case r.DirtyState: {
284
+ let t = i?.isDirty ?? e.isDirty;
285
+ return typeof t == "boolean" ? {
286
+ type: r.DirtyState,
287
+ payload: { isDirty: t }
288
+ } : null;
289
+ }
290
+ case r.RequestToolsetLogin:
291
+ case r.RequestToolsetLogout: return S(e.toolsetId) ? {
292
+ type: e.type,
293
+ toolsetId: e.toolsetId
294
+ } : null;
295
+ case r.RequestApplicationCredentials: return S(e.appId) ? {
296
+ type: e.type,
297
+ appId: e.appId
298
+ } : null;
299
+ case r.RequestExternalServiceLogin: return S(e.appId) && S(e.serviceId) && typeof e.offlineUsageConsent == "boolean" ? {
300
+ type: e.type,
301
+ appId: e.appId,
302
+ serviceId: e.serviceId,
303
+ offlineUsageConsent: e.offlineUsageConsent
304
+ } : null;
305
+ default: return null;
306
+ }
307
+ }, T = (e) => {
308
+ if (!x(e)) return null;
309
+ switch (e.type) {
310
+ case r.TriggerSave: return {
311
+ type: e.type,
312
+ general: e.general
313
+ };
314
+ case r.ToolsetLoginResult:
315
+ case r.ToolsetLogoutResult: {
316
+ let { toolsetId: t, success: n, credentialsLevel: r, reason: i, credentials: a } = e;
317
+ return !S(t) || typeof n != "boolean" || r !== void 0 && typeof r != "string" || i !== void 0 && typeof i != "string" ? null : {
318
+ type: e.type,
319
+ toolsetId: t,
320
+ success: n,
321
+ credentialsLevel: r,
322
+ reason: i,
323
+ credentials: a
324
+ };
325
+ }
326
+ case r.ExternalServiceLoginResult: {
327
+ let { appId: t, serviceId: n, success: r, reason: i } = e;
328
+ return !S(t) || !S(n) || typeof r != "boolean" || i !== void 0 && typeof i != "string" ? null : {
329
+ type: e.type,
330
+ appId: t,
331
+ serviceId: n,
332
+ success: r,
333
+ reason: i
334
+ };
335
+ }
336
+ default: return null;
337
+ }
338
+ }, E = (e, t) => {
339
+ switch (e.type) {
340
+ case n.ReadyToInteract:
341
+ case n.ReadyToSave:
342
+ case n.LoggedOut:
343
+ case n.UpdatedApplicationSuccess: return {
344
+ ...e,
345
+ type: `${t}/${e.type}`
346
+ };
347
+ default: return e;
348
+ }
349
+ }, D = class {
350
+ targetWindow;
351
+ targetOrigin;
352
+ applicationName;
353
+ onMessage;
354
+ onActivity;
355
+ isDestroyed = !1;
356
+ constructor(e) {
357
+ this.targetWindow = e.targetWindow, this.targetOrigin = C(e.targetOrigin), this.applicationName = e.applicationName, this.onMessage = e.onMessage, this.onActivity = e.onActivity, window.addEventListener("message", this.handleMessage);
358
+ }
359
+ handleMessage = (e) => {
360
+ if (this.isDestroyed || e.source !== this.targetWindow || e.origin !== this.targetOrigin || (this.onActivity?.(), this.isDestroyed)) return;
361
+ let t = w(e.data, this.applicationName);
362
+ t && this.onMessage(t);
363
+ };
364
+ send(e) {
365
+ this.isDestroyed || this.targetWindow.postMessage(e, this.targetOrigin);
366
+ }
367
+ destroy() {
368
+ this.isDestroyed || (this.isDestroyed = !0, window.removeEventListener("message", this.handleMessage));
369
+ }
370
+ }, O = class {
371
+ hostWindow;
372
+ hostOrigin;
373
+ applicationName;
374
+ onMessage;
375
+ isDestroyed = !1;
376
+ constructor(e) {
377
+ this.hostWindow = e.hostWindow ?? window.parent, this.hostOrigin = C(e.hostOrigin), this.applicationName = e.applicationName, this.onMessage = e.onMessage, window.addEventListener("message", this.handleMessage);
378
+ }
379
+ handleMessage = (e) => {
380
+ if (this.isDestroyed || e.source !== this.hostWindow || e.origin !== this.hostOrigin) return;
381
+ let t = T(e.data);
382
+ t && this.onMessage?.(t);
383
+ };
384
+ send(e) {
385
+ this.isDestroyed || this.hostWindow.postMessage(E(e, this.applicationName), this.hostOrigin);
386
+ }
387
+ sendReadyToInteract() {
388
+ this.send({ type: n.ReadyToInteract });
389
+ }
390
+ sendReadyToSave() {
391
+ this.send({ type: n.ReadyToSave });
392
+ }
393
+ sendLoggedOut() {
394
+ this.send({ type: n.LoggedOut });
395
+ }
396
+ sendUpdatedApplication(e) {
397
+ this.send({
398
+ type: n.UpdatedApplicationSuccess,
399
+ payload: { application: e }
400
+ });
401
+ }
402
+ sendSaveSuccess(e = !1) {
403
+ this.send({
404
+ type: r.SaveSuccess,
405
+ hasChanges: e
406
+ });
407
+ }
408
+ sendSaveError(e) {
409
+ this.send({
410
+ type: r.SaveError,
411
+ error: e
412
+ });
413
+ }
414
+ sendValidityState(e) {
415
+ this.send({
416
+ type: r.ValidityState,
417
+ payload: { isValid: e }
418
+ });
419
+ }
420
+ sendDirtyState(e) {
421
+ this.send({
422
+ type: r.DirtyState,
423
+ payload: { isDirty: e }
424
+ });
425
+ }
426
+ requestToolsetLogin(e) {
427
+ this.send({
428
+ type: r.RequestToolsetLogin,
429
+ toolsetId: e
430
+ });
431
+ }
432
+ requestToolsetLogout(e) {
433
+ this.send({
434
+ type: r.RequestToolsetLogout,
435
+ toolsetId: e
436
+ });
437
+ }
438
+ requestApplicationCredentials(e) {
439
+ this.send({
440
+ type: r.RequestApplicationCredentials,
441
+ appId: e
442
+ });
443
+ }
444
+ requestExternalServiceLogin(e, t, n) {
445
+ this.send({
446
+ type: r.RequestExternalServiceLogin,
447
+ appId: e,
448
+ serviceId: t,
449
+ offlineUsageConsent: n.offlineUsageConsent
450
+ });
451
+ }
452
+ destroy() {
453
+ this.isDestroyed || (this.isDestroyed = !0, window.removeEventListener("message", this.handleMessage));
169
454
  }
170
455
  };
171
456
  //#endregion
172
- export { f as VisualizerConnector, t as VisualizerConnectorEvents, e as VisualizerConnectorRequests };
457
+ export { O as AppsEditorClient, n as AppsEditorEvents, D as AppsEditorHost, r as AppsEditorMessages, u as ChatVisualizerConnector, b as VisualizerConnector, t as VisualizerConnectorEvents, e as VisualizerConnectorRequests, w as parseAppsEditorClientMessage, T as parseAppsEditorHostMessage, E as serializeAppsEditorClientMessage };
@@ -0,0 +1,57 @@
1
+ import { AppsEditorClientMessage, AppsEditorHostMessage } from '../models/apps-editor';
2
+ /** Endpoint and callbacks for the application running inside an editor iframe. */
3
+ export interface AppsEditorClientOptions {
4
+ /** The hosting window. Defaults to window.parent. */
5
+ hostWindow?: Window;
6
+ /** The host's absolute origin or URL; wildcard and opaque origins are rejected. */
7
+ hostOrigin: string;
8
+ /** Namespace shared with the host for lifecycle events. */
9
+ applicationName: string;
10
+ /** Receives validated host messages; application-specific general and credentials remain unknown. */
11
+ onMessage?: (message: AppsEditorHostMessage) => void;
12
+ }
13
+ /** Sends editor lifecycle events and receives host messages without announcing readiness automatically. */
14
+ export declare class AppsEditorClient {
15
+ private readonly hostWindow;
16
+ private readonly hostOrigin;
17
+ private readonly applicationName;
18
+ private readonly onMessage;
19
+ private isDestroyed;
20
+ /** Starts listening for messages from the configured host endpoint. */
21
+ constructor(options: AppsEditorClientOptions);
22
+ private handleMessage;
23
+ /** Posts an editor message using the shared wire format; does nothing after destroy(). */
24
+ send(message: AppsEditorClientMessage): void;
25
+ /** Reports that the editor's interface has rendered. */
26
+ sendReadyToInteract(): void;
27
+ /** Reports that the editor's application model is loaded and safe to save. */
28
+ sendReadyToSave(): void;
29
+ /** Reports that the editor's session is signed out. */
30
+ sendLoggedOut(): void;
31
+ /** Reports an intermediate application update, with optional application data. */
32
+ sendUpdatedApplication(application?: unknown): void;
33
+ /** Reports a successful save; hasChanges defaults to false. */
34
+ sendSaveSuccess(hasChanges?: boolean): void;
35
+ /** Reports a failed save with an application-provided explanation. */
36
+ sendSaveError(error: string): void;
37
+ /** Reports whether the editor's current form values are valid. */
38
+ sendValidityState(isValid: boolean): void;
39
+ /** Reports whether the editor has unsaved changes. */
40
+ sendDirtyState(isDirty: boolean): void;
41
+ /** Requests host-managed authentication for a toolset. */
42
+ requestToolsetLogin(toolsetId: string): void;
43
+ /** Requests host-managed logout for a toolset. */
44
+ requestToolsetLogout(toolsetId: string): void;
45
+ /** Requests the host's credential form for an application. */
46
+ requestApplicationCredentials(appId: string): void;
47
+ /**
48
+ * Requests a host-run, user-level sign-in to one external service of an application. `offlineUsageConsent`
49
+ * is the person's choice collected by the editor; the host answers with `ExternalServiceLoginResult`.
50
+ */
51
+ requestExternalServiceLogin(appId: string, serviceId: string, options: {
52
+ offlineUsageConsent: boolean;
53
+ }): void;
54
+ /** Stops receiving and sending messages; repeated calls are harmless. */
55
+ destroy(): void;
56
+ }
57
+ //# sourceMappingURL=AppsEditorClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppsEditorClient.d.ts","sourceRoot":"","sources":["../../src/lib/AppsEditorClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAW/B,kFAAkF;AAClF,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB,qGAAqG;IACrG,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACtD;AAED,2GAA2G;AAC3G,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuC;IACjE,OAAO,CAAC,WAAW,CAAS;IAE5B,uEAAuE;gBAC3D,OAAO,EAAE,uBAAuB;IAQ5C,OAAO,CAAC,aAAa,CAWnB;IAEF,0FAA0F;IAC1F,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAQ5C,wDAAwD;IACxD,mBAAmB,IAAI,IAAI;IAI3B,8EAA8E;IAC9E,eAAe,IAAI,IAAI;IAIvB,uDAAuD;IACvD,aAAa,IAAI,IAAI;IAIrB,kFAAkF;IAClF,sBAAsB,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAOnD,+DAA+D;IAC/D,eAAe,CAAC,UAAU,UAAQ,GAAG,IAAI;IAIzC,sEAAsE;IACtE,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIlC,kEAAkE;IAClE,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC,sDAAsD;IACtD,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAItC,0DAA0D;IAC1D,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5C,kDAAkD;IAClD,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI7C,8DAA8D;IAC9D,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOlD;;;OAGG;IACH,2BAA2B,CACzB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;QAAE,mBAAmB,EAAE,OAAO,CAAA;KAAE,GACxC,IAAI;IASP,yEAAyE;IACzE,OAAO,IAAI,IAAI;CAKhB"}
@@ -0,0 +1,31 @@
1
+ import { AppsEditorClientMessage, AppsEditorHostMessage } from '../models/apps-editor';
2
+ /** Endpoint and callbacks for an application editor hosted in an existing iframe. */
3
+ export interface AppsEditorHostOptions {
4
+ /** The editor iframe's content window. */
5
+ targetWindow: Window;
6
+ /** The editor's absolute origin or URL; wildcard and opaque origins are rejected. */
7
+ targetOrigin: string;
8
+ /** Namespace shared with the editor for lifecycle events. */
9
+ applicationName: string;
10
+ /** Receives validated editor messages with unprefixed lifecycle event types. */
11
+ onMessage: (message: AppsEditorClientMessage) => void;
12
+ /** Receives any message from the configured window and origin, including unknown messages. */
13
+ onActivity?: () => void;
14
+ }
15
+ /** Exchanges typed editor messages with an existing iframe without managing its DOM or readiness. */
16
+ export declare class AppsEditorHost<TGeneral = unknown, TCredentials = unknown> {
17
+ private readonly targetWindow;
18
+ private readonly targetOrigin;
19
+ private readonly applicationName;
20
+ private readonly onMessage;
21
+ private readonly onActivity;
22
+ private isDestroyed;
23
+ /** Starts listening for messages from the configured editor endpoint. */
24
+ constructor(options: AppsEditorHostOptions);
25
+ private handleMessage;
26
+ /** Posts a host message to the editor; does nothing after destroy(). */
27
+ send(message: AppsEditorHostMessage<TGeneral, TCredentials>): void;
28
+ /** Stops receiving and sending messages; repeated calls are harmless. */
29
+ destroy(): void;
30
+ }
31
+ //# sourceMappingURL=AppsEditorHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppsEditorHost.d.ts","sourceRoot":"","sources":["../../src/lib/AppsEditorHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAM/B,qFAAqF;AACrF,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,SAAS,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACtD,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,qGAAqG;AACrG,qBAAa,cAAc,CAAC,QAAQ,GAAG,OAAO,EAAE,YAAY,GAAG,OAAO;IACpE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsC;IACjE,OAAO,CAAC,WAAW,CAAS;IAE5B,yEAAyE;gBAC7D,OAAO,EAAE,qBAAqB;IAS1C,OAAO,CAAC,aAAa,CAgBnB;IAEF,wEAAwE;IACxE,IAAI,CAAC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,IAAI;IAKlE,yEAAyE;IACzE,OAAO,IAAI,IAAI;CAKhB"}
@@ -0,0 +1,59 @@
1
+ import { ChatVisualizerCallbacks, VisualizerAttachmentData, VisualizerConnectorRequest } from '../models/visualizer-connector';
2
+ import { AppsEditorEvents, AppsEditorMessages, VisualizerConnectorEvents } from '../types/visualizer-connector';
3
+ /** Event types `ChatVisualizerConnector.send()` posts, each prefixed `${appName}/`. */
4
+ export type ChatVisualizerEventType = VisualizerConnectorEvents | AppsEditorEvents;
5
+ /**
6
+ * The iframe half of the visualizer protocol: runs inside a visualizer or application-editor iframe
7
+ * and exchanges namespaced messages with DIAL Chat.
8
+ */
9
+ export declare class ChatVisualizerConnector {
10
+ /** Allowed and target hosts: outgoing messages go to each; incoming ones must come from one. */
11
+ protected dialHosts: string[];
12
+ /** The first of `dialHosts`, kept for callers written against npm `0.49.0`. */
13
+ protected dialHost: string;
14
+ protected appName: string;
15
+ protected callbacks: ChatVisualizerCallbacks;
16
+ /**
17
+ * Starts listening for host messages. It announces nothing: call `sendReady()` and
18
+ * `sendReadyToInteract()` once the iframe can take them.
19
+ *
20
+ * @param dialHost DIAL Chat origin(s); `'*'` as the first entry accepts any origin.
21
+ * @param appName Protocol namespace; must equal the host's visualizer `title` or editor application name.
22
+ * @param callbacks An `onData` callback, or an object with `onData` / `onGroupedData`.
23
+ */
24
+ constructor(dialHost: string | string[], appName: string, callbacks: ((data: VisualizerAttachmentData) => void) | ChatVisualizerCallbacks);
25
+ /** Posts `${appName}/${type}` to every configured host, or only to `dialHost` when given. */
26
+ send({ type, payload, dialHost, }: {
27
+ type: ChatVisualizerEventType;
28
+ payload?: unknown;
29
+ dialHost?: string;
30
+ }): void;
31
+ /**
32
+ * Posts an application-editor message as is — no `${appName}/` prefix — to every configured host,
33
+ * or only to `dialHost` when given. Fields go where the host reads them (see `AppsEditorMessages`).
34
+ * @deprecated Use `AppsEditorClient` for direction-safe messages and validated incoming requests.
35
+ */
36
+ sendEditorMessage(message: {
37
+ type: AppsEditorMessages;
38
+ } & Record<string, unknown>, dialHost?: string): void;
39
+ /** Acknowledges a host request: posts `${type}/RESPONSE` with its `requestId` back to `dialHost`. */
40
+ sendPMResponse({ type, requestId, payload, dialHost, }: VisualizerConnectorRequest & {
41
+ dialHost: string;
42
+ }): void;
43
+ /** Handles one inbound `message`; bound, so it can be added and removed as a listener. */
44
+ postMessageListener: (event: MessageEvent<VisualizerConnectorRequest>) => void;
45
+ /** Posts `${appName}/READY`: the iframe has loaded. */
46
+ sendReady(): void;
47
+ /** Posts `${appName}/READY_TO_INTERACT`: the iframe can take data. */
48
+ sendReadyToInteract(): void;
49
+ /** Posts `${appName}/readyToSave`: an application editor's model is loaded and safe to save. */
50
+ sendReadyToSave(): void;
51
+ /** Posts `${appName}/loggedOut`: an application editor's session resolved signed out. */
52
+ sendLoggedOut(): void;
53
+ /** Posts `${appName}/SEND_MESSAGE` with `{ message: content }` into the selected conversations. */
54
+ sendMessage(content: string): Promise<void>;
55
+ /** Stops listening for host messages. A second call is a no-op. */
56
+ destroy(): void;
57
+ private isAllowedOrigin;
58
+ }
59
+ //# sourceMappingURL=ChatVisualizerConnector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatVisualizerConnector.d.ts","sourceRoot":"","sources":["../../src/lib/ChatVisualizerConnector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAE3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,+BAA+B,CAAC;AA0BvC,uFAAuF;AACvF,MAAM,MAAM,uBAAuB,GACjC,yBAAyB,GAAG,gBAAgB,CAAC;AAE/C;;;GAGG;AACH,qBAAa,uBAAuB;IAClC,gGAAgG;IAChG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC9B,+EAA+E;IAC/E,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAE7C;;;;;;;OAOG;gBAED,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,SAAS,EACP,CAAC,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC,GAAG,uBAAuB;IAgBxE,6FAA6F;IAC7F,IAAI,CAAC,EACH,IAAI,EACJ,OAAO,EACP,QAAQ,GACT,EAAE;QACD,IAAI,EAAE,uBAAuB,CAAC;QAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,IAAI;IAeR;;;;OAIG;IACH,iBAAiB,CACf,OAAO,EAAE;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI;IAUP,qGAAqG;IACrG,cAAc,CAAC,EACb,IAAI,EACJ,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAO3D,0FAA0F;IAC1F,mBAAmB,GACjB,OAAO,YAAY,CAAC,0BAA0B,CAAC,KAC9C,IAAI,CAsDL;IAEF,uDAAuD;IACvD,SAAS,IAAI,IAAI;IAIjB,sEAAsE;IACtE,mBAAmB,IAAI,IAAI;IAI3B,gGAAgG;IAChG,eAAe,IAAI,IAAI;IAIvB,yFAAyF;IACzF,aAAa,IAAI,IAAI;IAIrB,mGAAmG;IAC7F,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjD,mEAAmE;IACnE,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,eAAe;CAKxB"}
@@ -0,0 +1,12 @@
1
+ import { AppsEditorClientMessage, AppsEditorHostMessage } from '../models/apps-editor';
2
+ /** Returns an exact, non-opaque origin or throws for an invalid target. */
3
+ export declare const normalizeAppsEditorOrigin: (value: string) => string;
4
+ /** Validates editor-to-host wire messages and normalizes supported legacy field placements. */
5
+ export declare const parseAppsEditorClientMessage: (data: unknown, applicationName: string) => AppsEditorClientMessage | null;
6
+ /** Validates host-to-editor protocol fields; General values and credential status remain opaque. */
7
+ export declare const parseAppsEditorHostMessage: (data: unknown) => AppsEditorHostMessage | null;
8
+ /** Serializes normalized editor messages using the existing namespaced lifecycle wire format. */
9
+ export declare const serializeAppsEditorClientMessage: (message: AppsEditorClientMessage, applicationName: string) => {
10
+ type: string;
11
+ };
12
+ //# sourceMappingURL=apps-editor-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps-editor-protocol.d.ts","sourceRoot":"","sources":["../../src/lib/apps-editor-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAY/B,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,MAMzD,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,4BAA4B,GACvC,MAAM,OAAO,EACb,iBAAiB,MAAM,KACtB,uBAAuB,GAAG,IA+D5B,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,0BAA0B,GACrC,MAAM,OAAO,KACZ,qBAAqB,GAAG,IA0C1B,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,gCAAgC,GAC3C,SAAS,uBAAuB,EAChC,iBAAiB,MAAM,KACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAUhB,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { AppsEditorEvents, AppsEditorMessages } from '../types/visualizer-connector';
2
+ /** Host request to persist the editor's model, optionally merging host-owned General values. */
3
+ export interface AppsEditorTriggerSaveMessage<TGeneral = unknown> {
4
+ /** Unprefixed save request. */
5
+ type: AppsEditorMessages.TriggerSave;
6
+ /** Application-defined General values; their validation belongs to the receiving application. */
7
+ general?: TGeneral;
8
+ }
9
+ /** Host response containing a toolset login/logout outcome and optional application-defined status. */
10
+ export interface AppsEditorToolsetResultMessage<TCredentials = unknown> {
11
+ /** Unprefixed result of the corresponding toolset request. */
12
+ type: AppsEditorMessages.ToolsetLoginResult | AppsEditorMessages.ToolsetLogoutResult;
13
+ /** The toolset identifier from the request. */
14
+ toolsetId: string;
15
+ /** Whether the requested action succeeded. */
16
+ success: boolean;
17
+ /** Application-defined credentials scope. */
18
+ credentialsLevel?: string;
19
+ /** Failure reason, when available. */
20
+ reason?: string;
21
+ /** Application-defined credential status; the receiver validates its structure. */
22
+ credentials?: TCredentials;
23
+ }
24
+ /** Host response containing the outcome of an external-service login. */
25
+ export interface AppsEditorExternalServiceLoginResultMessage {
26
+ /** Unprefixed result of the external-service login request. */
27
+ type: AppsEditorMessages.ExternalServiceLoginResult;
28
+ /** The application identifier from the request, as sent. */
29
+ appId: string;
30
+ /** The external-service identifier from the request, as sent. */
31
+ serviceId: string;
32
+ /** Whether the person is now signed in to the service. */
33
+ success: boolean;
34
+ /** Failure reason, when available; its vocabulary belongs to the host. */
35
+ reason?: string;
36
+ }
37
+ /** Messages the host may send to an application editor. Domain bodies remain application-owned. */
38
+ export type AppsEditorHostMessage<TGeneral = unknown, TCredentials = unknown> = AppsEditorTriggerSaveMessage<TGeneral> | AppsEditorToolsetResultMessage<TCredentials> | AppsEditorExternalServiceLoginResultMessage;
39
+ /** Editor lifecycle notification; the wire type is prefixed with the application name. */
40
+ export interface AppsEditorLifecycleMessage {
41
+ /** UI readiness, model readiness, or signed-out state; these signals are independent. */
42
+ type: AppsEditorEvents.ReadyToInteract | AppsEditorEvents.ReadyToSave | AppsEditorEvents.LoggedOut;
43
+ }
44
+ /** Editor notification that its application was updated. */
45
+ export interface AppsEditorUpdatedMessage {
46
+ /** Namespaced on the wire, unprefixed in typed callbacks. */
47
+ type: AppsEditorEvents.UpdatedApplicationSuccess;
48
+ /** Optional application-defined update data. */
49
+ payload?: {
50
+ /** The updated application; its structure is owned by the application. */
51
+ application?: unknown;
52
+ };
53
+ }
54
+ /** Successful editor save; older editors omit the change indicator. */
55
+ export interface AppsEditorSaveSuccessMessage {
56
+ /** Unprefixed save completion. */
57
+ type: AppsEditorMessages.SaveSuccess;
58
+ /** Whether user-editable values changed. Missing or invalid inbound values normalize to false. */
59
+ hasChanges?: boolean;
60
+ }
61
+ /** Failed editor save. */
62
+ export interface AppsEditorSaveErrorMessage {
63
+ /** Unprefixed save failure. */
64
+ type: AppsEditorMessages.SaveError;
65
+ /** Failure description; an omitted inbound description normalizes to an empty string. */
66
+ error: string;
67
+ }
68
+ /** Current validity of the editor form, independent of model readiness and dirty state. */
69
+ export interface AppsEditorValidityMessage {
70
+ /** Unprefixed validity notification. */
71
+ type: AppsEditorMessages.ValidityState;
72
+ /** Form validity. */
73
+ payload: {
74
+ /** Whether the form is valid. */
75
+ isValid: boolean;
76
+ };
77
+ }
78
+ /** Current unsaved-change state of the editor form. */
79
+ export interface AppsEditorDirtyMessage {
80
+ /** Unprefixed dirty-state notification. */
81
+ type: AppsEditorMessages.DirtyState;
82
+ /** Form change state. */
83
+ payload: {
84
+ /** Whether the editor has unsaved edits. */
85
+ isDirty: boolean;
86
+ };
87
+ }
88
+ /** Editor request for the host to perform a toolset login or logout. */
89
+ export interface AppsEditorToolsetRequestMessage {
90
+ /** Unprefixed toolset action request. */
91
+ type: AppsEditorMessages.RequestToolsetLogin | AppsEditorMessages.RequestToolsetLogout;
92
+ /** Nonempty toolset identifier, interpreted by the host application. */
93
+ toolsetId: string;
94
+ }
95
+ /** Editor request to open host-owned credential forms. */
96
+ export interface AppsEditorCredentialsRequestMessage {
97
+ /** Unprefixed credentials-form request. */
98
+ type: AppsEditorMessages.RequestApplicationCredentials;
99
+ /** Nonempty application identifier; no credential material is sent. */
100
+ appId: string;
101
+ }
102
+ /** Editor request for the host to sign the person in to one external service of an application. */
103
+ export interface AppsEditorExternalServiceLoginRequestMessage {
104
+ /** Unprefixed external-service login request. */
105
+ type: AppsEditorMessages.RequestExternalServiceLogin;
106
+ /** Nonempty application identifier; no credential material is sent. */
107
+ appId: string;
108
+ /** Nonempty external-service identifier within the application. */
109
+ serviceId: string;
110
+ /** The person's own choice, collected by the editor, to let the application use the sign-in while they are away. */
111
+ offlineUsageConsent: boolean;
112
+ }
113
+ /** Validated editor-to-host messages, with normalized lifecycle names and payload placement. */
114
+ export type AppsEditorClientMessage = AppsEditorLifecycleMessage | AppsEditorUpdatedMessage | AppsEditorSaveSuccessMessage | AppsEditorSaveErrorMessage | AppsEditorValidityMessage | AppsEditorDirtyMessage | AppsEditorToolsetRequestMessage | AppsEditorCredentialsRequestMessage | AppsEditorExternalServiceLoginRequestMessage;
115
+ //# sourceMappingURL=apps-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps-editor.d.ts","sourceRoot":"","sources":["../../src/models/apps-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AAEvC,gGAAgG;AAChG,MAAM,WAAW,4BAA4B,CAAC,QAAQ,GAAG,OAAO;IAC9D,+BAA+B;IAC/B,IAAI,EAAE,kBAAkB,CAAC,WAAW,CAAC;IACrC,iGAAiG;IACjG,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,uGAAuG;AACvG,MAAM,WAAW,8BAA8B,CAAC,YAAY,GAAG,OAAO;IACpE,8DAA8D;IAC9D,IAAI,EACA,kBAAkB,CAAC,kBAAkB,GACrC,kBAAkB,CAAC,mBAAmB,CAAC;IAC3C,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,yEAAyE;AACzE,MAAM,WAAW,2CAA2C;IAC1D,+DAA+D;IAC/D,IAAI,EAAE,kBAAkB,CAAC,0BAA0B,CAAC;IACpD,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,mGAAmG;AACnG,MAAM,MAAM,qBAAqB,CAAC,QAAQ,GAAG,OAAO,EAAE,YAAY,GAAG,OAAO,IACxE,4BAA4B,CAAC,QAAQ,CAAC,GACtC,8BAA8B,CAAC,YAAY,CAAC,GAC5C,2CAA2C,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,WAAW,0BAA0B;IACzC,yFAAyF;IACzF,IAAI,EACA,gBAAgB,CAAC,eAAe,GAChC,gBAAgB,CAAC,WAAW,GAC5B,gBAAgB,CAAC,SAAS,CAAC;CAChC;AAED,4DAA4D;AAC5D,MAAM,WAAW,wBAAwB;IACvC,6DAA6D;IAC7D,IAAI,EAAE,gBAAgB,CAAC,yBAAyB,CAAC;IACjD,gDAAgD;IAChD,OAAO,CAAC,EAAE;QACR,0EAA0E;QAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,uEAAuE;AACvE,MAAM,WAAW,4BAA4B;IAC3C,kCAAkC;IAClC,IAAI,EAAE,kBAAkB,CAAC,WAAW,CAAC;IACrC,kGAAkG;IAClG,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,0BAA0B;AAC1B,MAAM,WAAW,0BAA0B;IACzC,+BAA+B;IAC/B,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC;IACnC,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,2FAA2F;AAC3F,MAAM,WAAW,yBAAyB;IACxC,wCAAwC;IACxC,IAAI,EAAE,kBAAkB,CAAC,aAAa,CAAC;IACvC,qBAAqB;IACrB,OAAO,EAAE;QACP,iCAAiC;QACjC,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,uDAAuD;AACvD,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC;IACpC,yBAAyB;IACzB,OAAO,EAAE;QACP,4CAA4C;QAC5C,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,wEAAwE;AACxE,MAAM,WAAW,+BAA+B;IAC9C,yCAAyC;IACzC,IAAI,EACA,kBAAkB,CAAC,mBAAmB,GACtC,kBAAkB,CAAC,oBAAoB,CAAC;IAC5C,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,0DAA0D;AAC1D,MAAM,WAAW,mCAAmC;IAClD,2CAA2C;IAC3C,IAAI,EAAE,kBAAkB,CAAC,6BAA6B,CAAC;IACvD,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mGAAmG;AACnG,MAAM,WAAW,4CAA4C;IAC3D,iDAAiD;IACjD,IAAI,EAAE,kBAAkB,CAAC,2BAA2B,CAAC;IACrD,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,oHAAoH;IACpH,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,gGAAgG;AAChG,MAAM,MAAM,uBAAuB,GAC/B,0BAA0B,GAC1B,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,yBAAyB,GACzB,sBAAsB,GACtB,+BAA+B,GAC/B,mCAAmC,GACnC,4CAA4C,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { AppsEditorMessages } from '../types/visualizer-connector';
1
2
  /** CSS declarations applied inline to the built-in loader overlay. */
2
3
  export type VisualizerConnectorLoaderStyles = {
3
4
  [property in keyof CSSStyleDeclaration]?: string;
@@ -23,6 +24,48 @@ export interface VisualizerConnectorOptions {
23
24
  /** Milliseconds a `send()` waits for its `/RESPONSE`. Defaults to `10000`. Does not bound `ready()`. */
24
25
  requestTimeout?: number;
25
26
  }
27
+ /** Payload of `SEND_VISUALIZE_DATA`, as `ChatVisualizerConnector` hands it to `onData`. */
28
+ export interface VisualizerAttachmentData {
29
+ /** MIME type of the attachment being visualized. Absent when Chat 0.x's application editor sends only a layout. */
30
+ mimeType?: string;
31
+ /** Presentation layout plus the opaque per-attachment payload. */
32
+ visualizerData: Record<string, unknown>;
33
+ }
34
+ /** One attachment inside a `SEND_GROUPED_VISUALIZE_DATA` payload. */
35
+ export interface VisualizerGroupedAttachmentItem extends VisualizerAttachmentData {
36
+ /** The attachment's own MIME type; always present for a grouped item. */
37
+ mimeType: string;
38
+ /** Absolute URL of the attachment, resolved by the host. */
39
+ url: string;
40
+ }
41
+ /** Payload of `SEND_GROUPED_VISUALIZE_DATA`, as `ChatVisualizerConnector` hands it to `onGroupedData`. */
42
+ export interface VisualizerGroupedAttachmentsData {
43
+ /** One item per attachment the visualizer claims, in message order. */
44
+ attachments: VisualizerGroupedAttachmentItem[];
45
+ /** Presentation layout hints shared by every item. */
46
+ layout: Record<string, unknown>;
47
+ }
48
+ /**
49
+ * An unprefixed legacy application-editor message with application-defined fields.
50
+ * @deprecated Use `AppsEditorHostMessage` / `AppsEditorClientMessage` with the dedicated editor connectors.
51
+ */
52
+ export interface AppsEditorMessage {
53
+ /** The message, as posted, with no `${applicationName}/` prefix. */
54
+ type: AppsEditorMessages;
55
+ /** Nested fields, for the messages that carry them there. */
56
+ payload?: unknown;
57
+ /** Top-level fields, for the messages that carry them there. */
58
+ [field: string]: unknown;
59
+ }
60
+ /** Callbacks a `ChatVisualizerConnector` invokes with the data the host sends. */
61
+ export interface ChatVisualizerCallbacks {
62
+ /** Single-attachment data (`CUSTOM_VISUALIZERS`). */
63
+ onData?: (data: VisualizerAttachmentData) => void;
64
+ /** Grouped attachments data (`APPLICATION_VISUALIZERS`). */
65
+ onGroupedData?: (data: VisualizerGroupedAttachmentsData) => void;
66
+ /** An application-editor message from an allowed host, such as `TRIGGER_SAVE`, with the sender's origin. */
67
+ onEditorMessage?: (message: AppsEditorMessage, origin: string) => void;
68
+ }
26
69
  /** Shape of every message exchanged with the visualizer iframe. */
27
70
  export interface VisualizerConnectorRequest {
28
71
  /** `${visualizerName}/${request or event}`, with `/RESPONSE` appended on replies. */
@@ -1 +1 @@
1
- {"version":3,"file":"visualizer-connector.d.ts","sourceRoot":"","sources":["../../src/models/visualizer-connector.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,MAAM,+BAA+B,GAAG;KAC3C,QAAQ,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM;CACjD,CAAC;AAEF,oDAAoD;AACpD,MAAM,WAAW,0BAA0B;IACzC,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,cAAc,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,+BAA+B,CAAC;IAC/C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wGAAwG;IACxG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,mEAAmE;AACnE,MAAM,WAAW,0BAA0B;IACzC,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
1
+ {"version":3,"file":"visualizer-connector.d.ts","sourceRoot":"","sources":["../../src/models/visualizer-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,sEAAsE;AACtE,MAAM,MAAM,+BAA+B,GAAG;KAC3C,QAAQ,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM;CACjD,CAAC;AAEF,oDAAoD;AACpD,MAAM,WAAW,0BAA0B;IACzC,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,cAAc,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,+BAA+B,CAAC;IAC/C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wGAAwG;IACxG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,2FAA2F;AAC3F,MAAM,WAAW,wBAAwB;IACvC,mHAAmH;IACnH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,qEAAqE;AACrE,MAAM,WAAW,+BAAgC,SAAQ,wBAAwB;IAC/E,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,GAAG,EAAE,MAAM,CAAC;CACb;AAED,0GAA0G;AAC1G,MAAM,WAAW,gCAAgC;IAC/C,uEAAuE;IACvE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC/C,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,IAAI,EAAE,kBAAkB,CAAC;IACzB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,kFAAkF;AAClF,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAClD,4DAA4D;IAC5D,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,gCAAgC,KAAK,IAAI,CAAC;IACjE,4GAA4G;IAC5G,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACxE;AAED,mEAAmE;AACnE,MAAM,WAAW,0BAA0B;IACzC,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-visualizer-connector",
3
- "description": "Host-side postMessage connector that mounts a custom visualizer iframe and delivers its data",
4
- "version": "1.3.0-dev.96",
3
+ "description": "Host-side and iframe-side postMessage connectors for DIAL Chat custom visualizers and application editors",
4
+ "version": "1.3.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -17,4 +17,52 @@ export declare enum VisualizerConnectorEvents {
17
17
  UpdatedConversationSuccess = "UPDATED_CONVERSATION_SUCCESS",
18
18
  UpdatedApplicationSuccess = "UPDATED_APPLICATION_SUCCESS"
19
19
  }
20
+ /**
21
+ * Messages an application-editor iframe posts to DIAL Chat's application editor, as
22
+ * `${applicationName}/${value}`. The camelCase wire values are the ones the editor host matches on;
23
+ * they are not the visualizer events above.
24
+ */
25
+ export declare enum AppsEditorEvents {
26
+ /** The editor's UI has rendered; the host drops its loading overlay. */
27
+ ReadyToInteract = "readyToInteract",
28
+ /** The editor's model is loaded and can handle `TRIGGER_SAVE`; form validity is reported separately. May repeat. */
29
+ ReadyToSave = "readyToSave",
30
+ /** The editor's session resolved signed out, so `ReadyToSave` will not arrive. */
31
+ LoggedOut = "loggedOut",
32
+ /** The editor saved the application; the host refreshes its own copy. */
33
+ UpdatedApplicationSuccess = "updatedApplicationSuccess"
34
+ }
35
+ /**
36
+ * The application editor's save and auth messages, posted WITHOUT the `${applicationName}/` prefix.
37
+ * Field placement follows what DIAL Chat's application editor reads (top level unless noted).
38
+ */
39
+ export declare enum AppsEditorMessages {
40
+ /** Host → editor: save now. Carries the General step as `general` when the host owns it. */
41
+ TriggerSave = "TRIGGER_SAVE",
42
+ /** Editor → host: the save landed; `hasChanges: boolean`. */
43
+ SaveSuccess = "SAVE_SUCCESS",
44
+ /** Editor → host: the save failed or was refused; `error: string`. */
45
+ SaveError = "SAVE_ERROR",
46
+ /** Editor → host: the form's validity; `payload.isValid: boolean`. */
47
+ ValidityState = "VALIDITY_STATE",
48
+ /** Editor → host: unsaved edits; `payload.isDirty: boolean` (top-level `isDirty` also read). */
49
+ DirtyState = "DIRTY_STATE",
50
+ /** Editor → host: start a toolset OAuth login; `toolsetId: string`. */
51
+ RequestToolsetLogin = "REQUEST_TOOLSET_LOGIN",
52
+ /** Host → editor: outcome of `RequestToolsetLogin`. */
53
+ ToolsetLoginResult = "TOOLSET_LOGIN_RESULT",
54
+ /** Editor → host: log a toolset out; `toolsetId: string`. */
55
+ RequestToolsetLogout = "REQUEST_TOOLSET_LOGOUT",
56
+ /** Host → editor: outcome of `RequestToolsetLogout`. */
57
+ ToolsetLogoutResult = "TOOLSET_LOGOUT_RESULT",
58
+ /** Editor → host: open the host's credential forms; `appId: string`. No credential crosses the frame. */
59
+ RequestApplicationCredentials = "REQUEST_APPLICATION_CREDENTIALS",
60
+ /**
61
+ * Editor → host: sign the person in to one external service at user level;
62
+ * `appId: string`, `serviceId: string`, `offlineUsageConsent: boolean`. No credential crosses the frame.
63
+ */
64
+ RequestExternalServiceLogin = "REQUEST_EXTERNAL_SERVICE_LOGIN",
65
+ /** Host → editor: outcome of `RequestExternalServiceLogin`. */
66
+ ExternalServiceLoginResult = "EXTERNAL_SERVICE_LOGIN_RESULT"
67
+ }
20
68
  //# sourceMappingURL=visualizer-connector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"visualizer-connector.d.ts","sourceRoot":"","sources":["../../src/types/visualizer-connector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,2BAA2B;IACrC,iBAAiB,wBAAwB;IACzC,wBAAwB,gCAAgC;IACxD,oBAAoB,2BAA2B;CAChD;AAED,qGAAqG;AACrG,oBAAY,yBAAyB;IACnC,SAAS,eAAe;IACxB,KAAK,UAAU;IACf,eAAe,sBAAsB;IACrC,WAAW,iBAAiB;IAC5B,0BAA0B,iCAAiC;IAC3D,0BAA0B,iCAAiC;IAC3D,yBAAyB,gCAAgC;CAC1D"}
1
+ {"version":3,"file":"visualizer-connector.d.ts","sourceRoot":"","sources":["../../src/types/visualizer-connector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,2BAA2B;IACrC,iBAAiB,wBAAwB;IACzC,wBAAwB,gCAAgC;IACxD,oBAAoB,2BAA2B;CAChD;AAED,qGAAqG;AACrG,oBAAY,yBAAyB;IACnC,SAAS,eAAe;IACxB,KAAK,UAAU;IACf,eAAe,sBAAsB;IACrC,WAAW,iBAAiB;IAC5B,0BAA0B,iCAAiC;IAC3D,0BAA0B,iCAAiC;IAC3D,yBAAyB,gCAAgC;CAC1D;AAED;;;;GAIG;AACH,oBAAY,gBAAgB;IAC1B,wEAAwE;IACxE,eAAe,oBAAoB;IACnC,oHAAoH;IACpH,WAAW,gBAAgB;IAC3B,kFAAkF;IAClF,SAAS,cAAc;IACvB,yEAAyE;IACzE,yBAAyB,8BAA8B;CACxD;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,4FAA4F;IAC5F,WAAW,iBAAiB;IAC5B,6DAA6D;IAC7D,WAAW,iBAAiB;IAC5B,sEAAsE;IACtE,SAAS,eAAe;IACxB,sEAAsE;IACtE,aAAa,mBAAmB;IAChC,gGAAgG;IAChG,UAAU,gBAAgB;IAC1B,uEAAuE;IACvE,mBAAmB,0BAA0B;IAC7C,uDAAuD;IACvD,kBAAkB,yBAAyB;IAC3C,6DAA6D;IAC7D,oBAAoB,2BAA2B;IAC/C,wDAAwD;IACxD,mBAAmB,0BAA0B;IAC7C,yGAAyG;IACzG,6BAA6B,oCAAoC;IACjE;;;OAGG;IACH,2BAA2B,mCAAmC;IAC9D,+DAA+D;IAC/D,0BAA0B,kCAAkC;CAC7D"}