@telia-ace/widget-conversation 1.0.34-experimental.9 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,88 +1,97 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var j = Object.defineProperty, G = Object.defineProperties;
|
|
2
|
+
var J = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var A = Object.getOwnPropertySymbols;
|
|
4
|
+
var B = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var E = (r, e, t) => e in r ? j(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, g = (r, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
7
|
+
B.call(e, t) && E(r, t, e[t]);
|
|
8
|
+
if (A)
|
|
9
|
+
for (var t of A(e))
|
|
10
|
+
M.call(e, t) && E(r, t, e[t]);
|
|
11
11
|
return r;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, m = (r, e) => G(r, J(e));
|
|
13
|
+
var $ = (r, e) => {
|
|
14
14
|
var t = {};
|
|
15
15
|
for (var s in r)
|
|
16
|
-
|
|
17
|
-
if (r != null &&
|
|
18
|
-
for (var s of
|
|
19
|
-
e.indexOf(s) < 0 &&
|
|
16
|
+
B.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
|
|
17
|
+
if (r != null && A)
|
|
18
|
+
for (var s of A(r))
|
|
19
|
+
e.indexOf(s) < 0 && M.call(r, s) && (t[s] = r[s]);
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
22
|
+
var d = (r, e, t) => (E(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
23
|
+
var v = (r, e, t) => new Promise((s, n) => {
|
|
24
|
+
var i = (c) => {
|
|
24
25
|
try {
|
|
25
26
|
o(t.next(c));
|
|
26
|
-
} catch (
|
|
27
|
-
|
|
27
|
+
} catch (h) {
|
|
28
|
+
n(h);
|
|
28
29
|
}
|
|
29
30
|
}, a = (c) => {
|
|
30
31
|
try {
|
|
31
32
|
o(t.throw(c));
|
|
32
|
-
} catch (
|
|
33
|
-
|
|
33
|
+
} catch (h) {
|
|
34
|
+
n(h);
|
|
34
35
|
}
|
|
35
|
-
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(
|
|
36
|
+
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(i, a);
|
|
36
37
|
o((t = t.apply(r, e)).next());
|
|
37
38
|
});
|
|
38
|
-
import { ComponentPlatform as
|
|
39
|
-
import { createStorageWriter as
|
|
40
|
-
import { uuid as L, lock as
|
|
41
|
-
import { FormBuilder as
|
|
42
|
-
import { closeAllModals as
|
|
39
|
+
import { ComponentPlatform as K } from "@telia-ace/widget-core";
|
|
40
|
+
import { createStorageWriter as N, StorageCategory as R, readStorage as b, StorageMedium as w, StorageScope as V } from "@telia-ace/widget-services";
|
|
41
|
+
import { uuid as L, lock as Y } from "@telia-ace/widget-utilities";
|
|
42
|
+
import { FormBuilder as X } from "@telia-ace/widget-forms";
|
|
43
|
+
import { closeAllModals as z } from "@telia-ace/widget-plugins";
|
|
43
44
|
import { createReactComponent as U } from "@telia-ace/widget-ui";
|
|
44
|
-
import { lazy as
|
|
45
|
-
class
|
|
45
|
+
import { lazy as Z } from "react";
|
|
46
|
+
class x {
|
|
46
47
|
constructor(e, t) {
|
|
47
|
-
this
|
|
48
|
-
|
|
48
|
+
d(this, "id");
|
|
49
|
+
d(this, "name");
|
|
50
|
+
d(this, "avatar");
|
|
51
|
+
d(this, "print", (e, t) => {
|
|
52
|
+
const s = {
|
|
49
53
|
name: this.name,
|
|
50
54
|
avatar: this.avatar,
|
|
51
55
|
id: this.id
|
|
52
|
-
},
|
|
56
|
+
}, n = D(e, t);
|
|
53
57
|
return this.provider.createEntry(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
n.key,
|
|
59
|
+
n.content,
|
|
60
|
+
I.Agent,
|
|
61
|
+
s,
|
|
62
|
+
n.timestamp
|
|
59
63
|
);
|
|
60
|
-
}
|
|
64
|
+
});
|
|
65
|
+
d(this, "typing", () => this.provider.setTypingState({ name: this.name, avatar: this.avatar }));
|
|
66
|
+
this.provider = e, this.id = t.id || L(), this.name = t.name, this.avatar = t.avatar;
|
|
61
67
|
}
|
|
62
68
|
update(e) {
|
|
63
|
-
var
|
|
69
|
+
var n;
|
|
64
70
|
const { name: t, avatar: s } = e;
|
|
65
|
-
s === null ? this.avatar = void 0 : s && (this.avatar = s), t === null ? this.name = void 0 : t && (this.name = t), (
|
|
71
|
+
s === null ? this.avatar = void 0 : s && (this.avatar = s), t === null ? this.name = void 0 : t && (this.name = t), (n = this.provider.controller) == null || n.events.dispatch("conversation:agent-updated", {
|
|
66
72
|
agent: this
|
|
67
73
|
});
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
|
-
class
|
|
76
|
+
class T {
|
|
71
77
|
constructor(e, t, s) {
|
|
72
|
-
this
|
|
78
|
+
d(this, "subscriptions", []);
|
|
79
|
+
d(this, "options");
|
|
80
|
+
d(this, "user");
|
|
81
|
+
this.name = e, this.container = t, this.controller = s, this.user = s == null ? void 0 : s.user, this.options = {
|
|
73
82
|
silent: !1
|
|
74
83
|
};
|
|
75
84
|
}
|
|
76
85
|
static create(e, t, s) {
|
|
77
|
-
return new
|
|
86
|
+
return new T(e, t, s);
|
|
78
87
|
}
|
|
79
88
|
createAgent(e = {}) {
|
|
80
89
|
var t;
|
|
81
90
|
if (this.controller) {
|
|
82
|
-
const s = this.controller.getAgentById(e.id),
|
|
91
|
+
const s = this.controller.getAgentById(e.id), n = s ? new x(this, g(g({}, s), e)) : new x(this, e);
|
|
83
92
|
return s || (t = this.controller) == null || t.events.dispatch("conversation:agent-created", {
|
|
84
|
-
agent:
|
|
85
|
-
}),
|
|
93
|
+
agent: n
|
|
94
|
+
}), n;
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
print(e) {
|
|
@@ -97,9 +106,9 @@ class N {
|
|
|
97
106
|
return this.controller ? this.controller.loader() : () => () => {
|
|
98
107
|
};
|
|
99
108
|
}
|
|
100
|
-
createEntry(e, t, s,
|
|
109
|
+
createEntry(e, t, s, n, i) {
|
|
101
110
|
var a;
|
|
102
|
-
return (a = this.controller) == null ? void 0 : a.createEntry(e, t, s,
|
|
111
|
+
return (a = this.controller) == null ? void 0 : a.createEntry(e, t, s, n, i);
|
|
103
112
|
}
|
|
104
113
|
dispose() {
|
|
105
114
|
var e;
|
|
@@ -139,9 +148,10 @@ class N {
|
|
|
139
148
|
}
|
|
140
149
|
}
|
|
141
150
|
const q = (r) => `conversation-${r}`;
|
|
142
|
-
class
|
|
151
|
+
class ee {
|
|
143
152
|
constructor() {
|
|
144
|
-
this
|
|
153
|
+
d(this, "_locking", Promise.resolve());
|
|
154
|
+
d(this, "_locks", 0);
|
|
145
155
|
}
|
|
146
156
|
isLocked() {
|
|
147
157
|
return this._locks > 0;
|
|
@@ -149,30 +159,33 @@ class Z {
|
|
|
149
159
|
lock() {
|
|
150
160
|
this._locks += 1;
|
|
151
161
|
let e, t = new Promise(
|
|
152
|
-
(
|
|
153
|
-
this._locks -= 1,
|
|
162
|
+
(n) => e = () => {
|
|
163
|
+
this._locks -= 1, n();
|
|
154
164
|
}
|
|
155
165
|
), s = this._locking.then(() => e);
|
|
156
166
|
return this._locking = this._locking.then(() => t), s;
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
|
-
class
|
|
169
|
+
class te {
|
|
160
170
|
constructor(e, t, s) {
|
|
161
|
-
|
|
171
|
+
d(this, "sessionStorageKey");
|
|
172
|
+
d(this, "locker", new ee());
|
|
173
|
+
d(this, "initialStoredAgents", []);
|
|
174
|
+
this.container = e, this.conversation = t, this.enabled = s, this.sessionStorageKey = q(t.id), t.onStarted(() => v(this, null, function* () {
|
|
162
175
|
if (t.messages.length > 0)
|
|
163
176
|
return;
|
|
164
|
-
const { agents:
|
|
165
|
-
|
|
166
|
-
const c = t.providerIndex(o.providerName),
|
|
167
|
-
|
|
177
|
+
const { agents: n } = yield this.read(), i = [];
|
|
178
|
+
n && n.forEach((o) => {
|
|
179
|
+
const c = t.providerIndex(o.providerName), h = c > -1 ? t.registeredProviders[c] : t.createProvider(o.providerName), u = new x(h, { name: o.name, avatar: o.avatar, id: o.id });
|
|
180
|
+
i.push(u);
|
|
168
181
|
});
|
|
169
182
|
const { messages: a } = yield this.read();
|
|
170
183
|
a.forEach((o) => {
|
|
171
184
|
switch (o.type) {
|
|
172
185
|
case "agent": {
|
|
173
|
-
const c =
|
|
174
|
-
var
|
|
175
|
-
return
|
|
186
|
+
const c = i.find((h) => {
|
|
187
|
+
var u;
|
|
188
|
+
return h.id === ((u = o.sender) == null ? void 0 : u.id);
|
|
176
189
|
});
|
|
177
190
|
c && c.print(o.content.items || o.content, {
|
|
178
191
|
key: o.key
|
|
@@ -190,23 +203,23 @@ class ee {
|
|
|
190
203
|
t.print(o.content.items || o.content);
|
|
191
204
|
}
|
|
192
205
|
});
|
|
193
|
-
})), t.onMessageCreated((
|
|
194
|
-
this.write(
|
|
195
|
-
})), t.events.subscribe("conversation:agent-created", (
|
|
206
|
+
})), t.onMessageCreated((n, i) => v(this, null, function* () {
|
|
207
|
+
this.write(i.message, "messages");
|
|
208
|
+
})), t.events.subscribe("conversation:agent-created", (n, i) => v(this, null, function* () {
|
|
196
209
|
const a = {
|
|
197
|
-
id:
|
|
198
|
-
name:
|
|
199
|
-
avatar:
|
|
200
|
-
providerName:
|
|
210
|
+
id: i.agent.id,
|
|
211
|
+
name: i.agent.name,
|
|
212
|
+
avatar: i.agent.avatar,
|
|
213
|
+
providerName: i.agent.provider.name
|
|
201
214
|
};
|
|
202
215
|
yield this.write(a, "agents");
|
|
203
|
-
})), t.events.subscribe("conversation:agent-updated", (
|
|
216
|
+
})), t.events.subscribe("conversation:agent-updated", (n, i) => v(this, null, function* () {
|
|
204
217
|
const { agents: a } = yield this.read();
|
|
205
218
|
yield this.write(
|
|
206
219
|
[
|
|
207
|
-
...a.map((o) => o.id ===
|
|
208
|
-
name:
|
|
209
|
-
avatar:
|
|
220
|
+
...a.map((o) => o.id === i.agent.id ? m(g({}, o), {
|
|
221
|
+
name: i.agent.name,
|
|
222
|
+
avatar: i.agent.avatar
|
|
210
223
|
}) : o)
|
|
211
224
|
],
|
|
212
225
|
"agents",
|
|
@@ -218,7 +231,7 @@ class ee {
|
|
|
218
231
|
this.initialStoredAgents = e.agents;
|
|
219
232
|
}
|
|
220
233
|
isRehydrated() {
|
|
221
|
-
return
|
|
234
|
+
return v(this, null, function* () {
|
|
222
235
|
const { messages: e } = yield this.read();
|
|
223
236
|
return e.length > 0;
|
|
224
237
|
});
|
|
@@ -228,73 +241,74 @@ class ee {
|
|
|
228
241
|
return this.initialStoredAgents.find((t) => t.id === e);
|
|
229
242
|
}
|
|
230
243
|
write(e, t, s = "add") {
|
|
231
|
-
return
|
|
244
|
+
return v(this, null, function* () {
|
|
232
245
|
if (!this.enabled)
|
|
233
246
|
return;
|
|
234
|
-
const
|
|
235
|
-
return
|
|
247
|
+
const n = yield this.locker.lock();
|
|
248
|
+
return N(
|
|
236
249
|
this.container,
|
|
237
250
|
this.sessionStorageKey,
|
|
238
|
-
|
|
239
|
-
).then((
|
|
251
|
+
R.Necessary
|
|
252
|
+
).then((i) => v(this, null, function* () {
|
|
240
253
|
if (s === "add") {
|
|
241
254
|
const a = yield this.read();
|
|
242
255
|
if (t === "messages" && a.messages.findIndex((c) => c.key === e.key) > -1) {
|
|
243
|
-
|
|
256
|
+
n();
|
|
244
257
|
return;
|
|
245
258
|
}
|
|
246
|
-
let o =
|
|
247
|
-
return t === "messages" ? o.messages = [...o.messages, e] : t === "agents" && (o.agents = [...o.agents, e]),
|
|
248
|
-
|
|
259
|
+
let o = g({}, a);
|
|
260
|
+
return t === "messages" ? o.messages = [...o.messages, e] : t === "agents" && (o.agents = [...o.agents, e]), i(g(g({}, a), o)).then(() => {
|
|
261
|
+
n();
|
|
249
262
|
});
|
|
250
263
|
}
|
|
251
264
|
if (s === "update" && t === "agents") {
|
|
252
265
|
const a = yield this.read();
|
|
253
|
-
return
|
|
266
|
+
return i(m(g({}, a), {
|
|
254
267
|
agents: e
|
|
255
268
|
})).then(() => {
|
|
256
|
-
|
|
269
|
+
n();
|
|
257
270
|
});
|
|
258
271
|
}
|
|
259
|
-
return
|
|
260
|
-
|
|
272
|
+
return i(e).then(() => {
|
|
273
|
+
n();
|
|
261
274
|
});
|
|
262
275
|
}));
|
|
263
276
|
});
|
|
264
277
|
}
|
|
265
278
|
read() {
|
|
266
|
-
return
|
|
267
|
-
return
|
|
279
|
+
return v(this, null, function* () {
|
|
280
|
+
return b(this.container, this.sessionStorageKey).then((e) => e || {
|
|
268
281
|
messages: [],
|
|
269
282
|
agents: []
|
|
270
283
|
});
|
|
271
284
|
});
|
|
272
285
|
}
|
|
273
286
|
}
|
|
274
|
-
const
|
|
275
|
-
class
|
|
287
|
+
const se = te;
|
|
288
|
+
class re {
|
|
276
289
|
constructor(e) {
|
|
277
|
-
this
|
|
278
|
-
const
|
|
290
|
+
d(this, "print", (e, t) => {
|
|
291
|
+
const s = D(e, t);
|
|
279
292
|
return this.controller.createEntry(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
293
|
+
s.key,
|
|
294
|
+
s.content,
|
|
295
|
+
I.User,
|
|
283
296
|
void 0,
|
|
284
|
-
|
|
297
|
+
s.timestamp
|
|
285
298
|
);
|
|
286
|
-
};
|
|
299
|
+
});
|
|
300
|
+
this.controller = e;
|
|
287
301
|
}
|
|
288
302
|
}
|
|
289
|
-
const
|
|
290
|
-
const s = yield r.getAsync("conversation"),
|
|
291
|
-
if (
|
|
292
|
-
const a = [...
|
|
303
|
+
const W = (r, e, t) => v(void 0, null, function* () {
|
|
304
|
+
const s = yield r.getAsync("conversation"), n = yield r.getAsync("components"), i = s.controllers.find((a) => a.conversation.id === e);
|
|
305
|
+
if (i) {
|
|
306
|
+
const a = [...i.conversation.providers];
|
|
293
307
|
a.forEach((c) => {
|
|
294
|
-
|
|
295
|
-
}),
|
|
296
|
-
const o =
|
|
297
|
-
|
|
308
|
+
i.conversation.setProviderOptions(c, { silent: !0 });
|
|
309
|
+
}), i.conversation.queueProviders(a), i.conversation.setProviders([t]);
|
|
310
|
+
const o = n.components().ofType("conversation");
|
|
311
|
+
n.write({
|
|
298
312
|
key: "setConversationProvider",
|
|
299
313
|
attributes: {
|
|
300
314
|
properties: { providers: [t] }
|
|
@@ -304,7 +318,7 @@ const E = (r, e, t) => u(void 0, null, function* () {
|
|
|
304
318
|
});
|
|
305
319
|
}
|
|
306
320
|
});
|
|
307
|
-
class
|
|
321
|
+
class ne {
|
|
308
322
|
constructor(e) {
|
|
309
323
|
this.writer = e;
|
|
310
324
|
}
|
|
@@ -319,68 +333,81 @@ class re {
|
|
|
319
333
|
return typeof e == "string" ? { body: e } : e.length > -1 && typeof e == "object" ? { items: e } : e;
|
|
320
334
|
}
|
|
321
335
|
}
|
|
322
|
-
var
|
|
323
|
-
const
|
|
324
|
-
let t, s = (e == null ? void 0 : e.key) || L(),
|
|
336
|
+
var I = /* @__PURE__ */ ((r) => (r.User = "user", r.Agent = "agent", r.System = "system", r))(I || {});
|
|
337
|
+
const D = (r, e) => {
|
|
338
|
+
let t, s = (e == null ? void 0 : e.key) || L(), n = Date.now();
|
|
325
339
|
if (Array.isArray(r) && r.length > -1)
|
|
326
340
|
typeof r[0] == "string" ? t = { items: [r] } : t = { items: r };
|
|
327
341
|
else if (typeof r == "string")
|
|
328
342
|
t = { body: r };
|
|
329
343
|
else if (r = r || {}, r.type)
|
|
330
|
-
t =
|
|
344
|
+
t = g({}, r);
|
|
331
345
|
else {
|
|
332
346
|
if (t = {
|
|
333
347
|
body: r.body,
|
|
334
348
|
actions: r.actions,
|
|
335
349
|
title: r.title
|
|
336
|
-
}, r.key && (s = r.key), r.timestamp && (
|
|
337
|
-
const
|
|
338
|
-
r.form(
|
|
339
|
-
const a =
|
|
350
|
+
}, r.key && (s = r.key), r.timestamp && (n = r.timestamp), typeof r.form == "function") {
|
|
351
|
+
const i = X.create(s);
|
|
352
|
+
r.form(i);
|
|
353
|
+
const a = i.get();
|
|
340
354
|
t.form = a;
|
|
341
355
|
}
|
|
342
|
-
r.timestamp === null && (
|
|
356
|
+
r.timestamp === null && (n = null);
|
|
343
357
|
}
|
|
344
|
-
return { content: t, key: s, timestamp:
|
|
345
|
-
},
|
|
358
|
+
return { content: t, key: s, timestamp: n };
|
|
359
|
+
}, H = (r, e) => {
|
|
346
360
|
if (!e)
|
|
347
361
|
return;
|
|
348
|
-
const t = JSON.stringify(e), s = r.findIndex((
|
|
362
|
+
const t = JSON.stringify(e), s = r.findIndex((n) => t === JSON.stringify(n));
|
|
349
363
|
if (s > -1)
|
|
350
364
|
return r.splice(s, 1);
|
|
351
365
|
};
|
|
352
366
|
class ie {
|
|
353
367
|
constructor(e, t, s) {
|
|
354
|
-
this
|
|
355
|
-
|
|
368
|
+
d(this, "formHandlers", {});
|
|
369
|
+
d(this, "user", new re(this));
|
|
370
|
+
d(this, "events");
|
|
371
|
+
d(this, "providers", []);
|
|
372
|
+
d(this, "active", !1);
|
|
373
|
+
d(this, "queuedProviders", []);
|
|
374
|
+
d(this, "registeredProviders", []);
|
|
375
|
+
d(this, "loaders", 0);
|
|
376
|
+
d(this, "componentMounted", !1);
|
|
377
|
+
d(this, "store");
|
|
378
|
+
d(this, "messages", []);
|
|
379
|
+
d(this, "typingActors", []);
|
|
380
|
+
d(this, "print", (e) => {
|
|
381
|
+
const t = D(e);
|
|
356
382
|
return this.createEntry(
|
|
357
|
-
|
|
358
|
-
|
|
383
|
+
t.key,
|
|
384
|
+
t.content,
|
|
359
385
|
"system",
|
|
360
386
|
void 0,
|
|
361
|
-
|
|
387
|
+
t.timestamp
|
|
362
388
|
);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
|
|
389
|
+
});
|
|
390
|
+
this.container = e, this.id = t;
|
|
391
|
+
const n = e.get("$widget");
|
|
392
|
+
this.events = n.events.createChild(this), this.store = new se(e, this, s.rehydrate);
|
|
366
393
|
}
|
|
367
394
|
setInitialStorage(e) {
|
|
368
395
|
this.store.setInitialData(e);
|
|
369
396
|
}
|
|
370
397
|
setProviders(e) {
|
|
371
398
|
const t = [], s = [];
|
|
372
|
-
this.providers.reduce((
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
}), e.forEach((
|
|
376
|
-
this.providers.indexOf(
|
|
399
|
+
this.providers.reduce((n, i) => (e.indexOf(i) === -1 && n.push(i), n), []).forEach((n) => {
|
|
400
|
+
const i = this.providers.indexOf(n);
|
|
401
|
+
i > -1 && (t.push(n), this.providers.splice(i, 1));
|
|
402
|
+
}), e.forEach((n) => {
|
|
403
|
+
this.providers.indexOf(n) === -1 && (s.push(n), this.providers.push(n));
|
|
377
404
|
}), (s.length || t.length) && this.events.dispatch("conversation:providers-changed", { added: s, removed: t });
|
|
378
405
|
}
|
|
379
406
|
createProvider(e) {
|
|
380
407
|
const t = this.providerIndex(e);
|
|
381
408
|
if (t > -1)
|
|
382
409
|
return this.registeredProviders[t];
|
|
383
|
-
const s =
|
|
410
|
+
const s = T.create(e, this.container, this);
|
|
384
411
|
return this.registeredProviders.push(s), s;
|
|
385
412
|
}
|
|
386
413
|
providerIndex(e) {
|
|
@@ -420,14 +447,14 @@ class ie {
|
|
|
420
447
|
s > -1 && this.registeredProviders[s].setOptions(t);
|
|
421
448
|
}
|
|
422
449
|
changeProvider(e) {
|
|
423
|
-
this.registeredProviders.find((s) => s.name === e) &&
|
|
450
|
+
this.registeredProviders.find((s) => s.name === e) && W(this.container, this.id, e);
|
|
424
451
|
}
|
|
425
452
|
queueProviders(e) {
|
|
426
453
|
this.queuedProviders = e;
|
|
427
454
|
}
|
|
428
455
|
onCompleteProvider() {
|
|
429
456
|
const e = this.queuedProviders.pop();
|
|
430
|
-
e &&
|
|
457
|
+
e && W(this.container, this.id, e);
|
|
431
458
|
}
|
|
432
459
|
getComponentMountedState() {
|
|
433
460
|
return this.componentMounted;
|
|
@@ -435,22 +462,22 @@ class ie {
|
|
|
435
462
|
onUnreadMessage(e) {
|
|
436
463
|
return this.events.subscribe("conversation:unread-message", e);
|
|
437
464
|
}
|
|
438
|
-
createEntry(e, t, s,
|
|
465
|
+
createEntry(e, t, s, n, i) {
|
|
439
466
|
const a = {
|
|
440
467
|
key: e,
|
|
441
468
|
content: t,
|
|
442
469
|
type: s,
|
|
443
|
-
sender:
|
|
444
|
-
timestamp:
|
|
470
|
+
sender: n || null,
|
|
471
|
+
timestamp: i || i === null ? i : Date.now()
|
|
445
472
|
};
|
|
446
|
-
this.messages.push(a), a.type === "agent" &&
|
|
447
|
-
const o = new
|
|
473
|
+
this.messages.push(a), a.type === "agent" && H(this.typingActors, n);
|
|
474
|
+
const o = new ne((c) => {
|
|
448
475
|
if (c !== null) {
|
|
449
|
-
const
|
|
450
|
-
a.content =
|
|
476
|
+
const h = c, { timestamp: u = void 0 } = h, f = $(h, ["timestamp"]);
|
|
477
|
+
a.content = f, u && (a.timestamp = u);
|
|
451
478
|
} else {
|
|
452
|
-
const
|
|
453
|
-
a.content = null,
|
|
479
|
+
const u = this.messages.indexOf(a);
|
|
480
|
+
a.content = null, u > -1 && this.messages.splice(u, 1);
|
|
454
481
|
}
|
|
455
482
|
this.events.dispatch("conversation:message-updated", { message: a }), this.update();
|
|
456
483
|
});
|
|
@@ -472,7 +499,7 @@ class ie {
|
|
|
472
499
|
}
|
|
473
500
|
setTypingState(e, t) {
|
|
474
501
|
return this.typingActors.indexOf(e) === -1 && (this.typingActors.push(e), this.update()), () => {
|
|
475
|
-
|
|
502
|
+
H(this.typingActors, e), this.update();
|
|
476
503
|
};
|
|
477
504
|
}
|
|
478
505
|
loader() {
|
|
@@ -483,34 +510,34 @@ class ie {
|
|
|
483
510
|
};
|
|
484
511
|
}
|
|
485
512
|
submitForm(e, t) {
|
|
486
|
-
this.formHandlers[e] = g(
|
|
513
|
+
this.formHandlers[e] = m(g({}, this.formHandlers[e]), { submit: t });
|
|
487
514
|
}
|
|
488
515
|
validateForm(e, t) {
|
|
489
|
-
this.formHandlers[e] = g(
|
|
516
|
+
this.formHandlers[e] = m(g({}, this.formHandlers[e]), { validate: t });
|
|
490
517
|
}
|
|
491
518
|
}
|
|
492
|
-
const
|
|
519
|
+
const oe = (r, e) => {
|
|
493
520
|
const t = r.split("_contact");
|
|
494
521
|
return e.widgets.get(t[0]);
|
|
495
|
-
},
|
|
496
|
-
const e = r.get("$widget"), { name: t, implementation: s } = r.get("$widget"),
|
|
497
|
-
return c && !a ? { chatWidget: c, mainWidget:
|
|
498
|
-
},
|
|
499
|
-
const { chatWidget: e } =
|
|
522
|
+
}, O = (r) => {
|
|
523
|
+
const e = r.get("$widget"), { name: t, implementation: s } = r.get("$widget"), n = t.indexOf("_contact") > -1 ? oe(t, s) : e, { data: i } = r.get("$settings"), { trigger: a } = n.container.get("$settings"), o = `${t.replace("_contact-method", "").replace("_contact", "")}_contact-method`, c = s.widgets.get(o);
|
|
524
|
+
return c && !a ? { chatWidget: c, mainWidget: n, data: i } : { mainWidget: n, data: i };
|
|
525
|
+
}, ae = (r) => {
|
|
526
|
+
const { chatWidget: e } = O(r);
|
|
500
527
|
return !!e;
|
|
501
|
-
},
|
|
502
|
-
const { mainWidget: s, data:
|
|
503
|
-
return
|
|
504
|
-
|
|
505
|
-
a.navigateToConversationIfActive(e.id).then(() =>
|
|
528
|
+
}, Q = (r, e, t) => {
|
|
529
|
+
const { mainWidget: s, data: n, chatWidget: i } = O(r);
|
|
530
|
+
return i ? i.state === "activated" ? i.invoke("open").then(() => {
|
|
531
|
+
i.container.getAsync("conversation").then((a) => {
|
|
532
|
+
a.navigateToConversationIfActive(e.id).then(() => z(r));
|
|
506
533
|
});
|
|
507
|
-
}) :
|
|
508
|
-
const { trigger: a } =
|
|
509
|
-
return a.action = "hide",
|
|
510
|
-
data:
|
|
534
|
+
}) : i.activate().then(() => {
|
|
535
|
+
const { trigger: a } = i.container.get("$settings");
|
|
536
|
+
return a.action = "hide", i.invoke("setSettings", () => ({
|
|
537
|
+
data: n,
|
|
511
538
|
trigger: a,
|
|
512
539
|
activate: !0
|
|
513
|
-
})).then(() =>
|
|
540
|
+
})).then(() => i.container.getAsync("components").then((o) => {
|
|
514
541
|
const c = o.components().ofType("contact-method");
|
|
515
542
|
o.write({
|
|
516
543
|
key: "setContactMethodId",
|
|
@@ -523,45 +550,45 @@ const ne = (r, e) => {
|
|
|
523
550
|
target: c,
|
|
524
551
|
provider: "localStorage"
|
|
525
552
|
});
|
|
526
|
-
const
|
|
553
|
+
const h = o.components().ofType("conversation");
|
|
527
554
|
o.write({
|
|
528
555
|
key: "setConversationProvider",
|
|
529
556
|
attributes: {
|
|
530
557
|
properties: { providers: [e.clientName] }
|
|
531
558
|
},
|
|
532
|
-
target:
|
|
559
|
+
target: h,
|
|
533
560
|
provider: "localStorage"
|
|
534
561
|
});
|
|
535
562
|
}));
|
|
536
|
-
}).then(() =>
|
|
563
|
+
}).then(() => i.invoke("attach", {
|
|
537
564
|
key: "contact-method",
|
|
538
565
|
triggerDOMElement: t,
|
|
539
566
|
withRenderState: "open"
|
|
540
|
-
})).then(() => (
|
|
541
|
-
|
|
567
|
+
})).then(() => (N(
|
|
568
|
+
i.container,
|
|
542
569
|
"activeStickyWidget",
|
|
543
|
-
|
|
570
|
+
R.Necessary,
|
|
544
571
|
{
|
|
545
|
-
medium:
|
|
546
|
-
scope:
|
|
572
|
+
medium: w.Local,
|
|
573
|
+
scope: V.Implementation
|
|
547
574
|
}
|
|
548
|
-
).then((a) => a(
|
|
549
|
-
a.setConversationEndedBehavior(
|
|
550
|
-
}).then(() =>
|
|
551
|
-
},
|
|
552
|
-
const { mainWidget: s, chatWidget:
|
|
553
|
-
return
|
|
554
|
-
|
|
555
|
-
}) : s.container.getAsync("conversation").then((
|
|
575
|
+
).then((a) => a(i.name)), i.container.getAsync("conversation").then((a) => {
|
|
576
|
+
a.setConversationEndedBehavior(C.Deactivate);
|
|
577
|
+
}).then(() => z(r)).then(() => !1))) : (s.container.getAsync("conversation").then((a) => a.navigateToConversationIfActive(e.id).then(() => a.setConversationEndedBehavior(C.Navigate))), !i);
|
|
578
|
+
}, ce = (r, e, t = "conversation") => {
|
|
579
|
+
const { mainWidget: s, chatWidget: n } = O(r);
|
|
580
|
+
return n ? n.container.getAsync("router").then((i) => {
|
|
581
|
+
i.navigate(t, { id: e.id });
|
|
582
|
+
}) : s.container.getAsync("conversation").then((i) => {
|
|
556
583
|
var a;
|
|
557
|
-
(a =
|
|
584
|
+
(a = i.setConversationEndedBehavior(C.Navigate)) == null || a.then(() => {
|
|
558
585
|
s.container.getAsync("router").then((o) => {
|
|
559
586
|
s.container.getAsync("components").then((c) => {
|
|
560
|
-
const
|
|
587
|
+
const h = c.components().ofType("conversation");
|
|
561
588
|
c.write({
|
|
562
589
|
key: "setConversationProvider",
|
|
563
590
|
attributes: { properties: { providers: [e.clientName] } },
|
|
564
|
-
target:
|
|
591
|
+
target: h,
|
|
565
592
|
provider: "localStorage"
|
|
566
593
|
});
|
|
567
594
|
}).then(() => {
|
|
@@ -570,30 +597,39 @@ const ne = (r, e) => {
|
|
|
570
597
|
});
|
|
571
598
|
});
|
|
572
599
|
});
|
|
573
|
-
},
|
|
574
|
-
var
|
|
575
|
-
class
|
|
600
|
+
}, P = "conversations";
|
|
601
|
+
var C = /* @__PURE__ */ ((r) => (r.Deactivate = "deactivate", r.Navigate = "navigate", r.None = "none", r))(C || {});
|
|
602
|
+
class k {
|
|
576
603
|
constructor(e, t) {
|
|
577
|
-
this
|
|
604
|
+
d(this, "events");
|
|
605
|
+
d(this, "controllers", []);
|
|
606
|
+
d(this, "providers", []);
|
|
607
|
+
d(this, "disposeProviders", {});
|
|
608
|
+
d(this, "subscriptions", []);
|
|
609
|
+
d(this, "storageWriter", null);
|
|
610
|
+
d(this, "router", null);
|
|
611
|
+
d(this, "buttonQuery", null);
|
|
612
|
+
d(this, "sessionInfo", null);
|
|
613
|
+
this.container = e, this.components = t;
|
|
578
614
|
const s = e.get("$widget");
|
|
579
615
|
this.events = s.events.createChild(this);
|
|
580
616
|
}
|
|
581
617
|
initialize() {
|
|
582
|
-
|
|
583
|
-
medium:
|
|
584
|
-
}).then((e) => this.storageWriter = e),
|
|
618
|
+
N(this.container, P, R.Necessary, {
|
|
619
|
+
medium: w.Local
|
|
620
|
+
}).then((e) => this.storageWriter = e), b(this.container, P, w.Local).then(
|
|
585
621
|
(e) => {
|
|
586
622
|
this.buttonQuery = this.components.components().ofType("conversation-return-button"), e && (this.sessionInfo = e, e.id && e.route && this.writeToComponents({ active: !0, alert: { show: !1 } }));
|
|
587
623
|
}
|
|
588
624
|
), this.container.getAsync("router").then((e) => this.router = e), this.events.subscribe("conversation:ended", (e, t) => {
|
|
589
|
-
var s,
|
|
625
|
+
var s, n, i;
|
|
590
626
|
switch ((s = this.sessionInfo) == null ? void 0 : s.conversationEndedBehavior) {
|
|
591
627
|
case "deactivate":
|
|
592
628
|
this.container.get("$widget").deactivate();
|
|
593
629
|
break;
|
|
594
630
|
case "navigate":
|
|
595
|
-
const o = (
|
|
596
|
-
o && ((
|
|
631
|
+
const o = (n = this.router) == null ? void 0 : n.getInitialRoute();
|
|
632
|
+
o && ((i = this.router) == null || i.navigate(o.name));
|
|
597
633
|
break;
|
|
598
634
|
}
|
|
599
635
|
this.writeToComponents({ active: !1 }), this.sessionInfo = null, this.storageWriter && this.storageWriter();
|
|
@@ -603,24 +639,24 @@ class P {
|
|
|
603
639
|
this.subscriptions.push(e);
|
|
604
640
|
}
|
|
605
641
|
static getInstance(e, t = "conversation") {
|
|
606
|
-
return
|
|
607
|
-
let
|
|
608
|
-
return
|
|
642
|
+
return Y(e)(() => e.getAsync(t).then((s) => {
|
|
643
|
+
let n = s;
|
|
644
|
+
return n || K.getInstance(e).then((i) => (n = new k(e, i), n.initialize(), e.registerAsync(t, () => n), n));
|
|
609
645
|
}));
|
|
610
646
|
}
|
|
611
647
|
navigateToConversationIfActive(e) {
|
|
612
|
-
return
|
|
648
|
+
return b(this.container, P, w.Local).then(
|
|
613
649
|
(t) => {
|
|
614
650
|
var s;
|
|
615
651
|
if (t && t.id === e && t.route) {
|
|
616
|
-
const { name:
|
|
617
|
-
(s = this.router) == null || s.navigate(
|
|
652
|
+
const { name: n, params: i } = t.route;
|
|
653
|
+
(s = this.router) == null || s.navigate(n, i);
|
|
618
654
|
}
|
|
619
655
|
}
|
|
620
656
|
);
|
|
621
657
|
}
|
|
622
658
|
setConversationEndedBehavior(e) {
|
|
623
|
-
return
|
|
659
|
+
return b(this.container, P, w.Local).then(
|
|
624
660
|
(t) => {
|
|
625
661
|
let s = t;
|
|
626
662
|
return s ? s.conversationEndedBehavior = e : s = { conversationEndedBehavior: e }, this.sessionInfo = s, this.storageWriter && this.storageWriter(this.sessionInfo) || Promise.resolve();
|
|
@@ -628,13 +664,13 @@ class P {
|
|
|
628
664
|
);
|
|
629
665
|
}
|
|
630
666
|
createController(e, t) {
|
|
631
|
-
return
|
|
632
|
-
const s = q(e), { agents:
|
|
667
|
+
return v(this, null, function* () {
|
|
668
|
+
const s = q(e), { agents: n } = (yield b(
|
|
633
669
|
this.container,
|
|
634
670
|
s
|
|
635
|
-
)) || { agents: [] },
|
|
671
|
+
)) || { agents: [] }, i = this.controllers.findIndex((o) => o.conversation.id === e);
|
|
636
672
|
let a;
|
|
637
|
-
return
|
|
673
|
+
return i > -1 ? a = this.controllers[i].conversation : a = new ie(this.container, e, t), a.setInitialStorage({ agents: n || [] }), a;
|
|
638
674
|
});
|
|
639
675
|
}
|
|
640
676
|
registerProvider(e, t) {
|
|
@@ -642,41 +678,41 @@ class P {
|
|
|
642
678
|
name: e,
|
|
643
679
|
handler: t
|
|
644
680
|
};
|
|
645
|
-
this.providers.push(s), this.controllers.filter((
|
|
646
|
-
this.invokeHandler(s,
|
|
681
|
+
this.providers.push(s), this.controllers.filter((n) => n.conversation.providers.indexOf(e) > -1).forEach((n) => {
|
|
682
|
+
this.invokeHandler(s, n);
|
|
647
683
|
});
|
|
648
684
|
}
|
|
649
685
|
registerController(e, t) {
|
|
650
|
-
const s = this.controllers.findIndex((
|
|
651
|
-
let
|
|
686
|
+
const s = this.controllers.findIndex((i) => i.conversation.id === e.id);
|
|
687
|
+
let n;
|
|
652
688
|
if (s < 0) {
|
|
653
|
-
|
|
654
|
-
const
|
|
689
|
+
n = { conversation: e, component: t }, this.controllers.push(n);
|
|
690
|
+
const i = (a) => {
|
|
655
691
|
a && this.providers.filter((o) => a.indexOf(o.name) > -1).forEach((o) => {
|
|
656
|
-
this.invokeHandler(o,
|
|
692
|
+
this.invokeHandler(o, n);
|
|
657
693
|
});
|
|
658
694
|
};
|
|
659
695
|
return this.subscriptions.push(
|
|
660
696
|
e.onDispose((a, o) => {
|
|
661
|
-
const c = this.controllers.findIndex((
|
|
697
|
+
const c = this.controllers.findIndex((h) => h.conversation === o);
|
|
662
698
|
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 });
|
|
663
699
|
})
|
|
664
700
|
), this.subscriptions.push(
|
|
665
701
|
e.onProvidersChange((a, o) => {
|
|
666
|
-
const { added: c, removed:
|
|
667
|
-
|
|
668
|
-
(this.disposeProviders[
|
|
669
|
-
|
|
702
|
+
const { added: c, removed: h = [] } = o;
|
|
703
|
+
h.forEach((u) => {
|
|
704
|
+
(this.disposeProviders[u] || []).forEach((f) => {
|
|
705
|
+
f();
|
|
670
706
|
});
|
|
671
|
-
}),
|
|
707
|
+
}), i(c);
|
|
672
708
|
})
|
|
673
709
|
), this.subscriptions.push(
|
|
674
710
|
e.onStarted((a, o) => {
|
|
675
|
-
var
|
|
711
|
+
var h, u;
|
|
676
712
|
const c = {
|
|
677
713
|
id: e.id,
|
|
678
|
-
route: (
|
|
679
|
-
conversationEndedBehavior: (
|
|
714
|
+
route: (h = this.router) == null ? void 0 : h.getRouteData(),
|
|
715
|
+
conversationEndedBehavior: (u = this.sessionInfo) == null ? void 0 : u.conversationEndedBehavior
|
|
680
716
|
};
|
|
681
717
|
this.sessionInfo = c, this.storageWriter && this.storageWriter(c), this.writeToComponents({ active: o });
|
|
682
718
|
})
|
|
@@ -684,9 +720,9 @@ class P {
|
|
|
684
720
|
e.onUnreadMessage((a, o) => {
|
|
685
721
|
this.events.dispatch("conversation:unread-message", o), this.writeToComponents({ alert: { show: o } });
|
|
686
722
|
})
|
|
687
|
-
),
|
|
723
|
+
), i(e.providers), !0;
|
|
688
724
|
}
|
|
689
|
-
return
|
|
725
|
+
return n = this.controllers[s], !1;
|
|
690
726
|
}
|
|
691
727
|
writeToComponents(e, t = "conversationReturnButtonState") {
|
|
692
728
|
this.buttonQuery && this.components.write({
|
|
@@ -704,7 +740,7 @@ class P {
|
|
|
704
740
|
s && (this.disposeProviders[e.name] || (this.disposeProviders[e.name] = []), this.disposeProviders[e.name].push(s));
|
|
705
741
|
}
|
|
706
742
|
getComponentRoute() {
|
|
707
|
-
return
|
|
743
|
+
return b(this.container, P, w.Local).then(
|
|
708
744
|
(e) => e == null ? void 0 : e.route
|
|
709
745
|
);
|
|
710
746
|
}
|
|
@@ -717,116 +753,116 @@ class P {
|
|
|
717
753
|
e();
|
|
718
754
|
}), this.controllers = [], this.providers = [];
|
|
719
755
|
}
|
|
720
|
-
static handleContactMethodClick(e, t, s,
|
|
721
|
-
return
|
|
722
|
-
if (
|
|
756
|
+
static handleContactMethodClick(e, t, s, n) {
|
|
757
|
+
return v(this, null, function* () {
|
|
758
|
+
if (ae(t)) {
|
|
723
759
|
e.preventDefault();
|
|
724
|
-
let
|
|
725
|
-
|
|
760
|
+
let i = document.getElementById("humany-dynamic-anchor");
|
|
761
|
+
i || (i = document.createElement("a"), i.setAttribute("href", "#"), i.id = "humany-dynamic-anchor", document.body.appendChild(i)), Q(t, s, i);
|
|
726
762
|
}
|
|
727
|
-
|
|
763
|
+
Q(t, s);
|
|
728
764
|
});
|
|
729
765
|
}
|
|
730
766
|
static handleContactMethodSubmit(e, t) {
|
|
731
|
-
return
|
|
732
|
-
var s,
|
|
733
|
-
return (
|
|
767
|
+
return v(this, null, function* () {
|
|
768
|
+
var s, n;
|
|
769
|
+
return (n = (s = t == null ? void 0 : t.body.form.meta) == null ? void 0 : s.conversation) != null && n.id ? W(
|
|
734
770
|
e,
|
|
735
771
|
t.body.form.meta.conversation.id,
|
|
736
772
|
t.clientName
|
|
737
|
-
) :
|
|
773
|
+
) : ce(e, t);
|
|
738
774
|
});
|
|
739
775
|
}
|
|
740
776
|
}
|
|
741
|
-
const
|
|
777
|
+
const de = (r, e) => r.reduce((t, s, n) => {
|
|
742
778
|
var a, o;
|
|
743
|
-
const
|
|
744
|
-
content: [g(
|
|
779
|
+
const i = m(g({}, s), {
|
|
780
|
+
content: [m(g({}, s.content), { key: s.key })]
|
|
745
781
|
});
|
|
746
|
-
if (t.length > 0 && s.type !==
|
|
782
|
+
if (t.length > 0 && s.type !== I.System) {
|
|
747
783
|
const c = t[t.length - 1];
|
|
748
784
|
if ((!e && e !== 0 || Math.abs(c.timestamp - s.timestamp) < e) && ((a = c.sender) == null ? void 0 : a.name) === ((o = s.sender) == null ? void 0 : o.name) && c.type === s.type)
|
|
749
|
-
return c.timestamp = s.timestamp, c.content.push(g(
|
|
785
|
+
return c.timestamp = s.timestamp, c.content.push(m(g({}, s.content), { key: s.key })), t;
|
|
750
786
|
}
|
|
751
|
-
return t.push(
|
|
752
|
-
}, []),
|
|
753
|
-
|
|
787
|
+
return t.push(i), t;
|
|
788
|
+
}, []), be = (r) => Promise.all([
|
|
789
|
+
k.getInstance(r),
|
|
754
790
|
r.getAsync("router")
|
|
755
791
|
]).then(([e, t]) => U(
|
|
756
792
|
r,
|
|
757
793
|
"conversation",
|
|
758
|
-
import("./conversation.
|
|
759
|
-
(s) =>
|
|
760
|
-
const { rehydrate:
|
|
761
|
-
const { providers:
|
|
762
|
-
if (
|
|
763
|
-
const
|
|
764
|
-
return o.setProviders(
|
|
794
|
+
import("./conversation.bc31361a.js"),
|
|
795
|
+
(s) => v(void 0, null, function* () {
|
|
796
|
+
const { rehydrate: n = !1 } = s.properties(), a = t.getRouteData().params.id || s.node.name || "component", o = yield e.createController(a, { rehydrate: n }), c = e.registerController(o, s), h = 3 * 60 * 1e3, u = (p) => {
|
|
797
|
+
const { providers: l = [] } = p;
|
|
798
|
+
if (l) {
|
|
799
|
+
const y = Array.isArray(l) ? l : [l];
|
|
800
|
+
return o.setProviders(y), y;
|
|
765
801
|
}
|
|
766
802
|
};
|
|
767
|
-
|
|
768
|
-
const
|
|
769
|
-
const { loading:
|
|
803
|
+
u(s.properties(u)), o.setComponentMountedState(!0);
|
|
804
|
+
const f = (p) => {
|
|
805
|
+
const { loading: l, typingActors: y, messages: S } = p;
|
|
770
806
|
s.writeProperties({
|
|
771
|
-
loading:
|
|
772
|
-
typingActors:
|
|
773
|
-
messages:
|
|
807
|
+
loading: l,
|
|
808
|
+
typingActors: y,
|
|
809
|
+
messages: de(S, h)
|
|
774
810
|
});
|
|
775
811
|
};
|
|
776
|
-
|
|
777
|
-
if (
|
|
778
|
-
const { preventDefault:
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
|
|
812
|
+
f(o.getMessageStream()), c && (s.writeProperties({ conversationControllerId: o.id }), s.actions.create("user-submit", (p, l) => {
|
|
813
|
+
if (l) {
|
|
814
|
+
const { preventDefault: y, validationPromise: S } = l;
|
|
815
|
+
if (y) {
|
|
816
|
+
S && S().then((_) => {
|
|
817
|
+
_ && o.user.print(_);
|
|
782
818
|
});
|
|
783
819
|
return;
|
|
784
820
|
}
|
|
785
821
|
}
|
|
786
|
-
o.user.print(
|
|
787
|
-
}), s.actions.create("user-typing", (
|
|
788
|
-
}), s.actions.create("form", (
|
|
789
|
-
}), s.actions.create("action", (
|
|
790
|
-
}), s.actions.create("overlay-mounted", (
|
|
791
|
-
}), s.actions.create("show-overlay", (
|
|
822
|
+
o.user.print(p.text);
|
|
823
|
+
}), s.actions.create("user-typing", (p, l) => {
|
|
824
|
+
}), s.actions.create("form", (p, l) => {
|
|
825
|
+
}), s.actions.create("action", (p, l) => {
|
|
826
|
+
}), s.actions.create("overlay-mounted", (p, l) => {
|
|
827
|
+
}), s.actions.create("show-overlay", (p, l) => {
|
|
792
828
|
s.writeProperties({
|
|
793
829
|
overlay: { conversation: !1, secondary: !1 }
|
|
794
830
|
});
|
|
795
|
-
}), s.actions.create("hide-overlay", (
|
|
831
|
+
}), s.actions.create("hide-overlay", (p, l) => {
|
|
796
832
|
s.writeProperties({
|
|
797
833
|
overlay: null
|
|
798
834
|
});
|
|
799
|
-
}), s.actions.create("show-overlay-conversation", (
|
|
835
|
+
}), s.actions.create("show-overlay-conversation", (p, l) => {
|
|
800
836
|
s.writeProperties({
|
|
801
837
|
overlay: { conversation: !0, secondary: !1 }
|
|
802
838
|
});
|
|
803
|
-
}), s.actions.create("hide-overlay-conversation", (
|
|
839
|
+
}), s.actions.create("hide-overlay-conversation", (p, l) => {
|
|
804
840
|
s.writeProperties({
|
|
805
841
|
overlay: { conversation: !1, secondary: !1 }
|
|
806
842
|
});
|
|
807
843
|
}));
|
|
808
|
-
const
|
|
844
|
+
const F = o.events.subscribe(
|
|
809
845
|
"conversation:updated",
|
|
810
|
-
(
|
|
811
|
-
|
|
846
|
+
(p, l) => {
|
|
847
|
+
f(l);
|
|
812
848
|
}
|
|
813
849
|
);
|
|
814
850
|
return () => {
|
|
815
|
-
o.setComponentMountedState(!1),
|
|
851
|
+
o.setComponentMountedState(!1), F(), o.active || f({ messages: [], typingActors: [], loading: !1 });
|
|
816
852
|
};
|
|
817
853
|
}),
|
|
818
854
|
{ reuseController: !0 }
|
|
819
|
-
)),
|
|
820
|
-
|
|
821
|
-
|
|
855
|
+
)), we = (r) => Promise.all([
|
|
856
|
+
K.getInstance(r),
|
|
857
|
+
k.getInstance(r),
|
|
822
858
|
r.getAsync("router")
|
|
823
859
|
]).then(
|
|
824
860
|
([e, t, s]) => U(
|
|
825
861
|
r,
|
|
826
862
|
"conversation-return-button",
|
|
827
863
|
import("./return-button.fb63a16e.js"),
|
|
828
|
-
(
|
|
829
|
-
|
|
864
|
+
(n) => {
|
|
865
|
+
n.actions.create("toggle", (i = {}) => {
|
|
830
866
|
var a;
|
|
831
867
|
(a = t.getComponentRoute()) == null || a.then((o) => {
|
|
832
868
|
o && s.navigate(o.name, o.params);
|
|
@@ -835,24 +871,24 @@ const ce = (r, e) => r.reduce((t, s, i) => {
|
|
|
835
871
|
}
|
|
836
872
|
)
|
|
837
873
|
);
|
|
838
|
-
var
|
|
839
|
-
const
|
|
840
|
-
(yield
|
|
874
|
+
var he = /* @__PURE__ */ ((r) => (r.LinkList = "link-list", r.Separator = "separator", r.ButtonList = "button-list", r.Text = "text", r.HTML = "html", r.VideoRequest = "video-request", r))(he || {});
|
|
875
|
+
const Pe = (r, e, t) => r.getAsync("componentResolver").then((s) => v(void 0, null, function* () {
|
|
876
|
+
(yield k.getInstance(r)).addSubscription(
|
|
841
877
|
s.registerComponent(
|
|
842
878
|
e,
|
|
843
|
-
|
|
879
|
+
Z(() => t)
|
|
844
880
|
)
|
|
845
881
|
);
|
|
846
882
|
}));
|
|
847
883
|
export {
|
|
848
|
-
|
|
884
|
+
be as ConversationComponent,
|
|
849
885
|
ie as ConversationController,
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
886
|
+
C as ConversationEndedBehavior,
|
|
887
|
+
ne as ConversationEntry,
|
|
888
|
+
he as ConversationMessageListItemType,
|
|
889
|
+
I as ConversationMessageType,
|
|
890
|
+
k as ConversationPlatform,
|
|
891
|
+
we as ConversationReturnButtonComponent,
|
|
892
|
+
Pe as registerCustomMessageComponent
|
|
857
893
|
};
|
|
858
894
|
//# sourceMappingURL=index.js.map
|