@telia-ace/widget-conversation 1.0.24 → 1.0.25

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.
Files changed (45) hide show
  1. package/README.md +110 -210
  2. package/dist/conversation.3981560b.js +1100 -0
  3. package/dist/conversation.3981560b.js.map +1 -0
  4. package/dist/index.d.ts +1 -2
  5. package/dist/index.js +164 -182
  6. package/dist/index.js.map +1 -1
  7. package/dist/{return-button.facf6a45.js → return-button.8773c0de.js} +1 -1
  8. package/dist/return-button.8773c0de.js.map +1 -0
  9. package/dist/types.d.ts +41 -34
  10. package/dist/{components/conversation/plugin.d.ts → ui/conversation/conversation-component.d.ts} +2 -13
  11. package/dist/ui/conversation/conversation-content.d.ts +11 -0
  12. package/dist/{components/conversation/ui/input.d.ts → ui/conversation/conversation-input.d.ts} +0 -0
  13. package/dist/ui/conversation/conversation-loader.d.ts +8 -0
  14. package/dist/ui/conversation/conversation-message.d.ts +7 -0
  15. package/dist/ui/conversation/conversation-styles.d.ts +11 -0
  16. package/dist/{components → ui}/conversation/conversation.d.ts +0 -0
  17. package/dist/ui/conversation/index.d.ts +2 -0
  18. package/dist/{components/conversation/ui → ui/conversation}/message-types/agent.d.ts +1 -1
  19. package/dist/ui/conversation/message-types/custom.d.ts +9 -0
  20. package/dist/{components/conversation/ui → ui/conversation}/message-types/index.d.ts +1 -0
  21. package/dist/{components/conversation/ui → ui/conversation}/message-types/system.d.ts +0 -0
  22. package/dist/{components/conversation/ui → ui/conversation}/message-types/timestamp.d.ts +0 -0
  23. package/dist/{components/conversation/ui → ui/conversation}/message-types/user.d.ts +0 -0
  24. package/dist/ui/index.d.ts +2 -0
  25. package/dist/ui/return-button/index.d.ts +2 -0
  26. package/dist/{components/return-button/plugin.d.ts → ui/return-button/return-button-component.d.ts} +2 -1
  27. package/dist/{components → ui}/return-button/return-button.d.ts +0 -0
  28. package/package.json +8 -8
  29. package/dist/components/conversation/ui/content.d.ts +0 -2
  30. package/dist/components/conversation/ui/loader.d.ts +0 -8
  31. package/dist/components/conversation/ui/message-list-items/button-list.d.ts +0 -8
  32. package/dist/components/conversation/ui/message-list-items/custom.d.ts +0 -9
  33. package/dist/components/conversation/ui/message-list-items/html.d.ts +0 -5
  34. package/dist/components/conversation/ui/message-list-items/link-list.d.ts +0 -8
  35. package/dist/components/conversation/ui/message-list-items/separator.d.ts +0 -2
  36. package/dist/components/conversation/ui/message-list-items/text.d.ts +0 -6
  37. package/dist/components/conversation/ui/message-list-items/video-request.d.ts +0 -8
  38. package/dist/components/conversation/ui/message-types/message-list.d.ts +0 -9
  39. package/dist/components/conversation/ui/message.d.ts +0 -7
  40. package/dist/components/conversation/ui/overlay-outlets.d.ts +0 -13
  41. package/dist/components/conversation/ui/styles.d.ts +0 -27
  42. package/dist/conversation.edf14596.js +0 -1191
  43. package/dist/conversation.edf14596.js.map +0 -1
  44. package/dist/return-button.facf6a45.js.map +0 -1
  45. package/dist/utils/map-actions.d.ts +0 -1
package/dist/index.js CHANGED
@@ -1,52 +1,52 @@
1
- var U = Object.defineProperty, L = Object.defineProperties;
1
+ var U = Object.defineProperty, F = Object.defineProperties;
2
2
  var _ = Object.getOwnPropertyDescriptors;
3
3
  var C = Object.getOwnPropertySymbols;
4
- var N = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
5
- var T = (r, t, e) => t in r ? U(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, p = (r, t) => {
4
+ var T = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
+ var N = (i, t, e) => t in i ? U(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, p = (i, t) => {
6
6
  for (var e in t || (t = {}))
7
- N.call(t, e) && T(r, e, t[e]);
7
+ T.call(t, e) && N(i, e, t[e]);
8
8
  if (C)
9
9
  for (var e of C(t))
10
- M.call(t, e) && T(r, e, t[e]);
11
- return r;
12
- }, g = (r, t) => L(r, _(t));
13
- var R = (r, t) => {
10
+ D.call(t, e) && N(i, e, t[e]);
11
+ return i;
12
+ }, g = (i, t) => F(i, _(t));
13
+ var R = (i, t) => {
14
14
  var e = {};
15
- for (var s in r)
16
- N.call(r, s) && t.indexOf(s) < 0 && (e[s] = r[s]);
17
- if (r != null && C)
18
- for (var s of C(r))
19
- t.indexOf(s) < 0 && M.call(r, s) && (e[s] = r[s]);
15
+ for (var s in i)
16
+ T.call(i, s) && t.indexOf(s) < 0 && (e[s] = i[s]);
17
+ if (i != null && C)
18
+ for (var s of C(i))
19
+ t.indexOf(s) < 0 && D.call(i, s) && (e[s] = i[s]);
20
20
  return e;
21
21
  };
22
- var P = (r, t, e) => new Promise((s, n) => {
23
- var i = (c) => {
22
+ var S = (i, t, e) => new Promise((s, r) => {
23
+ var n = (c) => {
24
24
  try {
25
25
  a(e.next(c));
26
26
  } catch (h) {
27
- n(h);
27
+ r(h);
28
28
  }
29
29
  }, o = (c) => {
30
30
  try {
31
31
  a(e.throw(c));
32
32
  } catch (h) {
33
- n(h);
33
+ r(h);
34
34
  }
35
- }, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(i, o);
36
- a((e = e.apply(r, t)).next());
35
+ }, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(n, o);
36
+ a((e = e.apply(i, t)).next());
37
37
  });
38
- import { ComponentPlatform as z } from "@telia-ace/widget-core";
39
- import { createStorageWriter as H, StorageCategory as $, StorageMedium as m, StorageScope as F, readStorage as A } from "@telia-ace/widget-services";
40
- import { uuid as j, lock as q } from "@telia-ace/widget-utilities";
41
- import { FormBuilder as G } from "@telia-ace/widget-forms";
42
- import { closeAllModals as D } from "@telia-ace/widget-plugins";
38
+ import { ComponentPlatform as H } from "@telia-ace/widget-core";
39
+ import { createStorageWriter as z, StorageCategory as $, StorageMedium as m, StorageScope as L, readStorage as A } from "@telia-ace/widget-services";
40
+ import { uuid as j, lock as G } from "@telia-ace/widget-utilities";
41
+ import { FormBuilder as J } from "@telia-ace/widget-forms";
42
+ import { closeAllModals as M } from "@telia-ace/widget-plugins";
43
43
  import { createReactComponent as Q } from "@telia-ace/widget-ui";
44
- import { lazy as J } from "react";
45
- class K {
44
+ import { lazy as K } from "react";
45
+ class V {
46
46
  constructor(t, e) {
47
47
  this.provider = t, this.print = (s) => {
48
- const n = { name: this.name, avatar: this.avatar }, i = x(s);
49
- return this.provider.createEntry(i.key, i.content, E.Agent, n, i.timestamp);
48
+ const r = { name: this.name, avatar: this.avatar }, n = x(s);
49
+ return this.provider.createEntry(n.key, n.content, E.Agent, r, n.timestamp);
50
50
  }, this.typing = () => this.provider.setTypingState({ name: this.name, avatar: this.avatar }), this.name = e.name, this.avatar = e.avatar;
51
51
  }
52
52
  update(t) {
@@ -63,7 +63,7 @@ class k {
63
63
  }
64
64
  createAgent(t = {}) {
65
65
  if (this.controller)
66
- return new K(this, t);
66
+ return new V(this, t);
67
67
  }
68
68
  print(t) {
69
69
  var e;
@@ -77,9 +77,9 @@ class k {
77
77
  return this.controller ? this.controller.loader() : () => () => {
78
78
  };
79
79
  }
80
- createEntry(t, e, s, n, i) {
80
+ createEntry(t, e, s, r, n) {
81
81
  var o;
82
- return (o = this.controller) == null ? void 0 : o.createEntry(t, e, s, n, i);
82
+ return (o = this.controller) == null ? void 0 : o.createEntry(t, e, s, r, n);
83
83
  }
84
84
  dispose() {
85
85
  var t;
@@ -104,7 +104,7 @@ class k {
104
104
  }
105
105
  }
106
106
  }
107
- class V {
107
+ class Y {
108
108
  constructor(t) {
109
109
  this.controller = t, this.print = (e) => {
110
110
  const s = x(e);
@@ -112,7 +112,7 @@ class V {
112
112
  };
113
113
  }
114
114
  }
115
- class Y {
115
+ class q {
116
116
  constructor(t) {
117
117
  this.writer = t;
118
118
  }
@@ -127,52 +127,52 @@ class Y {
127
127
  return typeof t == "string" ? { body: t } : t.length > -1 && typeof t == "object" ? { items: t } : t;
128
128
  }
129
129
  }
130
- var E = /* @__PURE__ */ ((r) => (r.User = "user", r.Agent = "agent", r.System = "system", r))(E || {});
131
- const x = (r) => {
130
+ var E = /* @__PURE__ */ ((i) => (i.User = "user", i.Agent = "agent", i.System = "system", i))(E || {});
131
+ const x = (i) => {
132
132
  let t, e = j(), s = Date.now();
133
- if (Array.isArray(r) && r.length > -1)
134
- typeof r[0] == "string" ? t = { items: [r] } : t = { items: r };
135
- else if (typeof r == "string")
136
- t = { body: r };
137
- else if (r = r || {}, r.type)
138
- t = p({}, r);
133
+ if (i.length > -1 && typeof i == "object")
134
+ typeof i[0] == "string" ? t = { items: [i] } : t = { items: i };
135
+ else if (typeof i == "string")
136
+ t = { body: i };
137
+ else if (i = i, i.type)
138
+ t = p({}, i);
139
139
  else {
140
140
  if (t = {
141
- body: r.body,
142
- actions: r.actions,
143
- title: r.title
144
- }, r.key && (e = r.key), r.timestamp && (s = r.timestamp), r.form) {
145
- const n = G.create(e);
146
- r.form(n);
147
- const i = n.get();
148
- t.form = i;
141
+ body: i.body,
142
+ actions: i.actions,
143
+ title: i.title
144
+ }, i.key && (e = i.key), i.timestamp && (s = i.timestamp), i.form) {
145
+ const r = J.create(e);
146
+ i.form(r);
147
+ const n = r.get();
148
+ t.form = n;
149
149
  }
150
- r.timestamp === null && (s = null);
150
+ i.timestamp === null && (s = null);
151
151
  }
152
152
  return { content: t, key: e, timestamp: s };
153
- }, O = (r, t) => {
153
+ }, O = (i, t) => {
154
154
  if (!t)
155
155
  return;
156
- const e = JSON.stringify(t), s = r.findIndex((n) => e === JSON.stringify(n));
156
+ const e = JSON.stringify(t), s = i.findIndex((r) => e === JSON.stringify(r));
157
157
  if (s > -1)
158
- return r.splice(s, 1);
158
+ return i.splice(s, 1);
159
159
  };
160
160
  class X {
161
161
  constructor(t, e) {
162
- this.container = t, this.id = e, this.formHandlers = {}, this.user = new V(this), this.providers = [], this.active = !1, this.registeredProviders = [], this.loaders = 0, this.componentMounted = !1, this.messages = [], this.typingActors = [], this.print = (n) => {
163
- const i = x(n);
164
- return this.createEntry(i.key, i.content, "system", void 0, i.timestamp);
162
+ this.container = t, this.id = e, this.formHandlers = {}, this.user = new Y(this), this.providers = [], this.active = !1, this.registeredProviders = [], this.loaders = 0, this.componentMounted = !1, this.messages = [], this.typingActors = [], this.print = (r) => {
163
+ const n = x(r);
164
+ return this.createEntry(n.key, n.content, "system", void 0, n.timestamp);
165
165
  };
166
166
  const s = t.get("$widget");
167
167
  this.events = s.events.createChild(this);
168
168
  }
169
169
  setProviders(t) {
170
170
  const e = [], s = [];
171
- this.providers.reduce((n, i) => (t.indexOf(i) === -1 && n.push(i), n), []).forEach((n) => {
172
- const i = this.providers.indexOf(n);
173
- i > -1 && (e.push(n), this.providers.splice(i, 1));
174
- }), t.forEach((n) => {
175
- this.providers.indexOf(n) === -1 && (s.push(n), this.providers.push(n));
171
+ this.providers.reduce((r, n) => (t.indexOf(n) === -1 && r.push(n), r), []).forEach((r) => {
172
+ const n = this.providers.indexOf(r);
173
+ n > -1 && (e.push(r), this.providers.splice(n, 1));
174
+ }), t.forEach((r) => {
175
+ this.providers.indexOf(r) === -1 && (s.push(r), this.providers.push(r));
176
176
  }), (s.length || e.length) && this.events.dispatch("conversation:providers-changed", { added: s, removed: e });
177
177
  }
178
178
  createProvider(t) {
@@ -210,22 +210,22 @@ class X {
210
210
  onUnreadMessage(t) {
211
211
  return this.events.subscribe("conversation:unread-message", t);
212
212
  }
213
- createEntry(t, e, s, n, i) {
213
+ createEntry(t, e, s, r, n) {
214
214
  const o = {
215
215
  key: t,
216
216
  content: e,
217
217
  type: s,
218
- sender: n || null,
219
- timestamp: i || i === null ? i : Date.now()
218
+ sender: r || null,
219
+ timestamp: n || n === null ? n : Date.now()
220
220
  };
221
- this.messages.push(o), o.type === "agent" && O(this.typingActors, n);
222
- const a = new Y((c) => {
221
+ this.messages.push(o), o.type === "agent" && O(this.typingActors, r);
222
+ const a = new q((c) => {
223
223
  if (c !== null) {
224
- const h = c, { timestamp: u = void 0 } = h, f = R(h, ["timestamp"]);
225
- o.content = f, u && (o.timestamp = u);
224
+ const h = c, { timestamp: d = void 0 } = h, f = R(h, ["timestamp"]);
225
+ o.content = f, d && (o.timestamp = d);
226
226
  } else {
227
- const u = this.messages.indexOf(o);
228
- o.content = null, u > -1 && this.messages.splice(u, 1);
227
+ const d = this.messages.indexOf(o);
228
+ o.content = null, d > -1 && this.messages.splice(d, 1);
229
229
  }
230
230
  this.events.dispatch("conversation:message-updated", { message: o }), this.update();
231
231
  });
@@ -264,28 +264,28 @@ class X {
264
264
  this.formHandlers[t] = g(p({}, this.formHandlers[t]), { validate: e });
265
265
  }
266
266
  }
267
- const Z = (r, t) => {
268
- const e = r.split("_contact");
267
+ const Z = (i, t) => {
268
+ const e = i.split("_contact");
269
269
  return t.widgets.get(e[0]);
270
- }, I = (r) => {
271
- const t = r.get("$widget"), { name: e, implementation: s } = r.get("$widget"), n = e.indexOf("_contact") > -1 ? Z(e, s) : t, { data: i } = r.get("$settings"), { trigger: o } = n.container.get("$settings"), a = `${e.replace("_contact-method", "").replace("_contact", "")}_contact-method`, c = s.widgets.get(a);
272
- return c && !o ? { chatWidget: c, mainWidget: n, data: i } : { mainWidget: n, data: i };
273
- }, tt = (r) => {
274
- const { chatWidget: t } = I(r);
270
+ }, I = (i) => {
271
+ const t = i.get("$widget"), { name: e, implementation: s } = i.get("$widget"), r = e.indexOf("_contact") > -1 ? Z(e, s) : t, { data: n } = i.get("$settings"), { trigger: o } = r.container.get("$settings"), a = `${e.replace("_contact-method", "").replace("_contact", "")}_contact-method`, c = s.widgets.get(a);
272
+ return c && !o ? { chatWidget: c, mainWidget: r, data: n } : { mainWidget: r, data: n };
273
+ }, tt = (i) => {
274
+ const { chatWidget: t } = I(i);
275
275
  return !!t;
276
- }, B = (r, t, e) => {
277
- const { mainWidget: s, data: n, chatWidget: i } = I(r);
278
- return i ? i.state === "activated" ? i.invoke("open").then(() => {
279
- i.container.getAsync("conversation").then((o) => {
280
- o.navigateToConversationIfActive(t.id).then(() => D(r));
276
+ }, B = (i, t, e) => {
277
+ const { mainWidget: s, data: r, chatWidget: n } = I(i);
278
+ return n ? n.state === "activated" ? n.invoke("open").then(() => {
279
+ n.container.getAsync("conversation").then((o) => {
280
+ o.navigateToConversationIfActive(t.id).then(() => M(i));
281
281
  });
282
- }) : i.activate().then(() => {
283
- const { trigger: o } = i.container.get("$settings");
284
- return o.action = "hide", i.invoke("setSettings", () => ({
285
- data: n,
282
+ }) : n.activate().then(() => {
283
+ const { trigger: o } = n.container.get("$settings");
284
+ return o.action = "hide", n.invoke("setSettings", () => ({
285
+ data: r,
286
286
  trigger: o,
287
287
  activate: !0
288
- })).then(() => i.container.getAsync("components").then((a) => {
288
+ })).then(() => n.container.getAsync("components").then((a) => {
289
289
  const c = a.components().ofType("contact-method");
290
290
  a.write({
291
291
  key: "setContactMethodId",
@@ -308,23 +308,23 @@ const Z = (r, t) => {
308
308
  provider: "localStorage"
309
309
  });
310
310
  }));
311
- }).then(() => i.invoke("attach", {
311
+ }).then(() => n.invoke("attach", {
312
312
  key: "contact-method",
313
313
  triggerDOMElement: e,
314
314
  withRenderState: "open"
315
- })).then(() => (H(i.container, "activeStickyWidget", $.Necessary, {
315
+ })).then(() => (z(n.container, "activeStickyWidget", $.Necessary, {
316
316
  medium: m.Local,
317
- scope: F.Implementation
318
- }).then((o) => o(i.name)), i.container.getAsync("conversation").then((o) => {
319
- o.setConversationEndedBehavior(S.Deactivate);
320
- }).then(() => D(r)).then(() => !1))) : (s.container.getAsync("conversation").then((o) => o.navigateToConversationIfActive(t.id).then(() => o.setConversationEndedBehavior(S.Navigate))), !i);
321
- }, et = (r, t, e = "conversation") => {
322
- const { mainWidget: s, chatWidget: n } = I(r);
323
- return n ? n.container.getAsync("router").then((i) => {
324
- i.navigate(e, { id: t.id });
325
- }) : s.container.getAsync("conversation").then((i) => {
317
+ scope: L.Implementation
318
+ }).then((o) => o(n.name)), n.container.getAsync("conversation").then((o) => {
319
+ o.setConversationEndedBehavior(P.Deactivate);
320
+ }).then(() => M(i)).then(() => !1))) : (s.container.getAsync("conversation").then((o) => o.navigateToConversationIfActive(t.id).then(() => o.setConversationEndedBehavior(P.Navigate))), !n);
321
+ }, et = (i, t, e = "conversation") => {
322
+ const { mainWidget: s, chatWidget: r } = I(i);
323
+ return r ? r.container.getAsync("router").then((n) => {
324
+ n.navigate(e, { id: t.id });
325
+ }) : s.container.getAsync("conversation").then((n) => {
326
326
  var o;
327
- (o = i.setConversationEndedBehavior(S.Navigate)) == null || o.then(() => {
327
+ (o = n.setConversationEndedBehavior(P.Navigate)) == null || o.then(() => {
328
328
  s.container.getAsync("router").then((a) => {
329
329
  s.container.getAsync("components").then((c) => {
330
330
  const h = c.components().ofType("conversation");
@@ -341,7 +341,7 @@ const Z = (r, t) => {
341
341
  });
342
342
  });
343
343
  }, y = "conversations";
344
- var S = /* @__PURE__ */ ((r) => (r.Deactivate = "deactivate", r.Navigate = "navigate", r.None = "none", r))(S || {});
344
+ var P = /* @__PURE__ */ ((i) => (i.Deactivate = "deactivate", i.Navigate = "navigate", i.None = "none", i))(P || {});
345
345
  class b {
346
346
  constructor(t, e) {
347
347
  this.container = t, this.components = e, this.controllers = [], this.providers = [], this.disposeProviders = {}, this.subscriptions = [], this.storageWriter = null, this.router = null, this.buttonQuery = null, this.sessionInfo = null;
@@ -349,19 +349,19 @@ class b {
349
349
  this.events = s.events.createChild(this);
350
350
  }
351
351
  initialize() {
352
- H(this.container, y, $.Necessary, {
352
+ z(this.container, y, $.Necessary, {
353
353
  medium: m.Local
354
354
  }).then((t) => this.storageWriter = t), A(this.container, y, m.Local).then((t) => {
355
355
  this.buttonQuery = this.components.components().ofType("conversation-return-button"), t && (this.sessionInfo = t, t.id && t.route && this.writeToComponents({ active: !0, alert: { show: !1 } }));
356
356
  }), this.container.getAsync("router").then((t) => this.router = t), this.events.subscribe("conversation:ended", (t, e) => {
357
- var s, n, i;
357
+ var s, r, n;
358
358
  switch ((s = this.sessionInfo) == null ? void 0 : s.conversationEndedBehavior) {
359
359
  case "deactivate":
360
360
  this.container.get("$widget").deactivate();
361
361
  break;
362
362
  case "navigate":
363
- const a = (n = this.router) == null ? void 0 : n.getInitialRoute();
364
- a && ((i = this.router) == null || i.navigate(a.name));
363
+ const a = (r = this.router) == null ? void 0 : r.getInitialRoute();
364
+ a && ((n = this.router) == null || n.navigate(a.name));
365
365
  break;
366
366
  }
367
367
  this.writeToComponents({ active: !1 }), this.sessionInfo = null, this.storageWriter && this.storageWriter();
@@ -371,17 +371,17 @@ class b {
371
371
  this.subscriptions.push(t);
372
372
  }
373
373
  static getInstance(t, e = "conversation") {
374
- return q(t)(() => t.getAsync(e).then((s) => {
375
- let n = s;
376
- return n || z.getInstance(t).then((i) => (n = new b(t, i), n.initialize(), t.registerAsync(e, () => n), n));
374
+ return G(t)(() => t.getAsync(e).then((s) => {
375
+ let r = s;
376
+ return r || H.getInstance(t).then((n) => (r = new b(t, n), r.initialize(), t.registerAsync(e, () => r), r));
377
377
  }));
378
378
  }
379
379
  navigateToConversationIfActive(t) {
380
380
  return A(this.container, y, m.Local).then((e) => {
381
381
  var s;
382
382
  if (e && e.id === t && e.route) {
383
- const { name: n, params: i } = e.route;
384
- (s = this.router) == null || s.navigate(n, i);
383
+ const { name: r, params: n } = e.route;
384
+ (s = this.router) == null || s.navigate(r, n);
385
385
  }
386
386
  });
387
387
  }
@@ -400,18 +400,18 @@ class b {
400
400
  name: t,
401
401
  handler: e
402
402
  };
403
- this.providers.push(s), this.controllers.filter((n) => n.conversation.providers.indexOf(t) > -1).forEach((n) => {
404
- this.invokeHandler(s, n);
403
+ this.providers.push(s), this.controllers.filter((r) => r.conversation.providers.indexOf(t) > -1).forEach((r) => {
404
+ this.invokeHandler(s, r);
405
405
  });
406
406
  }
407
407
  registerController(t, e) {
408
- const s = this.controllers.findIndex((i) => i.conversation.id === t.id);
409
- let n;
408
+ const s = this.controllers.findIndex((n) => n.conversation.id === t.id);
409
+ let r;
410
410
  if (s < 0) {
411
- n = { conversation: t, component: e }, this.controllers.push(n);
412
- const i = (o) => {
411
+ r = { conversation: t, component: e }, this.controllers.push(r);
412
+ const n = (o) => {
413
413
  o && this.providers.filter((a) => o.indexOf(a.name) > -1).forEach((a) => {
414
- this.invokeHandler(a, n);
414
+ this.invokeHandler(a, r);
415
415
  });
416
416
  };
417
417
  return this.subscriptions.push(t.onDispose((o, a) => {
@@ -419,24 +419,24 @@ class b {
419
419
  c > -1 && this.controllers.splice(c, 1), this.components.components().ofType("conversation-return-button").select().writeProperties({ active: !1 }), this.events.dispatch("conversation:ended", {}, { bubbles: !0 });
420
420
  })), this.subscriptions.push(t.onProvidersChange((o, a) => {
421
421
  const { added: c, removed: h } = a;
422
- h.forEach((u) => {
423
- this.disposeProviders[u].forEach((f) => {
422
+ h.forEach((d) => {
423
+ this.disposeProviders[d].forEach((f) => {
424
424
  f();
425
425
  });
426
- }), i(c);
426
+ }), n(c);
427
427
  })), this.subscriptions.push(t.onStarted((o, a) => {
428
- var h, u;
428
+ var h, d;
429
429
  const c = {
430
430
  id: t.id,
431
431
  route: (h = this.router) == null ? void 0 : h.getRouteData(),
432
- conversationEndedBehavior: (u = this.sessionInfo) == null ? void 0 : u.conversationEndedBehavior
432
+ conversationEndedBehavior: (d = this.sessionInfo) == null ? void 0 : d.conversationEndedBehavior
433
433
  };
434
434
  this.sessionInfo = c, this.storageWriter && this.storageWriter(c), this.writeToComponents({ active: a });
435
435
  })), this.subscriptions.push(t.onUnreadMessage((o, a) => {
436
436
  this.events.dispatch("conversation:unread-message", a), this.writeToComponents({ alert: { show: a } });
437
- })), i(t.providers), !0;
437
+ })), n(t.providers), !0;
438
438
  }
439
- return n = this.controllers[s], !1;
439
+ return r = this.controllers[s], !1;
440
440
  }
441
441
  writeToComponents(t, e = "conversationReturnButtonState") {
442
442
  this.buttonQuery && this.components.write({
@@ -462,25 +462,26 @@ class b {
462
462
  t();
463
463
  }), this.controllers = [], this.providers = [];
464
464
  }
465
- static handleContactMethodClick(t, e, s, n) {
466
- return P(this, null, function* () {
465
+ static handleContactMethodClick(t, e, s, r) {
466
+ return S(this, null, function* () {
467
467
  if (tt(e)) {
468
468
  t.preventDefault();
469
- let i = document.getElementById("humany-dynamic-anchor");
470
- i || (i = document.createElement("a"), i.setAttribute("href", "#"), i.id = "humany-dynamic-anchor", document.body.appendChild(i)), B(e, s, i);
469
+ let n = document.getElementById("humany-dynamic-anchor");
470
+ n || (n = document.createElement("a"), n.setAttribute("href", "#"), n.id = "humany-dynamic-anchor", document.body.appendChild(n)), B(e, s, n);
471
471
  }
472
472
  B(e, s);
473
473
  });
474
474
  }
475
475
  static handleContactMethodSubmit(t, e) {
476
- return P(this, null, function* () {
476
+ return S(this, null, function* () {
477
477
  return et(t, e);
478
478
  });
479
479
  }
480
480
  }
481
- const st = (r, t) => r.reduce((e, s, n) => {
481
+ var st = /* @__PURE__ */ ((i) => (i.Header = "header", i.LinkList = "link-list", i.Separator = "separator", i.NoGoodAlternative = "no-good-alternative", i.ButtonList = "button-list", i.Text = "text", i.HTML = "html", i.FeedbackList = "feedback-list", i))(st || {});
482
+ const it = (i, t) => i.reduce((e, s, r) => {
482
483
  var o, a;
483
- const i = g(p({}, s), {
484
+ const n = g(p({}, s), {
484
485
  content: [g(p({}, s.content), { key: s.key })]
485
486
  });
486
487
  if (e.length > 0 && s.type !== E.System) {
@@ -488,30 +489,30 @@ const st = (r, t) => r.reduce((e, s, n) => {
488
489
  if ((!t && t !== 0 || Math.abs(c.timestamp - s.timestamp) < t) && ((o = c.sender) == null ? void 0 : o.name) === ((a = s.sender) == null ? void 0 : a.name) && c.type === s.type)
489
490
  return c.timestamp = s.timestamp, c.content.push(g(p({}, s.content), { key: s.key })), e;
490
491
  }
491
- return e.push(i), e;
492
- }, []), lt = (r) => Promise.all([
493
- b.getInstance(r),
494
- r.getAsync("router")
495
- ]).then(([t, e]) => Q(r, "conversation", import("./conversation.edf14596.js"), (s) => {
496
- const i = e.getRouteData().params.id || s.node.name || "component", o = t.createController(i), a = t.registerController(o, s), c = 3 * 60 * 1e3, h = (l) => {
497
- const { providers: d = [] } = l;
498
- if (d) {
499
- const v = Array.isArray(d) ? d : [d];
492
+ return e.push(n), e;
493
+ }, []), lt = (i) => Promise.all([
494
+ b.getInstance(i),
495
+ i.getAsync("router")
496
+ ]).then(([t, e]) => Q(i, "conversation", import("./conversation.3981560b.js"), (s) => {
497
+ const n = e.getRouteData().params.id || s.node.name || "component", o = t.createController(n), a = t.registerController(o, s), c = 3 * 60 * 1e3, h = (l) => {
498
+ const { providers: u = [] } = l;
499
+ if (u) {
500
+ const v = Array.isArray(u) ? u : [u];
500
501
  return o.setProviders(v), v;
501
502
  }
502
503
  };
503
504
  h(s.properties(h)), o.setComponentMountedState(!0);
504
- const u = (l) => {
505
- const { loading: d, typingActors: v, messages: w } = l;
505
+ const d = (l) => {
506
+ const { loading: u, typingActors: v, messages: w } = l;
506
507
  s.writeProperties({
507
- loading: d,
508
+ loading: u,
508
509
  typingActors: v,
509
- messages: st(w, c)
510
+ messages: it(w, c)
510
511
  });
511
512
  };
512
- u(o.getMessageStream()), a && (s.actions.create("user-submit", (l, d) => {
513
- if (d) {
514
- const { preventDefault: v, validationPromise: w } = d;
513
+ d(o.getMessageStream()), a && (s.actions.create("user-submit", (l, u) => {
514
+ if (u) {
515
+ const { preventDefault: v, validationPromise: w } = u;
515
516
  if (v) {
516
517
  w && w().then((W) => {
517
518
  W && o.user.print(W);
@@ -520,55 +521,36 @@ const st = (r, t) => r.reduce((e, s, n) => {
520
521
  }
521
522
  }
522
523
  o.user.print(l.text);
523
- }), s.actions.create("user-typing", (l, d) => {
524
- }), s.actions.create("form", (l, d) => {
525
- }), s.actions.create("action", (l, d) => {
526
- }), s.actions.create("overlay-mounted", (l, d) => {
527
- }), s.actions.create("show-overlay", (l, d) => {
528
- s.writeProperties({
529
- overlay: { conversation: !1, secondary: !1 }
530
- });
531
- }), s.actions.create("hide-overlay", (l, d) => {
532
- s.writeProperties({
533
- overlay: null
534
- });
535
- }), s.actions.create("show-overlay-conversation", (l, d) => {
536
- s.writeProperties({
537
- overlay: { conversation: !0, secondary: !1 }
538
- });
539
- }), s.actions.create("hide-overlay-conversation", (l, d) => {
540
- s.writeProperties({
541
- overlay: { conversation: !1, secondary: !1 }
542
- });
524
+ }), s.actions.create("user-typing", (l, u) => {
525
+ }), s.actions.create("form", (l, u) => {
526
+ }), s.actions.create("action", (l, u) => {
543
527
  }));
544
- const f = o.events.subscribe("conversation:updated", (l, d) => {
545
- u(d);
528
+ const f = o.events.subscribe("conversation:updated", (l, u) => {
529
+ d(u);
546
530
  });
547
531
  return () => {
548
- o.setComponentMountedState(!1), f(), o.active || u({ messages: [], typingActors: [], loading: !1 });
532
+ o.setComponentMountedState(!1), f(), o.active || d({ messages: [], typingActors: [], loading: !1 });
549
533
  };
550
- }, { reuseController: !0 })), pt = (r) => Promise.all([
551
- z.getInstance(r),
552
- b.getInstance(r),
553
- r.getAsync("router")
554
- ]).then(([t, e, s]) => Q(r, "conversation-return-button", import("./return-button.facf6a45.js"), (n) => {
555
- n.actions.create("toggle", (i = {}) => {
534
+ }, { reuseController: !0 })), pt = (i) => Promise.all([
535
+ H.getInstance(i),
536
+ b.getInstance(i),
537
+ i.getAsync("router")
538
+ ]).then(([t, e, s]) => Q(i, "conversation-return-button", import("./return-button.8773c0de.js"), (r) => {
539
+ r.actions.create("toggle", (n = {}) => {
556
540
  var o;
557
541
  (o = e.getComponentRoute()) == null || o.then((a) => {
558
542
  a && s.navigate(a.name, a.params);
559
543
  });
560
544
  });
561
- }));
562
- var rt = /* @__PURE__ */ ((r) => (r.LinkList = "link-list", r.Separator = "separator", r.ButtonList = "button-list", r.Text = "text", r.HTML = "html", r.VideoRequest = "video-request", r))(rt || {});
563
- const vt = (r, t, e) => r.getAsync("componentResolver").then((s) => P(void 0, null, function* () {
564
- (yield b.getInstance(r)).addSubscription(s.registerComponent(t, J(() => e)));
545
+ })), vt = (i, t, e) => i.getAsync("componentResolver").then((s) => S(void 0, null, function* () {
546
+ (yield b.getInstance(i)).addSubscription(s.registerComponent(t, K(() => e)));
565
547
  }));
566
548
  export {
567
549
  lt as ConversationComponent,
568
550
  X as ConversationController,
569
- S as ConversationEndedBehavior,
570
- Y as ConversationEntry,
571
- rt as ConversationMessageListItemType,
551
+ P as ConversationEndedBehavior,
552
+ q as ConversationEntry,
553
+ st as ConversationMessageListItemType,
572
554
  E as ConversationMessageType,
573
555
  b as ConversationPlatform,
574
556
  pt as ConversationReturnButtonComponent,