@telia-ace/widget-conversation 1.0.27 → 1.0.28
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/README.md +246 -106
- package/dist/{ui → components}/conversation/conversation.d.ts +0 -0
- package/dist/{ui/conversation/conversation-component.d.ts → components/conversation/plugin.d.ts} +13 -2
- package/dist/components/conversation/ui/content.d.ts +2 -0
- package/dist/{ui/conversation/conversation-input.d.ts → components/conversation/ui/input.d.ts} +0 -0
- package/dist/components/conversation/ui/loader.d.ts +9 -0
- package/dist/components/conversation/ui/message-list-items/button-list.d.ts +8 -0
- package/dist/components/conversation/ui/message-list-items/custom.d.ts +9 -0
- package/dist/components/conversation/ui/message-list-items/html.d.ts +5 -0
- package/dist/components/conversation/ui/message-list-items/link-list.d.ts +8 -0
- package/dist/components/conversation/ui/message-list-items/separator.d.ts +2 -0
- package/dist/components/conversation/ui/message-list-items/text.d.ts +6 -0
- package/dist/components/conversation/ui/message-list-items/video-request.d.ts +8 -0
- package/dist/{ui/conversation → components/conversation/ui}/message-types/agent.d.ts +1 -1
- package/dist/{ui/conversation → components/conversation/ui}/message-types/index.d.ts +0 -1
- package/dist/components/conversation/ui/message-types/message-list.d.ts +9 -0
- package/dist/{ui/conversation → components/conversation/ui}/message-types/system.d.ts +1 -1
- package/dist/{ui/conversation → components/conversation/ui}/message-types/timestamp.d.ts +0 -0
- package/dist/{ui/conversation → components/conversation/ui}/message-types/user.d.ts +0 -0
- package/dist/components/conversation/ui/message.d.ts +5 -0
- package/dist/components/conversation/ui/overlay-outlets.d.ts +13 -0
- package/dist/components/conversation/ui/styles.d.ts +31 -0
- package/dist/{ui/return-button/return-button-component.d.ts → components/return-button/plugin.d.ts} +1 -2
- package/dist/{ui → components}/return-button/return-button.d.ts +0 -0
- package/dist/conversation.d7aad569.js +1153 -0
- package/dist/conversation.d7aad569.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +453 -341
- package/dist/index.js.map +1 -1
- package/dist/{return-button.8773c0de.js → return-button.9c517bbe.js} +11 -14
- package/dist/return-button.9c517bbe.js.map +1 -0
- package/dist/types.d.ts +34 -41
- package/dist/utils/map-actions.d.ts +1 -0
- package/dist/utils/open-chat-widget.d.ts +1 -1
- package/package.json +10 -9
- package/dist/conversation.70c6987f.js +0 -1101
- package/dist/conversation.70c6987f.js.map +0 -1
- package/dist/return-button.8773c0de.js.map +0 -1
- package/dist/ui/conversation/conversation-content.d.ts +0 -11
- package/dist/ui/conversation/conversation-loader.d.ts +0 -8
- package/dist/ui/conversation/conversation-message.d.ts +0 -7
- package/dist/ui/conversation/conversation-styles.d.ts +0 -11
- package/dist/ui/conversation/index.d.ts +0 -2
- package/dist/ui/conversation/message-types/custom.d.ts +0 -9
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/return-button/index.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,231 +1,271 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
for (var s in
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var s of
|
|
19
|
-
|
|
20
|
-
return
|
|
1
|
+
var L = Object.defineProperty, _ = Object.defineProperties;
|
|
2
|
+
var F = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
|
+
var M = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var x = (r, e, t) => e in r ? L(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, v = (r, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
M.call(e, t) && x(r, t, e[t]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var t of P(e))
|
|
10
|
+
R.call(e, t) && x(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, m = (r, e) => _(r, F(e));
|
|
13
|
+
var D = (r, e) => {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var s in r)
|
|
16
|
+
M.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
|
|
17
|
+
if (r != null && P)
|
|
18
|
+
for (var s of P(r))
|
|
19
|
+
e.indexOf(s) < 0 && R.call(r, s) && (t[s] = r[s]);
|
|
20
|
+
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var d = (r, e, t) => (x(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
23
|
+
var A = (r, e, t) => new Promise((s, i) => {
|
|
23
24
|
var n = (c) => {
|
|
24
25
|
try {
|
|
25
|
-
a(
|
|
26
|
+
a(t.next(c));
|
|
26
27
|
} catch (h) {
|
|
27
|
-
|
|
28
|
+
i(h);
|
|
28
29
|
}
|
|
29
30
|
}, o = (c) => {
|
|
30
31
|
try {
|
|
31
|
-
a(
|
|
32
|
+
a(t.throw(c));
|
|
32
33
|
} catch (h) {
|
|
33
|
-
|
|
34
|
+
i(h);
|
|
34
35
|
}
|
|
35
36
|
}, a = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(n, o);
|
|
36
|
-
a((
|
|
37
|
+
a((t = t.apply(r, e)).next());
|
|
37
38
|
});
|
|
38
39
|
import { ComponentPlatform as H } from "@telia-ace/widget-core";
|
|
39
|
-
import { createStorageWriter as
|
|
40
|
-
import { uuid as
|
|
40
|
+
import { createStorageWriter as $, StorageCategory as Q, StorageMedium as f, StorageScope as j, readStorage as S } from "@telia-ace/widget-services";
|
|
41
|
+
import { uuid as q, lock as G } from "@telia-ace/widget-utilities";
|
|
41
42
|
import { FormBuilder as J } from "@telia-ace/widget-forms";
|
|
42
|
-
import { closeAllModals as
|
|
43
|
-
import { createReactComponent as
|
|
43
|
+
import { closeAllModals as O } from "@telia-ace/widget-plugins";
|
|
44
|
+
import { createReactComponent as U } from "@telia-ace/widget-ui";
|
|
44
45
|
import { lazy as K } from "react";
|
|
45
46
|
class V {
|
|
46
|
-
constructor(
|
|
47
|
-
this
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
constructor(e, t) {
|
|
48
|
+
d(this, "name");
|
|
49
|
+
d(this, "avatar");
|
|
50
|
+
d(this, "print", (e) => {
|
|
51
|
+
const t = { name: this.name, avatar: this.avatar }, s = W(e);
|
|
52
|
+
return this.provider.createEntry(
|
|
53
|
+
s.key,
|
|
54
|
+
s.content,
|
|
55
|
+
k.Agent,
|
|
56
|
+
t,
|
|
57
|
+
s.timestamp
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
d(this, "typing", () => this.provider.setTypingState({ name: this.name, avatar: this.avatar }));
|
|
61
|
+
this.provider = e, this.name = t.name, this.avatar = t.avatar;
|
|
51
62
|
}
|
|
52
|
-
update(
|
|
53
|
-
const { name:
|
|
54
|
-
s === null ? this.avatar = void 0 : s && (this.avatar = s),
|
|
63
|
+
update(e) {
|
|
64
|
+
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);
|
|
55
66
|
}
|
|
56
67
|
}
|
|
57
|
-
class
|
|
58
|
-
constructor(
|
|
59
|
-
this
|
|
68
|
+
class I {
|
|
69
|
+
constructor(e, t, s) {
|
|
70
|
+
d(this, "subscriptions", []);
|
|
71
|
+
d(this, "user");
|
|
72
|
+
this.name = e, this.container = t, this.controller = s, this.user = s == null ? void 0 : s.user;
|
|
60
73
|
}
|
|
61
|
-
static create(
|
|
62
|
-
return new
|
|
74
|
+
static create(e, t, s) {
|
|
75
|
+
return new I(e, t, s);
|
|
63
76
|
}
|
|
64
|
-
createAgent(
|
|
77
|
+
createAgent(e = {}) {
|
|
65
78
|
if (this.controller)
|
|
66
|
-
return new V(this,
|
|
79
|
+
return new V(this, e);
|
|
67
80
|
}
|
|
68
|
-
print(
|
|
69
|
-
var
|
|
70
|
-
return (
|
|
81
|
+
print(e) {
|
|
82
|
+
var t;
|
|
83
|
+
return (t = this.controller) == null ? void 0 : t.print(e);
|
|
71
84
|
}
|
|
72
|
-
setTypingState(
|
|
85
|
+
setTypingState(e, t) {
|
|
73
86
|
var s;
|
|
74
|
-
return (s = this.controller) == null ? void 0 : s.setTypingState(
|
|
87
|
+
return (s = this.controller) == null ? void 0 : s.setTypingState(e, t);
|
|
75
88
|
}
|
|
76
89
|
loading() {
|
|
77
90
|
return this.controller ? this.controller.loader() : () => () => {
|
|
78
91
|
};
|
|
79
92
|
}
|
|
80
|
-
createEntry(
|
|
93
|
+
createEntry(e, t, s, i, n) {
|
|
81
94
|
var o;
|
|
82
|
-
return (o = this.controller) == null ? void 0 : o.createEntry(
|
|
95
|
+
return (o = this.controller) == null ? void 0 : o.createEntry(e, t, s, i, n);
|
|
83
96
|
}
|
|
84
97
|
dispose() {
|
|
85
|
-
var t;
|
|
86
|
-
process.env.NODE_ENV !== "production" && console.log(`conversation-provider: dispose (${this.name})`), (t = this.controller) == null || t.disposeProvider(this), this.controller = null, this.subscriptions.forEach((e) => e());
|
|
87
|
-
}
|
|
88
|
-
onUnreadMessage(t) {
|
|
89
98
|
var e;
|
|
99
|
+
process.env.NODE_ENV !== "production" && console.log(`conversation-provider: dispose (${this.name})`), (e = this.controller) == null || e.disposeProvider(this), this.controller = null, this.subscriptions.forEach((t) => t());
|
|
100
|
+
}
|
|
101
|
+
onUnreadMessage(e) {
|
|
102
|
+
var t;
|
|
90
103
|
if (this.controller) {
|
|
91
|
-
const s = (
|
|
104
|
+
const s = (t = this.controller) == null ? void 0 : t.onUnreadMessage(e);
|
|
92
105
|
return this.subscriptions.push(s), () => {
|
|
93
106
|
s();
|
|
94
107
|
};
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
|
-
onMounted(
|
|
98
|
-
var
|
|
110
|
+
onMounted(e) {
|
|
111
|
+
var t;
|
|
99
112
|
if (this.controller) {
|
|
100
|
-
const s = (
|
|
101
|
-
|
|
113
|
+
const s = (t = this.controller) == null ? void 0 : t.events.subscribe(
|
|
114
|
+
"conversation:component-mount-changed",
|
|
115
|
+
e
|
|
116
|
+
);
|
|
117
|
+
return this.subscriptions.push(s), e({}, this.controller.getComponentMountedState()), () => {
|
|
102
118
|
s();
|
|
103
119
|
};
|
|
104
120
|
}
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
class Y {
|
|
108
|
-
constructor(
|
|
109
|
-
this
|
|
110
|
-
const
|
|
111
|
-
return this.controller.createEntry(
|
|
112
|
-
|
|
124
|
+
constructor(e) {
|
|
125
|
+
d(this, "print", (e) => {
|
|
126
|
+
const t = W(e);
|
|
127
|
+
return this.controller.createEntry(
|
|
128
|
+
t.key,
|
|
129
|
+
t.content,
|
|
130
|
+
k.User,
|
|
131
|
+
void 0,
|
|
132
|
+
t.timestamp
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
this.controller = e;
|
|
113
136
|
}
|
|
114
137
|
}
|
|
115
|
-
class
|
|
116
|
-
constructor(
|
|
117
|
-
this.writer =
|
|
138
|
+
class X {
|
|
139
|
+
constructor(e) {
|
|
140
|
+
this.writer = e;
|
|
118
141
|
}
|
|
119
|
-
update(
|
|
120
|
-
const
|
|
121
|
-
this.writer(
|
|
142
|
+
update(e) {
|
|
143
|
+
const t = this.getNormalizedSettings(e);
|
|
144
|
+
this.writer(t);
|
|
122
145
|
}
|
|
123
146
|
remove() {
|
|
124
147
|
this.writer(null);
|
|
125
148
|
}
|
|
126
|
-
getNormalizedSettings(
|
|
127
|
-
return typeof
|
|
149
|
+
getNormalizedSettings(e) {
|
|
150
|
+
return typeof e == "string" ? { body: e } : e.length > -1 && typeof e == "object" ? { items: e } : e;
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
|
-
var
|
|
131
|
-
const
|
|
132
|
-
let
|
|
133
|
-
if (
|
|
134
|
-
typeof
|
|
135
|
-
else if (typeof
|
|
136
|
-
|
|
137
|
-
else if (
|
|
138
|
-
|
|
153
|
+
var k = /* @__PURE__ */ ((r) => (r.User = "user", r.Agent = "agent", r.System = "system", r))(k || {});
|
|
154
|
+
const W = (r) => {
|
|
155
|
+
let e, t = q(), s = Date.now();
|
|
156
|
+
if (Array.isArray(r) && r.length > -1)
|
|
157
|
+
typeof r[0] == "string" ? e = { items: [r] } : e = { items: r };
|
|
158
|
+
else if (typeof r == "string")
|
|
159
|
+
e = { body: r };
|
|
160
|
+
else if (r = r || {}, r.type)
|
|
161
|
+
e = v({}, r);
|
|
139
162
|
else {
|
|
140
|
-
if (
|
|
141
|
-
body:
|
|
142
|
-
actions:
|
|
143
|
-
title:
|
|
144
|
-
},
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
const n =
|
|
148
|
-
|
|
163
|
+
if (e = {
|
|
164
|
+
body: r.body,
|
|
165
|
+
actions: r.actions,
|
|
166
|
+
title: r.title
|
|
167
|
+
}, r.key && (t = r.key), r.timestamp && (s = r.timestamp), r.form) {
|
|
168
|
+
const i = J.create(t);
|
|
169
|
+
r.form(i);
|
|
170
|
+
const n = i.get();
|
|
171
|
+
e.form = n;
|
|
149
172
|
}
|
|
150
|
-
|
|
173
|
+
r.timestamp === null && (s = null);
|
|
151
174
|
}
|
|
152
|
-
return { content:
|
|
153
|
-
},
|
|
154
|
-
if (!
|
|
175
|
+
return { content: e, key: t, timestamp: s };
|
|
176
|
+
}, B = (r, e) => {
|
|
177
|
+
if (!e)
|
|
155
178
|
return;
|
|
156
|
-
const
|
|
179
|
+
const t = JSON.stringify(e), s = r.findIndex((i) => t === JSON.stringify(i));
|
|
157
180
|
if (s > -1)
|
|
158
|
-
return
|
|
181
|
+
return r.splice(s, 1);
|
|
159
182
|
};
|
|
160
|
-
class
|
|
161
|
-
constructor(
|
|
162
|
-
this
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
183
|
+
class Z {
|
|
184
|
+
constructor(e, t) {
|
|
185
|
+
d(this, "formHandlers", {});
|
|
186
|
+
d(this, "user", new Y(this));
|
|
187
|
+
d(this, "events");
|
|
188
|
+
d(this, "providers", []);
|
|
189
|
+
d(this, "active", !1);
|
|
190
|
+
d(this, "registeredProviders", []);
|
|
191
|
+
d(this, "loaders", 0);
|
|
192
|
+
d(this, "componentMounted", !1);
|
|
193
|
+
d(this, "messages", []);
|
|
194
|
+
d(this, "typingActors", []);
|
|
195
|
+
d(this, "print", (e) => {
|
|
196
|
+
const t = W(e);
|
|
197
|
+
return this.createEntry(
|
|
198
|
+
t.key,
|
|
199
|
+
t.content,
|
|
200
|
+
"system",
|
|
201
|
+
void 0,
|
|
202
|
+
t.timestamp
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
this.container = e, this.id = t;
|
|
206
|
+
const s = e.get("$widget");
|
|
167
207
|
this.events = s.events.createChild(this);
|
|
168
208
|
}
|
|
169
|
-
setProviders(
|
|
170
|
-
const
|
|
171
|
-
this.providers.reduce((
|
|
172
|
-
const n = this.providers.indexOf(
|
|
173
|
-
n > -1 && (
|
|
174
|
-
}),
|
|
175
|
-
this.providers.indexOf(
|
|
176
|
-
}), (s.length ||
|
|
177
|
-
}
|
|
178
|
-
createProvider(
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
return this.registeredProviders[
|
|
182
|
-
const s =
|
|
209
|
+
setProviders(e) {
|
|
210
|
+
const t = [], s = [];
|
|
211
|
+
this.providers.reduce((i, n) => (e.indexOf(n) === -1 && i.push(n), i), []).forEach((i) => {
|
|
212
|
+
const n = this.providers.indexOf(i);
|
|
213
|
+
n > -1 && (t.push(i), this.providers.splice(n, 1));
|
|
214
|
+
}), e.forEach((i) => {
|
|
215
|
+
this.providers.indexOf(i) === -1 && (s.push(i), this.providers.push(i));
|
|
216
|
+
}), (s.length || t.length) && this.events.dispatch("conversation:providers-changed", { added: s, removed: t });
|
|
217
|
+
}
|
|
218
|
+
createProvider(e) {
|
|
219
|
+
const t = this.providerIndex(e);
|
|
220
|
+
if (t > -1)
|
|
221
|
+
return this.registeredProviders[t];
|
|
222
|
+
const s = I.create(e, this.container, this);
|
|
183
223
|
return this.registeredProviders.push(s), s;
|
|
184
224
|
}
|
|
185
|
-
providerIndex(
|
|
186
|
-
return this.registeredProviders.findIndex((
|
|
225
|
+
providerIndex(e) {
|
|
226
|
+
return this.registeredProviders.findIndex((t) => t.name === e);
|
|
187
227
|
}
|
|
188
228
|
dispose() {
|
|
189
|
-
this.registeredProviders.forEach((
|
|
229
|
+
this.registeredProviders.forEach((e) => e.dispose()), this.messages = [], this.events.dispatch("conversation:controller-disposed", this), this.active = !1;
|
|
190
230
|
}
|
|
191
|
-
onDispose(
|
|
192
|
-
return this.events.subscribe("conversation:controller-disposed",
|
|
231
|
+
onDispose(e) {
|
|
232
|
+
return this.events.subscribe("conversation:controller-disposed", e);
|
|
193
233
|
}
|
|
194
|
-
onStarted(
|
|
195
|
-
return this.events.subscribe("conversation:started",
|
|
234
|
+
onStarted(e) {
|
|
235
|
+
return this.events.subscribe("conversation:started", e);
|
|
196
236
|
}
|
|
197
|
-
disposeProvider(
|
|
198
|
-
const
|
|
199
|
-
|
|
237
|
+
disposeProvider(e) {
|
|
238
|
+
const t = this.providerIndex(e.name);
|
|
239
|
+
t > -1 && this.registeredProviders.splice(t, 1), this.events.dispatch("conversation:providers-changed", { removed: [e.name] }), this.registeredProviders.length || this.dispose();
|
|
200
240
|
}
|
|
201
|
-
onProvidersChange(
|
|
202
|
-
return this.events.subscribe("conversation:providers-changed",
|
|
241
|
+
onProvidersChange(e) {
|
|
242
|
+
return this.events.subscribe("conversation:providers-changed", e);
|
|
203
243
|
}
|
|
204
|
-
setComponentMountedState(
|
|
205
|
-
this.componentMounted !==
|
|
244
|
+
setComponentMountedState(e) {
|
|
245
|
+
this.componentMounted !== e && (this.componentMounted = e, e && (this.events.dispatch("conversation:unread-message", !1), this.events.dispatch("conversation:started", !0), this.active = !0), this.events.dispatch("conversation:component-mount-changed", e));
|
|
206
246
|
}
|
|
207
247
|
getComponentMountedState() {
|
|
208
248
|
return this.componentMounted;
|
|
209
249
|
}
|
|
210
|
-
onUnreadMessage(
|
|
211
|
-
return this.events.subscribe("conversation:unread-message",
|
|
250
|
+
onUnreadMessage(e) {
|
|
251
|
+
return this.events.subscribe("conversation:unread-message", e);
|
|
212
252
|
}
|
|
213
|
-
createEntry(
|
|
253
|
+
createEntry(e, t, s, i, n) {
|
|
214
254
|
const o = {
|
|
215
|
-
key:
|
|
216
|
-
content:
|
|
255
|
+
key: e,
|
|
256
|
+
content: t,
|
|
217
257
|
type: s,
|
|
218
|
-
sender:
|
|
258
|
+
sender: i || null,
|
|
219
259
|
timestamp: n || n === null ? n : Date.now()
|
|
220
260
|
};
|
|
221
|
-
this.messages.push(o), o.type === "agent" &&
|
|
222
|
-
const a = new
|
|
261
|
+
this.messages.push(o), o.type === "agent" && B(this.typingActors, i);
|
|
262
|
+
const a = new X((c) => {
|
|
223
263
|
if (c !== null) {
|
|
224
|
-
const h = c, { timestamp:
|
|
225
|
-
o.content =
|
|
264
|
+
const h = c, { timestamp: l = void 0 } = h, y = D(h, ["timestamp"]);
|
|
265
|
+
o.content = y, l && (o.timestamp = l);
|
|
226
266
|
} else {
|
|
227
|
-
const
|
|
228
|
-
o.content = null,
|
|
267
|
+
const l = this.messages.indexOf(o);
|
|
268
|
+
o.content = null, l > -1 && this.messages.splice(l, 1);
|
|
229
269
|
}
|
|
230
270
|
this.events.dispatch("conversation:message-updated", { message: o }), this.update();
|
|
231
271
|
});
|
|
@@ -245,44 +285,44 @@ class X {
|
|
|
245
285
|
typingActors: this.typingActors
|
|
246
286
|
};
|
|
247
287
|
}
|
|
248
|
-
setTypingState(
|
|
249
|
-
return this.typingActors.indexOf(
|
|
250
|
-
|
|
288
|
+
setTypingState(e, t) {
|
|
289
|
+
return this.typingActors.indexOf(e) === -1 && (this.typingActors.push(e), this.update()), () => {
|
|
290
|
+
B(this.typingActors, e), this.update();
|
|
251
291
|
};
|
|
252
292
|
}
|
|
253
293
|
loader() {
|
|
254
294
|
this.loaders = this.loaders + 1;
|
|
255
|
-
let
|
|
295
|
+
let e = !1;
|
|
256
296
|
return this.loaders === 1 && this.update(), () => {
|
|
257
|
-
|
|
297
|
+
e || (e = !0, this.loaders = this.loaders - 1, this.loaders === 0 && this.update());
|
|
258
298
|
};
|
|
259
299
|
}
|
|
260
|
-
submitForm(
|
|
261
|
-
this.formHandlers[
|
|
300
|
+
submitForm(e, t) {
|
|
301
|
+
this.formHandlers[e] = m(v({}, this.formHandlers[e]), { submit: t });
|
|
262
302
|
}
|
|
263
|
-
validateForm(
|
|
264
|
-
this.formHandlers[
|
|
303
|
+
validateForm(e, t) {
|
|
304
|
+
this.formHandlers[e] = m(v({}, this.formHandlers[e]), { validate: t });
|
|
265
305
|
}
|
|
266
306
|
}
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
return
|
|
270
|
-
},
|
|
271
|
-
const
|
|
272
|
-
return c && !o ? { chatWidget: c, mainWidget:
|
|
273
|
-
},
|
|
274
|
-
const { chatWidget:
|
|
275
|
-
return !!
|
|
276
|
-
},
|
|
277
|
-
const { mainWidget: s, data:
|
|
307
|
+
const ee = (r, e) => {
|
|
308
|
+
const t = r.split("_contact");
|
|
309
|
+
return e.widgets.get(t[0]);
|
|
310
|
+
}, T = (r) => {
|
|
311
|
+
const e = r.get("$widget"), { name: t, implementation: s } = r.get("$widget"), i = t.indexOf("_contact") > -1 ? ee(t, s) : e, { data: n } = r.get("$settings"), { trigger: o } = i.container.get("$settings"), a = `${t.replace("_contact-method", "").replace("_contact", "")}_contact-method`, c = s.widgets.get(a);
|
|
312
|
+
return c && !o ? { chatWidget: c, mainWidget: i, data: n } : { mainWidget: i, data: n };
|
|
313
|
+
}, te = (r) => {
|
|
314
|
+
const { chatWidget: e } = T(r);
|
|
315
|
+
return !!e;
|
|
316
|
+
}, z = (r, e, t) => {
|
|
317
|
+
const { mainWidget: s, data: i, chatWidget: n } = T(r);
|
|
278
318
|
return n ? n.state === "activated" ? n.invoke("open").then(() => {
|
|
279
319
|
n.container.getAsync("conversation").then((o) => {
|
|
280
|
-
o.navigateToConversationIfActive(
|
|
320
|
+
o.navigateToConversationIfActive(e.id).then(() => O(r));
|
|
281
321
|
});
|
|
282
322
|
}) : n.activate().then(() => {
|
|
283
323
|
const { trigger: o } = n.container.get("$settings");
|
|
284
324
|
return o.action = "hide", n.invoke("setSettings", () => ({
|
|
285
|
-
data:
|
|
325
|
+
data: i,
|
|
286
326
|
trigger: o,
|
|
287
327
|
activate: !0
|
|
288
328
|
})).then(() => n.container.getAsync("components").then((a) => {
|
|
@@ -291,8 +331,8 @@ const Z = (i, t) => {
|
|
|
291
331
|
key: "setContactMethodId",
|
|
292
332
|
attributes: {
|
|
293
333
|
properties: {
|
|
294
|
-
id:
|
|
295
|
-
guideId:
|
|
334
|
+
id: e.id,
|
|
335
|
+
guideId: e.guideId
|
|
296
336
|
}
|
|
297
337
|
},
|
|
298
338
|
target: c,
|
|
@@ -302,7 +342,7 @@ const Z = (i, t) => {
|
|
|
302
342
|
a.write({
|
|
303
343
|
key: "setConversationProvider",
|
|
304
344
|
attributes: {
|
|
305
|
-
properties: { providers: [
|
|
345
|
+
properties: { providers: [e.clientName] }
|
|
306
346
|
},
|
|
307
347
|
target: h,
|
|
308
348
|
provider: "localStorage"
|
|
@@ -310,250 +350,322 @@ const Z = (i, t) => {
|
|
|
310
350
|
}));
|
|
311
351
|
}).then(() => n.invoke("attach", {
|
|
312
352
|
key: "contact-method",
|
|
313
|
-
triggerDOMElement:
|
|
353
|
+
triggerDOMElement: t,
|
|
314
354
|
withRenderState: "open"
|
|
315
|
-
})).then(() => (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
355
|
+
})).then(() => ($(
|
|
356
|
+
n.container,
|
|
357
|
+
"activeStickyWidget",
|
|
358
|
+
Q.Necessary,
|
|
359
|
+
{
|
|
360
|
+
medium: f.Local,
|
|
361
|
+
scope: j.Implementation
|
|
362
|
+
}
|
|
363
|
+
).then((o) => o(n.name)), n.container.getAsync("conversation").then((o) => {
|
|
364
|
+
o.setConversationEndedBehavior(E.Deactivate);
|
|
365
|
+
}).then(() => O(r)).then(() => !1))) : (s.container.getAsync("conversation").then((o) => o.navigateToConversationIfActive(e.id).then(() => o.setConversationEndedBehavior(E.Navigate))), !n);
|
|
366
|
+
}, se = (r, e, t = "conversation") => {
|
|
367
|
+
const { mainWidget: s, chatWidget: i } = T(r);
|
|
368
|
+
return i ? i.container.getAsync("router").then((n) => {
|
|
369
|
+
n.navigate(t, { id: e.id });
|
|
325
370
|
}) : s.container.getAsync("conversation").then((n) => {
|
|
326
371
|
var o;
|
|
327
|
-
(o = n.setConversationEndedBehavior(
|
|
372
|
+
(o = n.setConversationEndedBehavior(E.Navigate)) == null || o.then(() => {
|
|
328
373
|
s.container.getAsync("router").then((a) => {
|
|
329
374
|
s.container.getAsync("components").then((c) => {
|
|
330
375
|
const h = c.components().ofType("conversation");
|
|
331
376
|
c.write({
|
|
332
377
|
key: "setConversationProvider",
|
|
333
|
-
attributes: { properties: { providers: [
|
|
378
|
+
attributes: { properties: { providers: [e.clientName] } },
|
|
334
379
|
target: h,
|
|
335
380
|
provider: "localStorage"
|
|
336
381
|
});
|
|
337
382
|
}).then(() => {
|
|
338
|
-
a.navigate(
|
|
383
|
+
a.navigate(t, { id: e.id });
|
|
339
384
|
});
|
|
340
385
|
});
|
|
341
386
|
});
|
|
342
387
|
});
|
|
343
|
-
},
|
|
344
|
-
var
|
|
345
|
-
class
|
|
346
|
-
constructor(
|
|
347
|
-
this
|
|
348
|
-
|
|
388
|
+
}, b = "conversations";
|
|
389
|
+
var E = /* @__PURE__ */ ((r) => (r.Deactivate = "deactivate", r.Navigate = "navigate", r.None = "none", r))(E || {});
|
|
390
|
+
class w {
|
|
391
|
+
constructor(e, t) {
|
|
392
|
+
d(this, "events");
|
|
393
|
+
d(this, "controllers", []);
|
|
394
|
+
d(this, "providers", []);
|
|
395
|
+
d(this, "disposeProviders", {});
|
|
396
|
+
d(this, "subscriptions", []);
|
|
397
|
+
d(this, "storageWriter", null);
|
|
398
|
+
d(this, "router", null);
|
|
399
|
+
d(this, "buttonQuery", null);
|
|
400
|
+
d(this, "sessionInfo", null);
|
|
401
|
+
this.container = e, this.components = t;
|
|
402
|
+
const s = e.get("$widget");
|
|
349
403
|
this.events = s.events.createChild(this);
|
|
350
404
|
}
|
|
351
405
|
initialize() {
|
|
352
|
-
|
|
353
|
-
medium:
|
|
354
|
-
}).then((
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
406
|
+
$(this.container, b, Q.Necessary, {
|
|
407
|
+
medium: f.Local
|
|
408
|
+
}).then((e) => this.storageWriter = e), S(this.container, b, f.Local).then(
|
|
409
|
+
(e) => {
|
|
410
|
+
this.buttonQuery = this.components.components().ofType("conversation-return-button"), e && (this.sessionInfo = e, e.id && e.route && this.writeToComponents({ active: !0, alert: { show: !1 } }));
|
|
411
|
+
}
|
|
412
|
+
), this.container.getAsync("router").then((e) => this.router = e), this.events.subscribe("conversation:ended", (e, t) => {
|
|
413
|
+
var s, i, n;
|
|
358
414
|
switch ((s = this.sessionInfo) == null ? void 0 : s.conversationEndedBehavior) {
|
|
359
415
|
case "deactivate":
|
|
360
416
|
this.container.get("$widget").deactivate();
|
|
361
417
|
break;
|
|
362
418
|
case "navigate":
|
|
363
|
-
const a = (
|
|
419
|
+
const a = (i = this.router) == null ? void 0 : i.getInitialRoute();
|
|
364
420
|
a && ((n = this.router) == null || n.navigate(a.name));
|
|
365
421
|
break;
|
|
366
422
|
}
|
|
367
423
|
this.writeToComponents({ active: !1 }), this.sessionInfo = null, this.storageWriter && this.storageWriter();
|
|
368
424
|
});
|
|
369
425
|
}
|
|
370
|
-
addSubscription(
|
|
371
|
-
this.subscriptions.push(
|
|
426
|
+
addSubscription(e) {
|
|
427
|
+
this.subscriptions.push(e);
|
|
372
428
|
}
|
|
373
|
-
static getInstance(
|
|
374
|
-
return G(
|
|
375
|
-
let
|
|
376
|
-
return
|
|
429
|
+
static getInstance(e, t = "conversation") {
|
|
430
|
+
return G(e)(() => e.getAsync(t).then((s) => {
|
|
431
|
+
let i = s;
|
|
432
|
+
return i || H.getInstance(e).then((n) => (i = new w(e, n), i.initialize(), e.registerAsync(t, () => i), i));
|
|
377
433
|
}));
|
|
378
434
|
}
|
|
379
|
-
navigateToConversationIfActive(
|
|
380
|
-
return
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
435
|
+
navigateToConversationIfActive(e) {
|
|
436
|
+
return S(this.container, b, f.Local).then(
|
|
437
|
+
(t) => {
|
|
438
|
+
var s;
|
|
439
|
+
if (t && t.id === e && t.route) {
|
|
440
|
+
const { name: i, params: n } = t.route;
|
|
441
|
+
(s = this.router) == null || s.navigate(i, n);
|
|
442
|
+
}
|
|
385
443
|
}
|
|
386
|
-
|
|
444
|
+
);
|
|
387
445
|
}
|
|
388
|
-
setConversationEndedBehavior(
|
|
389
|
-
return
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
446
|
+
setConversationEndedBehavior(e) {
|
|
447
|
+
return S(this.container, b, f.Local).then(
|
|
448
|
+
(t) => {
|
|
449
|
+
let s = t;
|
|
450
|
+
return s ? s.conversationEndedBehavior = e : s = { conversationEndedBehavior: e }, this.sessionInfo = s, this.storageWriter && this.storageWriter(this.sessionInfo) || Promise.resolve();
|
|
451
|
+
}
|
|
452
|
+
);
|
|
393
453
|
}
|
|
394
|
-
createController(
|
|
395
|
-
const
|
|
396
|
-
return
|
|
454
|
+
createController(e) {
|
|
455
|
+
const t = this.controllers.findIndex((s) => s.conversation.id === e);
|
|
456
|
+
return t > -1 ? this.controllers[t].conversation : new Z(this.container, e);
|
|
397
457
|
}
|
|
398
|
-
registerProvider(
|
|
458
|
+
registerProvider(e, t) {
|
|
399
459
|
const s = {
|
|
400
|
-
name:
|
|
401
|
-
handler:
|
|
460
|
+
name: e,
|
|
461
|
+
handler: t
|
|
402
462
|
};
|
|
403
|
-
this.providers.push(s), this.controllers.filter((
|
|
404
|
-
this.invokeHandler(s,
|
|
463
|
+
this.providers.push(s), this.controllers.filter((i) => i.conversation.providers.indexOf(e) > -1).forEach((i) => {
|
|
464
|
+
this.invokeHandler(s, i);
|
|
405
465
|
});
|
|
406
466
|
}
|
|
407
|
-
registerController(
|
|
408
|
-
const s = this.controllers.findIndex((n) => n.conversation.id ===
|
|
409
|
-
let
|
|
467
|
+
registerController(e, t) {
|
|
468
|
+
const s = this.controllers.findIndex((n) => n.conversation.id === e.id);
|
|
469
|
+
let i;
|
|
410
470
|
if (s < 0) {
|
|
411
|
-
|
|
471
|
+
i = { conversation: e, component: t }, this.controllers.push(i);
|
|
412
472
|
const n = (o) => {
|
|
413
473
|
o && this.providers.filter((a) => o.indexOf(a.name) > -1).forEach((a) => {
|
|
414
|
-
this.invokeHandler(a,
|
|
474
|
+
this.invokeHandler(a, i);
|
|
415
475
|
});
|
|
416
476
|
};
|
|
417
|
-
return this.subscriptions.push(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
477
|
+
return this.subscriptions.push(
|
|
478
|
+
e.onDispose((o, a) => {
|
|
479
|
+
const c = this.controllers.findIndex((h) => h.conversation === a);
|
|
480
|
+
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 });
|
|
481
|
+
})
|
|
482
|
+
), this.subscriptions.push(
|
|
483
|
+
e.onProvidersChange((o, a) => {
|
|
484
|
+
const { added: c, removed: h } = a;
|
|
485
|
+
h.forEach((l) => {
|
|
486
|
+
this.disposeProviders[l].forEach((y) => {
|
|
487
|
+
y();
|
|
488
|
+
});
|
|
489
|
+
}), n(c);
|
|
490
|
+
})
|
|
491
|
+
), this.subscriptions.push(
|
|
492
|
+
e.onStarted((o, a) => {
|
|
493
|
+
var h, l;
|
|
494
|
+
const c = {
|
|
495
|
+
id: e.id,
|
|
496
|
+
route: (h = this.router) == null ? void 0 : h.getRouteData(),
|
|
497
|
+
conversationEndedBehavior: (l = this.sessionInfo) == null ? void 0 : l.conversationEndedBehavior
|
|
498
|
+
};
|
|
499
|
+
this.sessionInfo = c, this.storageWriter && this.storageWriter(c), this.writeToComponents({ active: a });
|
|
500
|
+
})
|
|
501
|
+
), this.subscriptions.push(
|
|
502
|
+
e.onUnreadMessage((o, a) => {
|
|
503
|
+
this.events.dispatch("conversation:unread-message", a), this.writeToComponents({ alert: { show: a } });
|
|
504
|
+
})
|
|
505
|
+
), n(e.providers), !0;
|
|
438
506
|
}
|
|
439
|
-
return
|
|
507
|
+
return i = this.controllers[s], !1;
|
|
440
508
|
}
|
|
441
|
-
writeToComponents(
|
|
509
|
+
writeToComponents(e, t = "conversationReturnButtonState") {
|
|
442
510
|
this.buttonQuery && this.components.write({
|
|
443
511
|
key: "conversationReturnButtonState",
|
|
444
|
-
attributes: { properties:
|
|
512
|
+
attributes: { properties: e },
|
|
445
513
|
target: this.buttonQuery,
|
|
446
514
|
provider: "localStorage"
|
|
447
515
|
});
|
|
448
516
|
}
|
|
449
|
-
invokeHandler(
|
|
450
|
-
const s =
|
|
451
|
-
|
|
517
|
+
invokeHandler(e, t) {
|
|
518
|
+
const s = e.handler(
|
|
519
|
+
t.conversation.createProvider(e.name),
|
|
520
|
+
t.component
|
|
521
|
+
);
|
|
522
|
+
s && (this.disposeProviders[e.name] || (this.disposeProviders[e.name] = []), this.disposeProviders[e.name].push(s));
|
|
452
523
|
}
|
|
453
524
|
getComponentRoute() {
|
|
454
|
-
return
|
|
525
|
+
return S(this.container, b, f.Local).then(
|
|
526
|
+
(e) => e == null ? void 0 : e.route
|
|
527
|
+
);
|
|
455
528
|
}
|
|
456
529
|
dispose() {
|
|
457
|
-
Object.keys(this.disposeProviders).forEach((
|
|
458
|
-
this.disposeProviders[
|
|
459
|
-
|
|
530
|
+
Object.keys(this.disposeProviders).forEach((e) => {
|
|
531
|
+
this.disposeProviders[e].forEach((t) => {
|
|
532
|
+
t();
|
|
460
533
|
});
|
|
461
|
-
}), this.subscriptions.forEach((
|
|
462
|
-
|
|
534
|
+
}), this.subscriptions.forEach((e) => {
|
|
535
|
+
e();
|
|
463
536
|
}), this.controllers = [], this.providers = [];
|
|
464
537
|
}
|
|
465
|
-
static handleContactMethodClick(
|
|
466
|
-
return
|
|
467
|
-
if (
|
|
468
|
-
|
|
538
|
+
static handleContactMethodClick(e, t, s, i) {
|
|
539
|
+
return A(this, null, function* () {
|
|
540
|
+
if (te(t)) {
|
|
541
|
+
e.preventDefault();
|
|
469
542
|
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)),
|
|
543
|
+
n || (n = document.createElement("a"), n.setAttribute("href", "#"), n.id = "humany-dynamic-anchor", document.body.appendChild(n)), z(t, s, n);
|
|
471
544
|
}
|
|
472
|
-
|
|
545
|
+
z(t, s);
|
|
473
546
|
});
|
|
474
547
|
}
|
|
475
|
-
static handleContactMethodSubmit(
|
|
476
|
-
return
|
|
477
|
-
return
|
|
548
|
+
static handleContactMethodSubmit(e, t) {
|
|
549
|
+
return A(this, null, function* () {
|
|
550
|
+
return se(e, t);
|
|
478
551
|
});
|
|
479
552
|
}
|
|
480
553
|
}
|
|
481
|
-
|
|
482
|
-
const it = (i, t) => i.reduce((e, s, r) => {
|
|
554
|
+
const re = (r, e) => r.reduce((t, s, i) => {
|
|
483
555
|
var o, a;
|
|
484
|
-
const n =
|
|
485
|
-
content: [
|
|
556
|
+
const n = m(v({}, s), {
|
|
557
|
+
content: [m(v({}, s.content), { key: s.key })]
|
|
486
558
|
});
|
|
487
|
-
if (
|
|
488
|
-
const c =
|
|
489
|
-
if ((!
|
|
490
|
-
return c.timestamp = s.timestamp, c.content.push(
|
|
491
|
-
}
|
|
492
|
-
return
|
|
493
|
-
}, []),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
]).then(([
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const { loading: u, typingActors: v, messages: w } = l;
|
|
507
|
-
s.writeProperties({
|
|
508
|
-
loading: u,
|
|
509
|
-
typingActors: v,
|
|
510
|
-
messages: it(w, c)
|
|
511
|
-
});
|
|
512
|
-
};
|
|
513
|
-
d(o.getMessageStream()), a && (s.actions.create("user-submit", (l, u) => {
|
|
514
|
-
if (u) {
|
|
515
|
-
const { preventDefault: v, validationPromise: w } = u;
|
|
516
|
-
if (v) {
|
|
517
|
-
w && w().then((W) => {
|
|
518
|
-
W && o.user.print(W);
|
|
519
|
-
});
|
|
520
|
-
return;
|
|
559
|
+
if (t.length > 0 && s.type !== k.System) {
|
|
560
|
+
const c = t[t.length - 1];
|
|
561
|
+
if ((!e && e !== 0 || Math.abs(c.timestamp - s.timestamp) < e) && ((o = c.sender) == null ? void 0 : o.name) === ((a = s.sender) == null ? void 0 : a.name) && c.type === s.type)
|
|
562
|
+
return c.timestamp = s.timestamp, c.content.push(m(v({}, s.content), { key: s.key })), t;
|
|
563
|
+
}
|
|
564
|
+
return t.push(n), t;
|
|
565
|
+
}, []), pe = (r) => Promise.all([
|
|
566
|
+
w.getInstance(r),
|
|
567
|
+
r.getAsync("router")
|
|
568
|
+
]).then(([e, t]) => U(
|
|
569
|
+
r,
|
|
570
|
+
"conversation",
|
|
571
|
+
import("./conversation.d7aad569.js"),
|
|
572
|
+
(s) => {
|
|
573
|
+
const n = t.getRouteData().params.id || s.node.name || "component", o = e.createController(n), a = e.registerController(o, s), c = 3 * 60 * 1e3, h = (p) => {
|
|
574
|
+
const { providers: u = [] } = p;
|
|
575
|
+
if (u) {
|
|
576
|
+
const g = Array.isArray(u) ? u : [u];
|
|
577
|
+
return o.setProviders(g), g;
|
|
521
578
|
}
|
|
579
|
+
};
|
|
580
|
+
h(s.properties(h)), o.setComponentMountedState(!0);
|
|
581
|
+
const l = (p) => {
|
|
582
|
+
const { loading: u, typingActors: g, messages: C } = p;
|
|
583
|
+
s.writeProperties({
|
|
584
|
+
loading: u,
|
|
585
|
+
typingActors: g,
|
|
586
|
+
messages: re(C, c)
|
|
587
|
+
});
|
|
588
|
+
};
|
|
589
|
+
l(o.getMessageStream()), a && (s.actions.create("user-submit", (p, u) => {
|
|
590
|
+
if (u) {
|
|
591
|
+
const { preventDefault: g, validationPromise: C } = u;
|
|
592
|
+
if (g) {
|
|
593
|
+
C && C().then((N) => {
|
|
594
|
+
N && o.user.print(N);
|
|
595
|
+
});
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
o.user.print(p.text);
|
|
600
|
+
}), s.actions.create("user-typing", (p, u) => {
|
|
601
|
+
}), s.actions.create("form", (p, u) => {
|
|
602
|
+
}), s.actions.create("action", (p, u) => {
|
|
603
|
+
}), s.actions.create("overlay-mounted", (p, u) => {
|
|
604
|
+
}), s.actions.create("show-overlay", (p, u) => {
|
|
605
|
+
s.writeProperties({
|
|
606
|
+
overlay: { conversation: !1, secondary: !1 }
|
|
607
|
+
});
|
|
608
|
+
}), s.actions.create("hide-overlay", (p, u) => {
|
|
609
|
+
s.writeProperties({
|
|
610
|
+
overlay: null
|
|
611
|
+
});
|
|
612
|
+
}), s.actions.create("show-overlay-conversation", (p, u) => {
|
|
613
|
+
s.writeProperties({
|
|
614
|
+
overlay: { conversation: !0, secondary: !1 }
|
|
615
|
+
});
|
|
616
|
+
}), s.actions.create("hide-overlay-conversation", (p, u) => {
|
|
617
|
+
s.writeProperties({
|
|
618
|
+
overlay: { conversation: !1, secondary: !1 }
|
|
619
|
+
});
|
|
620
|
+
}));
|
|
621
|
+
const y = o.events.subscribe(
|
|
622
|
+
"conversation:updated",
|
|
623
|
+
(p, u) => {
|
|
624
|
+
l(u);
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
return () => {
|
|
628
|
+
o.setComponentMountedState(!1), y(), o.active || l({ messages: [], typingActors: [], loading: !1 });
|
|
629
|
+
};
|
|
630
|
+
},
|
|
631
|
+
{ reuseController: !0 }
|
|
632
|
+
)), ve = (r) => Promise.all([
|
|
633
|
+
H.getInstance(r),
|
|
634
|
+
w.getInstance(r),
|
|
635
|
+
r.getAsync("router")
|
|
636
|
+
]).then(
|
|
637
|
+
([e, t, s]) => U(
|
|
638
|
+
r,
|
|
639
|
+
"conversation-return-button",
|
|
640
|
+
import("./return-button.9c517bbe.js"),
|
|
641
|
+
(i) => {
|
|
642
|
+
i.actions.create("toggle", (n = {}) => {
|
|
643
|
+
var o;
|
|
644
|
+
(o = t.getComponentRoute()) == null || o.then((a) => {
|
|
645
|
+
a && s.navigate(a.name, a.params);
|
|
646
|
+
});
|
|
647
|
+
});
|
|
522
648
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
};
|
|
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 = {}) => {
|
|
540
|
-
var o;
|
|
541
|
-
(o = e.getComponentRoute()) == null || o.then((a) => {
|
|
542
|
-
a && s.navigate(a.name, a.params);
|
|
543
|
-
});
|
|
544
|
-
});
|
|
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)));
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
var ne = /* @__PURE__ */ ((r) => (r.LinkList = "link-list", r.Separator = "separator", r.ButtonList = "button-list", r.Text = "text", r.HTML = "html", r.VideoRequest = "video-request", r))(ne || {});
|
|
652
|
+
const ge = (r, e, t) => r.getAsync("componentResolver").then((s) => A(void 0, null, function* () {
|
|
653
|
+
(yield w.getInstance(r)).addSubscription(
|
|
654
|
+
s.registerComponent(
|
|
655
|
+
e,
|
|
656
|
+
K(() => t)
|
|
657
|
+
)
|
|
658
|
+
);
|
|
547
659
|
}));
|
|
548
660
|
export {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
661
|
+
pe as ConversationComponent,
|
|
662
|
+
Z as ConversationController,
|
|
663
|
+
E as ConversationEndedBehavior,
|
|
664
|
+
X as ConversationEntry,
|
|
665
|
+
ne as ConversationMessageListItemType,
|
|
666
|
+
k as ConversationMessageType,
|
|
667
|
+
w as ConversationPlatform,
|
|
668
|
+
ve as ConversationReturnButtonComponent,
|
|
669
|
+
ge as registerCustomMessageComponent
|
|
558
670
|
};
|
|
559
671
|
//# sourceMappingURL=index.js.map
|