@telia-ace/widget-conversation 1.0.34-experimental.18 → 1.0.34-experimental.19
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/components/conversation/conversation.d.ts +0 -4
- package/dist/conversation-wrapper.fa02c133.js +475 -0
- package/dist/conversation-wrapper.fa02c133.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/dist/conversation-wrapper.f45db73f.js +0 -104
- package/dist/conversation-wrapper.f45db73f.js.map +0 -1
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import './ui/conversation-content';
|
|
3
|
-
import './ui/conversation-input';
|
|
4
|
-
import './ui/conversation-message';
|
|
5
|
-
import './ui/message';
|
|
6
2
|
declare const Conversation_base: (new (...args: any[]) => import("@telia-ace/widget-ui/dist/mixins/requester").RequesterInterface) & typeof LitElement;
|
|
7
3
|
export default class Conversation extends Conversation_base {
|
|
8
4
|
static styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
var z = (a, e, s) => new Promise((r, t) => {
|
|
2
|
+
var n = (m) => {
|
|
3
|
+
try {
|
|
4
|
+
p(s.next(m));
|
|
5
|
+
} catch (x) {
|
|
6
|
+
t(x);
|
|
7
|
+
}
|
|
8
|
+
}, o = (m) => {
|
|
9
|
+
try {
|
|
10
|
+
p(s.throw(m));
|
|
11
|
+
} catch (x) {
|
|
12
|
+
t(x);
|
|
13
|
+
}
|
|
14
|
+
}, p = (m) => m.done ? r(m.value) : Promise.resolve(m.value).then(n, o);
|
|
15
|
+
p((s = s.apply(a, e)).next());
|
|
16
|
+
});
|
|
17
|
+
import { Requester as R, WidgetComponentMixin as T, NodeConnector as L } from "@telia-ace/widget-ui";
|
|
18
|
+
import { ComponentPlatform as j, ComponentQuery as D } from "@telia-ace/widget-core";
|
|
19
|
+
import { LitElement as v, html as c, nothing as u, css as M, unsafeCSS as A } from "lit";
|
|
20
|
+
import { property as i, state as E } from "lit/decorators.js";
|
|
21
|
+
import { classMap as f } from "lit/directives/class-map.js";
|
|
22
|
+
import { createRef as U, ref as I } from "lit/directives/ref.js";
|
|
23
|
+
import { ConversationMessageType as b, ConversationMessageListItemType as g } from "./index.js";
|
|
24
|
+
import { spread as q } from "@open-wc/lit-helpers";
|
|
25
|
+
import { html as l, unsafeStatic as B } from "lit/static-html.js";
|
|
26
|
+
import "@telia-ace/widget-services";
|
|
27
|
+
import "@telia-ace/widget-utilities";
|
|
28
|
+
import "@telia-ace/widget-forms";
|
|
29
|
+
import "@telia-ace/widget-plugins";
|
|
30
|
+
import "react";
|
|
31
|
+
const K = `:host{--send-button-color: #a6a6a6}.wrapper{position:absolute;inset:0;overflow:hidden;display:flex;flex-direction:column;overflow-y:auto}.scrollable{display:flex;flex-direction:column;align-items:stretch;padding:0 var(--size-medium)}.scrollable:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent}.message-container{display:flex}.message-container-left{justify-content:start}.message-container-center{justify-content:center}.message-container-right{justify-content:end}.conversation-entry{margin:0;margin-bottom:var(--size-medium)}.conversation-entry:first-of-type{margin-top:var(--size-medium)}.conversation-entry:last-of-type{padding-bottom:var(--size-medium)}.conversation-entry span,.conversation-entry p,.conversation-entry a,.conversation-entry div{font-weight:300}.conversation-entry b,.conversation-entry h1{font-weight:400}.conversation-entry .agent-message{display:grid;margin-right:10%;width:90%;grid-template-columns:1fr;grid-template-rows:1fr auto;grid-template-areas:"content" "info"}.conversation-entry .agent-message.has-avatar{grid-template-columns:auto 1fr;grid-template-rows:1fr auto;grid-template-areas:"avatar content" ". info"}.conversation-entry .user-message{margin-left:10%;width:90%;display:flex;flex-direction:column;align-items:flex-end}.conversation-entry .content-bundle{grid-area:content;max-width:100%;overflow:hidden}.conversation-entry .timestamp{font-size:var(--fonts-small);color:var(--colors-text);font-weight:300;margin:0;line-height:1.5em;grid-area:info}.content{display:inline-block;margin-top:var(--size-normal);max-width:100%}.content>*{overflow-wrap:break-word;word-wrap:break-word;word-break:break-all;word-break:break-word;hyphens:auto}.content.full-width{width:100%}.content.padded{padding:var(--sized-medium)}.content.user.stacked{background-color:var(--colors-primary);color:var(--colors-accent);border-top-left-radius:var(--borderRadius);border-bottom-left-radius:var(--borderRadius)}.content.user.stacked.stacked-first{border-top-right-radius:var(--borderRadius)}.content.user.stacked.stacked-last{border-bottom-right-radius:var(--borderRadius)}.content.stacked:not(.user){background-color:var(--colors-accent);color:var(--colors-text);border:var(--border, "none");border-top-right-radius:var(--borderRadius);border-bottom-right-radius:var(--borderRadius)}.content.stacked:not(.user).stacked-first{border-top-left-radius:var(--borderRadius)}.content.stacked:not(.user).stacked-last{border-bottom-left-radius:var(--borderRadius)}.message-type-text{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-html{font-size:var(--fonts-normal);font-weight:300;line-height:1.5em;color:var(--colors-text);margin:var(--size-medium) 0;padding:0 var(--size-medium);color:inherit}.message-type-html h1,.message-type-html h2,.message-type-html h3,.message-type-html h4,.message-type-html h5,.message-type-html h6{word-break:break-word}.message-type-html h1:first-child,.message-type-html h2:first-child,.message-type-html h3:first-child,.message-type-html h4:first-child,.message-type-html h5:first-child,.message-type-html h6:first-child{margin-top:0}.message-type-html h1:only-child,.message-type-html h2:only-child,.message-type-html h3:only-child,.message-type-html h4:only-child,.message-type-html h5:only-child,.message-type-html h6:only-child{margin:0}.message-type-html h1:last-child,.message-type-html h2:last-child,.message-type-html h3:last-child,.message-type-html h4:last-child,.message-type-html h5:last-child,.message-type-html h6:last-child{margin-bottom:0}.message-type-html a:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent;text-decoration:underline}.message-type-html img{max-width:100%!important;height:auto!important}.message-type-html p{word-break:break-word;margin:var(--size-normal) 0}.message-type-html p:first-child{margin:0 0 var(--size-normal)}.message-type-html p:last-child{margin:var(--size-normal) 0 0}.message-type-html p:only-child{margin:0}.message-type-html a{color:var(--colors-link)}.message-type-html a:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent}.message-type-separator{width:100%;border-bottom:var(--border)}.message-type-button-list{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-button-list ul{list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:var(--size-normal)}.message-type-button-list ul>li{margin:0}.message-type-button-list-button{text-align:center;font-weight:300;border-radius:var(--borderRadius);font-family:inherit;font-size:var(--fonts-normal);display:block;padding:var(--size-normal);background-color:var(--colors-primary);width:100%;color:#fff;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-size:inherit;border:none}.message-type-button-list-button:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent;background-color:transparent}.message-type-button-list-button i,.message-type-button-list-button svg{margin-right:var(--size-small)}.message-type-link-list{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-link-list h1{white-space:normal;font-size:var(--fonts-medium);font-weight:400;margin:0 0 var(--size-normal);color:var(--colors-text);line-height:1.8em}.message-type-link-list ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:var(--size-normal)}.message-type-link-list ul>li{margin:0}.message-type-link-list-button{display:block;text-align:left;font-weight:300;color:var(--colors-primary);max-width:100%;text-overflow:ellipsis;overflow:hidden;background-color:transparent;cursor:pointer;font-size:inherit;border:none}.message-list{list-style:none;padding:0;margin:0}.message-list .message-list-item p{padding:0;margin:0}.conversation-input{display:flex;align-items:center;background-color:var(--colors-accent);border-top:var(--inputBorder)}.conversation-input.has-content{--send-button-color: var(--colors-primary)}.conversation-input input{flex:1;border:none;background-color:transparent;font-weight:300;font-size:var(--fonts-normal);line-height:1.2em;outline:none;padding:var(--size-medium);color:var(--colors-text)}.conversation-input input::placeholder{color:var(--colors-textLight);font-style:italic}.conversation-input button{flex:0 0 50px;align-self:stretch;background-color:transparent;display:flex;align-items:center;justify-content:center;border:none;color:var(--send-button-color)}conversation-content{flex:0 1 100%;overflow-y:auto;overflow-x:hidden;-ms-overflow-style:none;scrollbar-width:thin;scrollbar-color:transparent transparent;scrollbar-color:#7f7f7f transparent!important;scrollbar-width:thin!important;-ms-overflow-style:none!important}conversation-content::-webkit-scrollbar{width:3px!important;background-color:transparent;border-left:none}conversation-content::-webkit-scrollbar-thumb{background-color:#7f7f7f!important}conversation-content::-webkit-scrollbar-track{-webkit-box-shadow:none!important;background-color:transparent}conversation-content ::-webkit-scrollbar-thumb{background-color:#7f7f7f!important}conversation-input{flex:0 0 auto;min-height:50px;max-height:150px}
|
|
32
|
+
`;
|
|
33
|
+
var N = Object.defineProperty, W = Object.getOwnPropertyDescriptor, S = (a, e, s, r) => {
|
|
34
|
+
for (var t = r > 1 ? void 0 : r ? W(e, s) : e, n = a.length - 1, o; n >= 0; n--)
|
|
35
|
+
(o = a[n]) && (t = (r ? o(e, s, t) : o(t)) || t);
|
|
36
|
+
return r && t && N(e, s, t), t;
|
|
37
|
+
};
|
|
38
|
+
class k extends v {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(), this.userLabel = "", this.messages = [];
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
return c`
|
|
44
|
+
<div class="scrollable">
|
|
45
|
+
${this.messages.map(
|
|
46
|
+
(e) => c`<div class="conversation-entry">
|
|
47
|
+
<conversation-message
|
|
48
|
+
.content=${e.content}
|
|
49
|
+
.sender=${e.sender}
|
|
50
|
+
.messageType=${e.type}
|
|
51
|
+
.timestamp=${e.timestamp}
|
|
52
|
+
.userLabel=${this.userLabel}
|
|
53
|
+
/>
|
|
54
|
+
</div>`
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
createRenderRoot() {
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
S([
|
|
64
|
+
i({ type: Array })
|
|
65
|
+
], k.prototype, "messages", 2);
|
|
66
|
+
S([
|
|
67
|
+
i({ type: String })
|
|
68
|
+
], k.prototype, "userLabel", 2);
|
|
69
|
+
var H = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, O = (a, e, s, r) => {
|
|
70
|
+
for (var t = r > 1 ? void 0 : r ? Q(e, s) : e, n = a.length - 1, o; n >= 0; n--)
|
|
71
|
+
(o = a[n]) && (t = (r ? o(e, s, t) : o(t)) || t);
|
|
72
|
+
return r && t && H(e, s, t), t;
|
|
73
|
+
};
|
|
74
|
+
class _ extends v {
|
|
75
|
+
constructor() {
|
|
76
|
+
super(), this.inputRef = U(), this.hasContent = !1;
|
|
77
|
+
}
|
|
78
|
+
onSubmit(e) {
|
|
79
|
+
e.shiftKey, e.preventDefault(), this.inputRef.value.value.length > 0 && (this.dispatchEvent(
|
|
80
|
+
new CustomEvent("user-submit", {
|
|
81
|
+
detail: {
|
|
82
|
+
text: this.inputRef.value.value
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
), this.inputRef.value.value = "");
|
|
86
|
+
}
|
|
87
|
+
onChange(e) {
|
|
88
|
+
e.target.value.length > 0 ? this.hasContent = !0 : this.hasContent = !1, e.target.value && e.target.value.length > 0 && this.dispatchEvent(
|
|
89
|
+
new CustomEvent("user-typing", {
|
|
90
|
+
detail: {
|
|
91
|
+
textLength: e.target.value.length
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return c`
|
|
98
|
+
<div
|
|
99
|
+
class=${f({
|
|
100
|
+
"conversation-input": !0,
|
|
101
|
+
"has-content": this.hasContent
|
|
102
|
+
})}
|
|
103
|
+
>
|
|
104
|
+
${u}
|
|
105
|
+
${c`
|
|
106
|
+
<input
|
|
107
|
+
${I(this.inputRef)}
|
|
108
|
+
@input=${this.onChange}
|
|
109
|
+
placeholder=${this.placeholder}
|
|
110
|
+
/>
|
|
111
|
+
`}
|
|
112
|
+
|
|
113
|
+
<button @click="${this.onSubmit}">
|
|
114
|
+
<ui-symbol-badge
|
|
115
|
+
size="22"
|
|
116
|
+
.symbol=${{ type: "Svg", content: "send" }}
|
|
117
|
+
></ui-symbol-badge>
|
|
118
|
+
</button>
|
|
119
|
+
</div>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
createRenderRoot() {
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
O([
|
|
127
|
+
E()
|
|
128
|
+
], _.prototype, "hasContent", 2);
|
|
129
|
+
O([
|
|
130
|
+
i({ type: String })
|
|
131
|
+
], _.prototype, "placeholder", 2);
|
|
132
|
+
var F = Object.defineProperty, G = Object.getOwnPropertyDescriptor, y = (a, e, s, r) => {
|
|
133
|
+
for (var t = r > 1 ? void 0 : r ? G(e, s) : e, n = a.length - 1, o; n >= 0; n--)
|
|
134
|
+
(o = a[n]) && (t = (r ? o(e, s, t) : o(t)) || t);
|
|
135
|
+
return r && t && F(e, s, t), t;
|
|
136
|
+
};
|
|
137
|
+
class d extends v {
|
|
138
|
+
constructor() {
|
|
139
|
+
super(), this.content = [], this.sender = null, this.messageType = b.System, this.userLabel = "";
|
|
140
|
+
}
|
|
141
|
+
getMessageStackPosition(e) {
|
|
142
|
+
let s = "first";
|
|
143
|
+
return this.content.length > 1 && (s = e === 0 ? "first" : e + 1 === this.content.length ? "last" : "middle"), s;
|
|
144
|
+
}
|
|
145
|
+
renderTimestamp(e, s) {
|
|
146
|
+
const r = (n) => new Date(n).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
147
|
+
if (!e && !s)
|
|
148
|
+
return u;
|
|
149
|
+
let t = "";
|
|
150
|
+
return e ? s ? t = `${e}: ${r(s)}` : t = e : s && (t = r(s)), c`<p class="timestamp">${t}</p>`;
|
|
151
|
+
}
|
|
152
|
+
render() {
|
|
153
|
+
const e = () => {
|
|
154
|
+
var t, n, o;
|
|
155
|
+
return c`
|
|
156
|
+
<div
|
|
157
|
+
class=${f({
|
|
158
|
+
"conversation-entry": !0,
|
|
159
|
+
"agent-message": !0,
|
|
160
|
+
"has-avatar": !!((t = this.sender) != null && t.avatar)
|
|
161
|
+
})}
|
|
162
|
+
>
|
|
163
|
+
${(n = this.sender) != null && n.avatar ? c`` : c``}
|
|
164
|
+
<div class="content-bundle">
|
|
165
|
+
${this.content.map((p, m) => c`
|
|
166
|
+
<div class="message-container message-container-left">
|
|
167
|
+
<conversation-message-item
|
|
168
|
+
.content=${p}
|
|
169
|
+
.isUser=${this.messageType === "user"}
|
|
170
|
+
.stacked=${this.getMessageStackPosition(m)}
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
`)}
|
|
174
|
+
</div>
|
|
175
|
+
${this.renderTimestamp(((o = this.sender) == null ? void 0 : o.name) || "", this.timestamp)}
|
|
176
|
+
</div>
|
|
177
|
+
`;
|
|
178
|
+
}, s = () => c`SystemMessage`, r = () => c`
|
|
179
|
+
<div
|
|
180
|
+
class=${f({
|
|
181
|
+
"conversation-entry": !0,
|
|
182
|
+
"user-message": !0
|
|
183
|
+
})}
|
|
184
|
+
>
|
|
185
|
+
<div class="content-bundle">
|
|
186
|
+
${this.content.map((t, n) => c`
|
|
187
|
+
<div class="message-container message-container-right">
|
|
188
|
+
<conversation-message-item
|
|
189
|
+
.content=${t}
|
|
190
|
+
.isUser=${this.messageType === "user"}
|
|
191
|
+
.stacked=${this.getMessageStackPosition(n)}
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
`)}
|
|
195
|
+
</div>
|
|
196
|
+
${this.renderTimestamp(this.userLabel || "", this.timestamp)}
|
|
197
|
+
</div>
|
|
198
|
+
`;
|
|
199
|
+
switch (this.messageType) {
|
|
200
|
+
case b.System:
|
|
201
|
+
return s();
|
|
202
|
+
case b.Agent:
|
|
203
|
+
return e();
|
|
204
|
+
case b.User:
|
|
205
|
+
return r();
|
|
206
|
+
default:
|
|
207
|
+
return u;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
createRenderRoot() {
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
d.styles = [
|
|
215
|
+
M`
|
|
216
|
+
:host {
|
|
217
|
+
display: block;
|
|
218
|
+
}
|
|
219
|
+
.agent-message {
|
|
220
|
+
display: grid;
|
|
221
|
+
margin-right: 10%;
|
|
222
|
+
width: 90%;
|
|
223
|
+
grid-template-columns: 1fr;
|
|
224
|
+
grid-template-rows: 1fr auto;
|
|
225
|
+
grid-template-areas:
|
|
226
|
+
'content'
|
|
227
|
+
'info';
|
|
228
|
+
}
|
|
229
|
+
.agent-message.has-avatar {
|
|
230
|
+
grid-template-columns: auto 1fr;
|
|
231
|
+
grid-template-rows: 1fr auto;
|
|
232
|
+
grid-template-areas:
|
|
233
|
+
'avatar content'
|
|
234
|
+
'. info';
|
|
235
|
+
}
|
|
236
|
+
.content-bundle {
|
|
237
|
+
grid-area: content;
|
|
238
|
+
max-width: 100%;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
}
|
|
241
|
+
.timestamp {
|
|
242
|
+
font-size: var(--fonts-small);
|
|
243
|
+
color: var(--colors-text);
|
|
244
|
+
font-weight: 300;
|
|
245
|
+
margin: 0;
|
|
246
|
+
line-height: 1.5em;
|
|
247
|
+
grid-area: info;
|
|
248
|
+
}
|
|
249
|
+
`
|
|
250
|
+
];
|
|
251
|
+
y([
|
|
252
|
+
i({ type: Object })
|
|
253
|
+
], d.prototype, "sender", 2);
|
|
254
|
+
y([
|
|
255
|
+
i({ type: Array })
|
|
256
|
+
], d.prototype, "content", 2);
|
|
257
|
+
y([
|
|
258
|
+
i({ type: Number })
|
|
259
|
+
], d.prototype, "timestamp", 2);
|
|
260
|
+
y([
|
|
261
|
+
i({ type: String })
|
|
262
|
+
], d.prototype, "messageType", 2);
|
|
263
|
+
y([
|
|
264
|
+
i({ type: String })
|
|
265
|
+
], d.prototype, "userLabel", 2);
|
|
266
|
+
var J = Object.defineProperty, V = Object.getOwnPropertyDescriptor, C = (a, e, s, r) => {
|
|
267
|
+
for (var t = r > 1 ? void 0 : r ? V(e, s) : e, n = a.length - 1, o; n >= 0; n--)
|
|
268
|
+
(o = a[n]) && (t = (r ? o(e, s, t) : o(t)) || t);
|
|
269
|
+
return r && t && J(e, s, t), t;
|
|
270
|
+
};
|
|
271
|
+
const P = (a) => Array.isArray(a) ? a : Object.keys(a).map((e) => ({
|
|
272
|
+
label: a[e],
|
|
273
|
+
actionKey: e
|
|
274
|
+
}));
|
|
275
|
+
class w extends v {
|
|
276
|
+
constructor() {
|
|
277
|
+
super(), this.isUser = !1, this.stacked = "first";
|
|
278
|
+
}
|
|
279
|
+
onActionClick(e) {
|
|
280
|
+
this.dispatchEvent(
|
|
281
|
+
new CustomEvent("action", {
|
|
282
|
+
detail: e,
|
|
283
|
+
composed: !0,
|
|
284
|
+
bubbles: !0,
|
|
285
|
+
cancelable: !0
|
|
286
|
+
})
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
renderItem(e) {
|
|
290
|
+
const [s, r] = e;
|
|
291
|
+
switch (s) {
|
|
292
|
+
case g.Text:
|
|
293
|
+
return l`<span class="message-type-text">${r}</span>`;
|
|
294
|
+
case g.HTML:
|
|
295
|
+
return l`<div class="message-type-html">
|
|
296
|
+
<ui-html .html=${r.body}></ui-html>
|
|
297
|
+
</div>`;
|
|
298
|
+
case g.Separator:
|
|
299
|
+
return l`<div class="message-type-separator"></div>`;
|
|
300
|
+
case g.LinkList:
|
|
301
|
+
return l`
|
|
302
|
+
<div class="message-type-link-list">
|
|
303
|
+
${r.header ? l`<h1>${r.header}</h1>` : u}
|
|
304
|
+
<ul>
|
|
305
|
+
${P(r.actions).map((t) => l`<li>
|
|
306
|
+
<button
|
|
307
|
+
class="message-type-link-list-button"
|
|
308
|
+
aria-label=${t.label}
|
|
309
|
+
title=${t.label}
|
|
310
|
+
@click=${(n) => {
|
|
311
|
+
this.onActionClick(t);
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
${t.label}
|
|
315
|
+
${t.actionKey === "help" ? l`
|
|
316
|
+
<ui-symbol-badge
|
|
317
|
+
.size=${14}
|
|
318
|
+
.symbol=${{
|
|
319
|
+
type: "Svg",
|
|
320
|
+
content: "caret-down"
|
|
321
|
+
}}
|
|
322
|
+
></ui-symbol-badge>
|
|
323
|
+
` : u}
|
|
324
|
+
</button>
|
|
325
|
+
</li>`)}
|
|
326
|
+
</ul>
|
|
327
|
+
</div>
|
|
328
|
+
`;
|
|
329
|
+
case g.ButtonList:
|
|
330
|
+
return l`
|
|
331
|
+
<div class="message-type-button-list">
|
|
332
|
+
${r.header ? l`<h1>${r.header}</h1>` : u}
|
|
333
|
+
<ul>
|
|
334
|
+
${P(r.actions).map((t) => l`<li>
|
|
335
|
+
<button
|
|
336
|
+
class="message-type-button-list-button"
|
|
337
|
+
aria-label=${t.label}
|
|
338
|
+
title=${t.label}
|
|
339
|
+
@click=${(n) => {
|
|
340
|
+
this.onActionClick(t);
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
<!-- <ui-symbol-badge /> -->
|
|
344
|
+
${t.label}
|
|
345
|
+
</button>
|
|
346
|
+
</li>`)}
|
|
347
|
+
</ul>
|
|
348
|
+
</div>
|
|
349
|
+
`;
|
|
350
|
+
default: {
|
|
351
|
+
let t = Object.entries(r).reduce(
|
|
352
|
+
(n, [o, p]) => (n[`.${o}`] = p, n),
|
|
353
|
+
{}
|
|
354
|
+
);
|
|
355
|
+
return l`<${B(s)} ${q(t)} />`;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
render() {
|
|
360
|
+
return l`
|
|
361
|
+
<div
|
|
362
|
+
class=${f({
|
|
363
|
+
content: !0,
|
|
364
|
+
user: this.isUser,
|
|
365
|
+
stacked: !0,
|
|
366
|
+
"stacked-first": this.stacked === "first",
|
|
367
|
+
"stacked-middle": this.stacked === "middle",
|
|
368
|
+
"stacked-last": this.stacked === "last"
|
|
369
|
+
})}
|
|
370
|
+
>
|
|
371
|
+
<ul class="message-list">
|
|
372
|
+
${(this.content.items || []).map((e) => l`<li class="message-list-item">${this.renderItem(e)}</li>`)}
|
|
373
|
+
</ul>
|
|
374
|
+
</div>
|
|
375
|
+
`;
|
|
376
|
+
}
|
|
377
|
+
createRenderRoot() {
|
|
378
|
+
return this;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
C([
|
|
382
|
+
i({ type: Object })
|
|
383
|
+
], w.prototype, "content", 2);
|
|
384
|
+
C([
|
|
385
|
+
i({ type: Boolean })
|
|
386
|
+
], w.prototype, "isUser", 2);
|
|
387
|
+
C([
|
|
388
|
+
i({ type: String })
|
|
389
|
+
], w.prototype, "stacked", 2);
|
|
390
|
+
var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, $ = (a, e, s, r) => {
|
|
391
|
+
for (var t = r > 1 ? void 0 : r ? Y(e, s) : e, n = a.length - 1, o; n >= 0; n--)
|
|
392
|
+
(o = a[n]) && (t = (r ? o(e, s, t) : o(t)) || t);
|
|
393
|
+
return r && t && X(e, s, t), t;
|
|
394
|
+
};
|
|
395
|
+
customElements.define("conversation-content", k);
|
|
396
|
+
customElements.define("conversation-input", _);
|
|
397
|
+
customElements.define("conversation-message", d);
|
|
398
|
+
customElements.define("conversation-message-item", w);
|
|
399
|
+
class h extends R(v) {
|
|
400
|
+
constructor() {
|
|
401
|
+
super(), this._messages = [], this._userLabel = "", this._inputPlaceholder = "Type your message";
|
|
402
|
+
}
|
|
403
|
+
onUserSubmit(e) {
|
|
404
|
+
this.dispatch("user-submit", e.detail);
|
|
405
|
+
}
|
|
406
|
+
onUserTyping(e) {
|
|
407
|
+
this.dispatch("user-typing", e.detail);
|
|
408
|
+
}
|
|
409
|
+
onActionClick(e) {
|
|
410
|
+
this.dispatch("action", e.detail);
|
|
411
|
+
}
|
|
412
|
+
dispatch(e, s) {
|
|
413
|
+
return z(this, null, function* () {
|
|
414
|
+
const r = this.requestInstance("container"), t = this.getDescriptor();
|
|
415
|
+
if (!r || !t)
|
|
416
|
+
return;
|
|
417
|
+
const n = yield j.getInstance(r);
|
|
418
|
+
if (!n)
|
|
419
|
+
return;
|
|
420
|
+
const o = new D(n).withId(t.id);
|
|
421
|
+
n.actions(o, t.type).dispatch(e, s);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
getDescriptor() {
|
|
425
|
+
const e = new CustomEvent(
|
|
426
|
+
"request-descriptor",
|
|
427
|
+
{
|
|
428
|
+
detail: {},
|
|
429
|
+
bubbles: !0,
|
|
430
|
+
composed: !0,
|
|
431
|
+
cancelable: !0
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
return this.dispatchEvent(e), e.detail.descriptor || null;
|
|
435
|
+
}
|
|
436
|
+
render() {
|
|
437
|
+
return c`
|
|
438
|
+
<div class="wrapper">
|
|
439
|
+
<conversation-content
|
|
440
|
+
.messages=${this._messages}
|
|
441
|
+
.userLabel=${this._userLabel}
|
|
442
|
+
@action=${this.onActionClick}
|
|
443
|
+
></conversation-content>
|
|
444
|
+
<conversation-input
|
|
445
|
+
@user-submit=${this.onUserSubmit}
|
|
446
|
+
@user-typing=${this.onUserTyping}
|
|
447
|
+
.placeholder=${this._inputPlaceholder}
|
|
448
|
+
>
|
|
449
|
+
</conversation-input>
|
|
450
|
+
</div>
|
|
451
|
+
`;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
h.styles = A(K);
|
|
455
|
+
$([
|
|
456
|
+
i({ type: Array })
|
|
457
|
+
], h.prototype, "_messages", 2);
|
|
458
|
+
$([
|
|
459
|
+
i({ type: String })
|
|
460
|
+
], h.prototype, "_inputPlaceholder", 2);
|
|
461
|
+
$([
|
|
462
|
+
i({ type: String })
|
|
463
|
+
], h.prototype, "_userLabel", 2);
|
|
464
|
+
$([
|
|
465
|
+
i({ type: String })
|
|
466
|
+
], h.prototype, "_conversationControllerId", 2);
|
|
467
|
+
class he extends T(h) {
|
|
468
|
+
constructor() {
|
|
469
|
+
super(), this.connector = new L(this);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
export {
|
|
473
|
+
he as default
|
|
474
|
+
};
|
|
475
|
+
//# sourceMappingURL=conversation-wrapper.fa02c133.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-wrapper.fa02c133.js","sources":["../src/components/conversation/ui/conversation-content.ts","../src/components/conversation/ui/conversation-input.ts","../src/components/conversation/ui/conversation-message.ts","../src/components/conversation/ui/message.ts","../src/components/conversation/conversation.ts","../src/components/conversation/conversation-wrapper.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n// import styles from './conversation-content.scss?inline';\n\n// @customElement('conversation-content')\nexport class ConversationContent extends LitElement {\n @property({ type: Array })\n declare messages: any[];\n @property({ type: String })\n declare userLabel: string;\n\n constructor() {\n super();\n\n this.userLabel = '';\n this.messages = [];\n }\n\n // async dispatch(type: string, data: any) {\n // const container = this.requestInstance('container');\n // const descriptor = this.getDescriptor();\n\n // if (!container || !descriptor) {\n // return;\n // }\n // const platform = await ComponentPlatform.getInstance(container);\n // if (!platform) {\n // return;\n // }\n\n // const component = new ComponentQuery(platform).withId(descriptor.id);\n // const actions = platform.actions(component, descriptor.type /*|| uuid()*/);\n\n // actions.dispatch(type, data);\n // }\n\n // getDescriptor() {\n // const ev: CustomEvent<{ descriptor?: { [key: string]: any } }> = new CustomEvent(\n // 'request-descriptor',\n // {\n // detail: {},\n // bubbles: true,\n // composed: true,\n // cancelable: true,\n // }\n // );\n // this.dispatchEvent(ev);\n // return ev.detail.descriptor || null;\n // }\n\n // onUserSubmit(event: CustomEvent<{ text: string }>) {\n // this.dispatch('user-submit', event.detail);\n // }\n\n // onUserTyping(event: CustomEvent<{ length: number }>) {\n // this.dispatch('user-typing', event.detail);\n // }\n\n render() {\n return html`\n <div class=\"scrollable\">\n ${this.messages.map(\n (message) => html`<div class=\"conversation-entry\">\n <conversation-message\n .content=${message.content}\n .sender=${message.sender}\n .messageType=${message.type}\n .timestamp=${message.timestamp}\n .userLabel=${this.userLabel}\n />\n </div>`\n )}\n </div>\n `;\n }\n\n protected createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n}\n// <conversation-input\n// @user-submit=${this.onUserSubmit}\n// @user-typing=${this.onUserTyping}\n// />\n","import { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { createRef, ref, Ref } from 'lit/directives/ref.js';\n\n// @customElement('conversation-input')\nexport class ConversationInput extends LitElement {\n inputRef: Ref<HTMLInputElement> = createRef<HTMLInputElement>();\n\n @state()\n declare hasContent: boolean;\n\n @property({ type: String })\n declare placeholder: string;\n\n constructor() {\n super();\n this.hasContent = false;\n // this.inputText = '';\n }\n\n onSubmit(e: any) {\n const multiline = false; // TODO:\n if (!e.shiftKey || !multiline) {\n e.preventDefault();\n if (this.inputRef.value!.value.length > 0) {\n this.dispatchEvent(\n new CustomEvent('user-submit', {\n detail: {\n // text: this.inputEl.value,\n text: this.inputRef.value!.value,\n },\n })\n );\n this.inputRef.value!.value = '';\n // dispatch('user-submit', { text: inputText });\n // setInputText('');\n // onChange('');\n }\n } else if (this.inputRef.value!.value.length < 1) {\n e.preventDefault();\n }\n }\n\n onChange(e: any) {\n if (e.target.value.length > 0) {\n this.hasContent = true;\n } else {\n this.hasContent = false;\n }\n // calculateHeight(value);\n if (e.target.value && e.target.value.length > 0) {\n this.dispatchEvent(\n new CustomEvent('user-typing', {\n detail: {\n textLength: e.target.value.length,\n },\n })\n );\n }\n }\n\n render() {\n const multiline = false; // TODO:\n const secondaryAction = false; // TODO:\n\n return html`\n <div\n class=${classMap({\n 'conversation-input': true,\n 'has-content': this.hasContent,\n })}\n >\n ${secondaryAction ? html`Secondary` : nothing}\n ${multiline\n ? html`Multiline`\n : html`\n <input\n ${ref(this.inputRef)}\n @input=${this.onChange}\n placeholder=${this.placeholder}\n />\n `}\n\n <button @click=\"${this.onSubmit}\">\n <ui-symbol-badge\n size=\"22\"\n .symbol=${{ type: 'Svg', content: 'send' }}\n ></ui-symbol-badge>\n </button>\n </div>\n `;\n }\n\n protected createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n}\n","import { css, html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ConversationMessageType } from '../../../conversation-controller';\nimport { BundledConversationMessage } from '../plugin';\n\n// @customElement('conversation-message')\nexport class ConversationMessage extends LitElement {\n static styles = [\n css`\n :host {\n display: block;\n }\n .agent-message {\n display: grid;\n margin-right: 10%;\n width: 90%;\n grid-template-columns: 1fr;\n grid-template-rows: 1fr auto;\n grid-template-areas:\n 'content'\n 'info';\n }\n .agent-message.has-avatar {\n grid-template-columns: auto 1fr;\n grid-template-rows: 1fr auto;\n grid-template-areas:\n 'avatar content'\n '. info';\n }\n .content-bundle {\n grid-area: content;\n max-width: 100%;\n overflow: hidden;\n }\n .timestamp {\n font-size: var(--fonts-small);\n color: var(--colors-text);\n font-weight: 300;\n margin: 0;\n line-height: 1.5em;\n grid-area: info;\n }\n `,\n ];\n\n @property({ type: Object })\n declare sender: BundledConversationMessage['sender'] | null;\n\n @property({ type: Array })\n declare content: BundledConversationMessage['content'];\n\n @property({ type: Number })\n declare timestamp: number;\n\n @property({ type: String })\n declare messageType: ConversationMessageType;\n\n @property({ type: String })\n declare userLabel: string;\n\n constructor() {\n super();\n this.content = [];\n this.sender = null;\n this.messageType = ConversationMessageType.System;\n this.userLabel = '';\n }\n\n getMessageStackPosition(index: number) {\n let messageOrder: 'first' | 'last' | 'middle' = 'first';\n if (this.content.length > 1) {\n messageOrder =\n index === 0 ? 'first' : index + 1 === this.content.length ? 'last' : 'middle';\n }\n return messageOrder;\n }\n\n renderTimestamp(name: string, timestamp: number) {\n const getTimestamp = (raw: number) => {\n return new Date(raw).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n };\n if (!name && !timestamp) {\n return nothing;\n }\n let output = '';\n if (name) {\n if (timestamp) {\n output = `${name}: ${getTimestamp(timestamp)}`;\n } else {\n output = name;\n }\n } else if (timestamp) {\n output = getTimestamp(timestamp);\n }\n\n return html`<p class=\"timestamp\">${output}</p>`;\n }\n\n render() {\n const createAgentMessage = () => {\n return html`\n <div\n class=${classMap({\n 'conversation-entry': true,\n 'agent-message': true,\n 'has-avatar': !!this.sender?.avatar,\n })}\n >\n ${this.sender?.avatar ? html`` : html`` /* TODO: */}\n <div class=\"content-bundle\">\n ${this.content.map((item, index) => {\n return html`\n <div class=\"message-container message-container-left\">\n <conversation-message-item\n .content=${item}\n .isUser=${this.messageType === 'user'}\n .stacked=${this.getMessageStackPosition(index)}\n />\n </div>\n `;\n })}\n </div>\n ${this.renderTimestamp(this.sender?.name || '', this.timestamp)}\n </div>\n `;\n };\n\n const createSystemMessage = () => {\n return html`SystemMessage`;\n };\n\n const createUserMessage = () => {\n return html`\n <div\n class=${classMap({\n 'conversation-entry': true,\n 'user-message': true,\n })}\n >\n <div class=\"content-bundle\">\n ${this.content.map((item, index) => {\n return html`\n <div class=\"message-container message-container-right\">\n <conversation-message-item\n .content=${item}\n .isUser=${this.messageType === 'user'}\n .stacked=${this.getMessageStackPosition(index)}\n />\n </div>\n `;\n })}\n </div>\n ${this.renderTimestamp(this.userLabel || '', this.timestamp)}\n </div>\n `;\n };\n\n switch (this.messageType) {\n case ConversationMessageType.System:\n return createSystemMessage();\n case ConversationMessageType.Agent:\n return createAgentMessage();\n case ConversationMessageType.User:\n return createUserMessage();\n default:\n return nothing;\n }\n }\n\n protected createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n}\n","import { spread } from '@open-wc/lit-helpers';\nimport { LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { html, unsafeStatic } from 'lit/static-html.js';\nimport { ConversationMessageListItemType, ItemPayload } from '../../../types';\nimport { BundledMessageContent } from '../plugin';\n\nconst mapActions = (actions: any) =>\n Array.isArray(actions)\n ? actions\n : Object.keys(actions).map((i) => {\n return {\n label: actions[i],\n actionKey: i,\n };\n });\n\n// @customElement('conversation-message-item')\nexport class Message extends LitElement {\n @property({ type: Object })\n declare content: BundledMessageContent;\n\n @property({ type: Boolean })\n declare isUser: boolean;\n\n @property({ type: String })\n declare stacked: 'first' | 'last' | 'middle';\n\n constructor() {\n super();\n this.isUser = false;\n this.stacked = 'first';\n }\n\n onActionClick(action: any) {\n this.dispatchEvent(\n new CustomEvent('action', {\n detail: action,\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n }\n\n renderItem(item: ItemPayload) {\n const [type, content] = item;\n\n switch (type) {\n case ConversationMessageListItemType.Text:\n return html`<span class=\"message-type-text\">${content}</span>`;\n case ConversationMessageListItemType.HTML:\n return html`<div class=\"message-type-html\">\n <ui-html .html=${content.body}></ui-html>\n </div>`;\n case ConversationMessageListItemType.Separator: {\n return html`<div class=\"message-type-separator\"></div>`;\n }\n case ConversationMessageListItemType.LinkList: {\n return html`\n <div class=\"message-type-link-list\">\n ${content.header ? html`<h1>${content.header}</h1>` : nothing}\n <ul>\n ${mapActions(content.actions).map((action) => {\n return html`<li>\n <button\n class=\"message-type-link-list-button\"\n aria-label=${action.label}\n title=${action.label}\n @click=${(e: Event) => {\n this.onActionClick(action);\n }}\n >\n ${action.label}\n ${action.actionKey === 'help'\n ? html`\n <ui-symbol-badge\n .size=${14}\n .symbol=${{\n type: 'Svg',\n content: 'caret-down',\n }}\n ></ui-symbol-badge>\n `\n : nothing}\n </button>\n </li>`;\n })}\n </ul>\n </div>\n `;\n }\n case ConversationMessageListItemType.ButtonList: {\n return html`\n <div class=\"message-type-button-list\">\n ${content.header ? html`<h1>${content.header}</h1>` : nothing}\n <ul>\n ${mapActions(content.actions).map((action) => {\n return html`<li>\n <button\n class=\"message-type-button-list-button\"\n aria-label=${action.label}\n title=${action.label}\n @click=${(e: Event) => {\n this.onActionClick(action);\n }}\n >\n <!-- <ui-symbol-badge /> -->\n ${action.label}\n </button>\n </li>`;\n })}\n </ul>\n </div>\n `;\n }\n // case ConversationMessageListItemType.VideoRequest: {\n // return <VideoRequest {...item.content} dispatch={dispatch} />;\n // }\n default: {\n let itemProps = Object.entries(content).reduce<{ [key: string]: any }>(\n (acc, [key, value]) => {\n acc[`.${key}`] = value;\n return acc;\n },\n {}\n );\n return html`<${unsafeStatic(type)} ${spread(itemProps)} />`;\n }\n }\n }\n\n render() {\n return html`\n <div\n class=${classMap({\n content: true,\n user: this.isUser,\n stacked: true,\n 'stacked-first': this.stacked === 'first',\n 'stacked-middle': this.stacked === 'middle',\n 'stacked-last': this.stacked === 'last',\n })}\n >\n <ul class=\"message-list\">\n ${(this.content.items || []).map((item) => {\n return html`<li class=\"message-list-item\">${this.renderItem(item)}</li>`;\n })}\n </ul>\n </div>\n `;\n }\n\n protected createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n}\n","import { ComponentPlatform, ComponentQuery } from '@telia-ace/widget-core';\nimport { Requester } from '@telia-ace/widget-ui';\nimport { html, LitElement, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport styles from './conversation.scss?inline';\n\nimport { ConversationContent } from './ui/conversation-content';\nimport { ConversationInput } from './ui/conversation-input';\nimport { ConversationMessage } from './ui/conversation-message';\nimport { Message } from './ui/message';\n\ncustomElements.define('conversation-content', ConversationContent);\ncustomElements.define('conversation-input', ConversationInput);\ncustomElements.define('conversation-message', ConversationMessage);\ncustomElements.define('conversation-message-item', Message);\n\nexport default class Conversation extends Requester(LitElement) {\n static styles = unsafeCSS(styles);\n\n @property({ type: Array })\n declare _messages: any[];\n\n @property({ type: String })\n declare _inputPlaceholder: string;\n\n @property({ type: String })\n declare _userLabel: string;\n\n @property({ type: String })\n declare _conversationControllerId: string;\n\n constructor() {\n super();\n this._messages = [];\n this._userLabel = '';\n this._inputPlaceholder = 'Type your message';\n }\n\n onUserSubmit(event: CustomEvent<{ text: string }>) {\n this.dispatch('user-submit', event.detail);\n }\n\n onUserTyping(event: CustomEvent<{ length: number }>) {\n this.dispatch('user-typing', event.detail);\n }\n\n onActionClick(event: CustomEvent<{ action: any }>) {\n this.dispatch('action', event.detail);\n }\n\n async dispatch(type: string, data: any) {\n const container = this.requestInstance('container');\n const descriptor = this.getDescriptor();\n\n if (!container || !descriptor) {\n return;\n }\n const platform = await ComponentPlatform.getInstance(container);\n if (!platform) {\n return;\n }\n\n const component = new ComponentQuery(platform).withId(descriptor.id);\n const actions = platform.actions(component, descriptor.type /*|| uuid()*/);\n\n actions.dispatch(type, data);\n }\n\n getDescriptor() {\n const ev: CustomEvent<{ descriptor?: { [key: string]: any } }> = new CustomEvent(\n 'request-descriptor',\n {\n detail: {},\n bubbles: true,\n composed: true,\n cancelable: true,\n }\n );\n this.dispatchEvent(ev);\n return ev.detail.descriptor || null;\n }\n\n render() {\n return html`\n <div class=\"wrapper\">\n <conversation-content\n .messages=${this._messages}\n .userLabel=${this._userLabel}\n @action=${this.onActionClick}\n ></conversation-content>\n <conversation-input\n @user-submit=${this.onUserSubmit}\n @user-typing=${this.onUserTyping}\n .placeholder=${this._inputPlaceholder}\n >\n </conversation-input>\n </div>\n `;\n }\n}\n","import { NodeConnector, WidgetComponentMixin } from '@telia-ace/widget-ui';\nimport Conversation from './conversation';\n\nexport default class ConversationWrapper extends WidgetComponentMixin(Conversation) {\n connector = new NodeConnector(this);\n\n constructor() {\n super();\n }\n}\n"],"names":["ConversationContent","LitElement","html","message","__decorateClass","property","ConversationInput","createRef","classMap","nothing","ref","state","ConversationMessage","ConversationMessageType","index","messageOrder","name","timestamp","getTimestamp","raw","output","createAgentMessage","_a","_b","item","_c","createSystemMessage","createUserMessage","css","mapActions","actions","i","Message","action","type","content","ConversationMessageListItemType","e","itemProps","acc","key","value","unsafeStatic","spread","Conversation","Requester","event","data","__async","container","descriptor","platform","ComponentPlatform","component","ComponentQuery","ev","unsafeCSS","styles","ConversationWrapper","WidgetComponentMixin","NodeConnector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,QAAQ;AAAA,GAZTuC,EAaT,WAAA,6BAAA,CAAA;AC1BS,MAAAc,WAA4BC,EAAqBf,CAAY,EAAE;AAAA,EAGhF,cAAc;AACJ,aAHE,KAAA,YAAA,IAAIgB,EAAc,IAAI;AAAA,EAIlC;AACJ;"}
|
package/dist/index.js
CHANGED
|
@@ -755,7 +755,7 @@ const de = (r, e) => r.reduce((t, s, i) => {
|
|
|
755
755
|
]).then(([e, t]) => Y(
|
|
756
756
|
r,
|
|
757
757
|
"conversation",
|
|
758
|
-
import("./conversation-wrapper.
|
|
758
|
+
import("./conversation-wrapper.fa02c133.js"),
|
|
759
759
|
(s) => u(void 0, null, function* () {
|
|
760
760
|
const { rehydrate: i = !1 } = s.properties(), a = t.getRouteData().params.id || s.node.name || "component", o = yield e.createController(a, { rehydrate: i }), c = e.registerController(o, s), d = 3 * 60 * 1e3, l = (v) => {
|
|
761
761
|
const { providers: h = [] } = v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-conversation",
|
|
3
|
-
"version": "1.0.34-experimental.
|
|
3
|
+
"version": "1.0.34-experimental.19",
|
|
4
4
|
"description": "ACE Widget Conversation Platform",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@open-wc/lit-helpers": "^0.5.1",
|
|
25
|
-
"@telia-ace/widget-core": "1.0.21-experimental.
|
|
26
|
-
"@telia-ace/widget-forms": "1.0.28-experimental.
|
|
27
|
-
"@telia-ace/widget-plugins": "1.0.22-experimental.
|
|
28
|
-
"@telia-ace/widget-routing": "1.0.22-experimental.
|
|
29
|
-
"@telia-ace/widget-services": "1.0.21-experimental.
|
|
30
|
-
"@telia-ace/widget-ui": "1.0.28-experimental.
|
|
31
|
-
"@telia-ace/widget-utilities": "1.0.10-experimental.
|
|
25
|
+
"@telia-ace/widget-core": "1.0.21-experimental.19",
|
|
26
|
+
"@telia-ace/widget-forms": "1.0.28-experimental.19",
|
|
27
|
+
"@telia-ace/widget-plugins": "1.0.22-experimental.19",
|
|
28
|
+
"@telia-ace/widget-routing": "1.0.22-experimental.19",
|
|
29
|
+
"@telia-ace/widget-services": "1.0.21-experimental.19",
|
|
30
|
+
"@telia-ace/widget-ui": "1.0.28-experimental.19",
|
|
31
|
+
"@telia-ace/widget-utilities": "1.0.10-experimental.19",
|
|
32
32
|
"@webprovisions/platform": "^1.1.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@emotion/react": "^11.10.5",
|
|
36
36
|
"@emotion/styled": "^11.10.5",
|
|
37
|
-
"@telia-ace/widget-developer-tools": "1.0.16-experimental.
|
|
37
|
+
"@telia-ace/widget-developer-tools": "1.0.16-experimental.19",
|
|
38
38
|
"@types/react": "^18.0.26",
|
|
39
39
|
"lit": "^2.6.1",
|
|
40
40
|
"react": "^18.2.0",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
var h = (i, e, r) => new Promise((o, t) => {
|
|
2
|
-
var s = (a) => {
|
|
3
|
-
try {
|
|
4
|
-
c(r.next(a));
|
|
5
|
-
} catch (p) {
|
|
6
|
-
t(p);
|
|
7
|
-
}
|
|
8
|
-
}, n = (a) => {
|
|
9
|
-
try {
|
|
10
|
-
c(r.throw(a));
|
|
11
|
-
} catch (p) {
|
|
12
|
-
t(p);
|
|
13
|
-
}
|
|
14
|
-
}, c = (a) => a.done ? o(a.value) : Promise.resolve(a.value).then(s, n);
|
|
15
|
-
c((r = r.apply(i, e)).next());
|
|
16
|
-
});
|
|
17
|
-
import { Requester as g, WidgetComponentMixin as u, NodeConnector as b } from "@telia-ace/widget-ui";
|
|
18
|
-
import { ComponentPlatform as v, ComponentQuery as y } from "@telia-ace/widget-core";
|
|
19
|
-
import { LitElement as f, html as w, unsafeCSS as x } from "lit";
|
|
20
|
-
import { property as m } from "lit/decorators.js";
|
|
21
|
-
const k = `:host{--send-button-color: #a6a6a6}.wrapper{position:absolute;inset:0;overflow:hidden;display:flex;flex-direction:column;overflow-y:auto}.scrollable{display:flex;flex-direction:column;align-items:stretch;padding:0 var(--size-medium)}.scrollable:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent}.message-container{display:flex}.message-container-left{justify-content:start}.message-container-center{justify-content:center}.message-container-right{justify-content:end}.conversation-entry{margin:0;margin-bottom:var(--size-medium)}.conversation-entry:first-of-type{margin-top:var(--size-medium)}.conversation-entry:last-of-type{padding-bottom:var(--size-medium)}.conversation-entry span,.conversation-entry p,.conversation-entry a,.conversation-entry div{font-weight:300}.conversation-entry b,.conversation-entry h1{font-weight:400}.conversation-entry .agent-message{display:grid;margin-right:10%;width:90%;grid-template-columns:1fr;grid-template-rows:1fr auto;grid-template-areas:"content" "info"}.conversation-entry .agent-message.has-avatar{grid-template-columns:auto 1fr;grid-template-rows:1fr auto;grid-template-areas:"avatar content" ". info"}.conversation-entry .user-message{margin-left:10%;width:90%;display:flex;flex-direction:column;align-items:flex-end}.conversation-entry .content-bundle{grid-area:content;max-width:100%;overflow:hidden}.conversation-entry .timestamp{font-size:var(--fonts-small);color:var(--colors-text);font-weight:300;margin:0;line-height:1.5em;grid-area:info}.content{display:inline-block;margin-top:var(--size-normal);max-width:100%}.content>*{overflow-wrap:break-word;word-wrap:break-word;word-break:break-all;word-break:break-word;hyphens:auto}.content.full-width{width:100%}.content.padded{padding:var(--sized-medium)}.content.user.stacked{background-color:var(--colors-primary);color:var(--colors-accent);border-top-left-radius:var(--borderRadius);border-bottom-left-radius:var(--borderRadius)}.content.user.stacked.stacked-first{border-top-right-radius:var(--borderRadius)}.content.user.stacked.stacked-last{border-bottom-right-radius:var(--borderRadius)}.content.stacked:not(.user){background-color:var(--colors-accent);color:var(--colors-text);border:var(--border, "none");border-top-right-radius:var(--borderRadius);border-bottom-right-radius:var(--borderRadius)}.content.stacked:not(.user).stacked-first{border-top-left-radius:var(--borderRadius)}.content.stacked:not(.user).stacked-last{border-bottom-left-radius:var(--borderRadius)}.message-type-text{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-html{font-size:var(--fonts-normal);font-weight:300;line-height:1.5em;color:var(--colors-text);margin:var(--size-medium) 0;padding:0 var(--size-medium);color:inherit}.message-type-html h1,.message-type-html h2,.message-type-html h3,.message-type-html h4,.message-type-html h5,.message-type-html h6{word-break:break-word}.message-type-html h1:first-child,.message-type-html h2:first-child,.message-type-html h3:first-child,.message-type-html h4:first-child,.message-type-html h5:first-child,.message-type-html h6:first-child{margin-top:0}.message-type-html h1:only-child,.message-type-html h2:only-child,.message-type-html h3:only-child,.message-type-html h4:only-child,.message-type-html h5:only-child,.message-type-html h6:only-child{margin:0}.message-type-html h1:last-child,.message-type-html h2:last-child,.message-type-html h3:last-child,.message-type-html h4:last-child,.message-type-html h5:last-child,.message-type-html h6:last-child{margin-bottom:0}.message-type-html a:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent;text-decoration:underline}.message-type-html img{max-width:100%!important;height:auto!important}.message-type-html p{word-break:break-word;margin:var(--size-normal) 0}.message-type-html p:first-child{margin:0 0 var(--size-normal)}.message-type-html p:last-child{margin:var(--size-normal) 0 0}.message-type-html p:only-child{margin:0}.message-type-html a{color:var(--colors-link)}.message-type-html a:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent}.message-type-separator{width:100%;border-bottom:var(--border)}.message-type-button-list{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-button-list ul{list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:var(--size-normal)}.message-type-button-list ul>li{margin:0}.message-type-button-list-button{text-align:center;font-weight:300;border-radius:var(--borderRadius);font-family:inherit;font-size:var(--fonts-normal);display:block;padding:var(--size-normal);background-color:var(--colors-primary);width:100%;color:#fff;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-size:inherit;border:none}.message-type-button-list-button:focus-visible{outline:var(--accessibility-border);color:var(--accessibility-colors-inactiveText);border-color:transparent;background-color:transparent}.message-type-button-list-button i,.message-type-button-list-button svg{margin-right:var(--size-small)}.message-type-link-list{margin:var(--size-medium) 0;padding:0 var(--size-medium)}.message-type-link-list h1{white-space:normal;font-size:var(--fonts-medium);font-weight:400;margin:0 0 var(--size-normal);color:var(--colors-text);line-height:1.8em}.message-type-link-list ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:var(--size-normal)}.message-type-link-list ul>li{margin:0}.message-type-link-list-button{display:block;text-align:left;font-weight:300;color:var(--colors-primary);max-width:100%;text-overflow:ellipsis;overflow:hidden;background-color:transparent;cursor:pointer;font-size:inherit;border:none}.message-list{list-style:none;padding:0;margin:0}.message-list .message-list-item p{padding:0;margin:0}.conversation-input{display:flex;align-items:center;background-color:var(--colors-accent);border-top:var(--inputBorder)}.conversation-input.has-content{--send-button-color: var(--colors-primary)}.conversation-input input{flex:1;border:none;background-color:transparent;font-weight:300;font-size:var(--fonts-normal);line-height:1.2em;outline:none;padding:var(--size-medium);color:var(--colors-text)}.conversation-input input::placeholder{color:var(--colors-textLight);font-style:italic}.conversation-input button{flex:0 0 50px;align-self:stretch;background-color:transparent;display:flex;align-items:center;justify-content:center;border:none;color:var(--send-button-color)}conversation-content{flex:0 1 100%;overflow-y:auto;overflow-x:hidden;-ms-overflow-style:none;scrollbar-width:thin;scrollbar-color:transparent transparent;scrollbar-color:#7f7f7f transparent!important;scrollbar-width:thin!important;-ms-overflow-style:none!important}conversation-content::-webkit-scrollbar{width:3px!important;background-color:transparent;border-left:none}conversation-content::-webkit-scrollbar-thumb{background-color:#7f7f7f!important}conversation-content::-webkit-scrollbar-track{-webkit-box-shadow:none!important;background-color:transparent}conversation-content ::-webkit-scrollbar-thumb{background-color:#7f7f7f!important}conversation-input{flex:0 0 auto;min-height:50px;max-height:150px}
|
|
22
|
-
`;
|
|
23
|
-
var z = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, d = (i, e, r, o) => {
|
|
24
|
-
for (var t = o > 1 ? void 0 : o ? _(e, r) : e, s = i.length - 1, n; s >= 0; s--)
|
|
25
|
-
(n = i[s]) && (t = (o ? n(e, r, t) : n(t)) || t);
|
|
26
|
-
return o && t && z(e, r, t), t;
|
|
27
|
-
};
|
|
28
|
-
class l extends g(f) {
|
|
29
|
-
constructor() {
|
|
30
|
-
super(), this._messages = [], this._userLabel = "", this._inputPlaceholder = "Type your message";
|
|
31
|
-
}
|
|
32
|
-
onUserSubmit(e) {
|
|
33
|
-
this.dispatch("user-submit", e.detail);
|
|
34
|
-
}
|
|
35
|
-
onUserTyping(e) {
|
|
36
|
-
this.dispatch("user-typing", e.detail);
|
|
37
|
-
}
|
|
38
|
-
onActionClick(e) {
|
|
39
|
-
this.dispatch("action", e.detail);
|
|
40
|
-
}
|
|
41
|
-
dispatch(e, r) {
|
|
42
|
-
return h(this, null, function* () {
|
|
43
|
-
const o = this.requestInstance("container"), t = this.getDescriptor();
|
|
44
|
-
if (!o || !t)
|
|
45
|
-
return;
|
|
46
|
-
const s = yield v.getInstance(o);
|
|
47
|
-
if (!s)
|
|
48
|
-
return;
|
|
49
|
-
const n = new y(s).withId(t.id);
|
|
50
|
-
s.actions(n, t.type).dispatch(e, r);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
getDescriptor() {
|
|
54
|
-
const e = new CustomEvent(
|
|
55
|
-
"request-descriptor",
|
|
56
|
-
{
|
|
57
|
-
detail: {},
|
|
58
|
-
bubbles: !0,
|
|
59
|
-
composed: !0,
|
|
60
|
-
cancelable: !0
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
return this.dispatchEvent(e), e.detail.descriptor || null;
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
return w`
|
|
67
|
-
<div class="wrapper">
|
|
68
|
-
<conversation-content
|
|
69
|
-
.messages=${this._messages}
|
|
70
|
-
.userLabel=${this._userLabel}
|
|
71
|
-
@action=${this.onActionClick}
|
|
72
|
-
></conversation-content>
|
|
73
|
-
<conversation-input
|
|
74
|
-
@user-submit=${this.onUserSubmit}
|
|
75
|
-
@user-typing=${this.onUserTyping}
|
|
76
|
-
.placeholder=${this._inputPlaceholder}
|
|
77
|
-
>
|
|
78
|
-
</conversation-input>
|
|
79
|
-
</div>
|
|
80
|
-
`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
l.styles = x(k);
|
|
84
|
-
d([
|
|
85
|
-
m({ type: Array })
|
|
86
|
-
], l.prototype, "_messages", 2);
|
|
87
|
-
d([
|
|
88
|
-
m({ type: String })
|
|
89
|
-
], l.prototype, "_inputPlaceholder", 2);
|
|
90
|
-
d([
|
|
91
|
-
m({ type: String })
|
|
92
|
-
], l.prototype, "_userLabel", 2);
|
|
93
|
-
d([
|
|
94
|
-
m({ type: String })
|
|
95
|
-
], l.prototype, "_conversationControllerId", 2);
|
|
96
|
-
class j extends u(l) {
|
|
97
|
-
constructor() {
|
|
98
|
-
super(), this.connector = new b(this);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
export {
|
|
102
|
-
j as default
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=conversation-wrapper.f45db73f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-wrapper.f45db73f.js","sources":["../src/components/conversation/conversation.ts","../src/components/conversation/conversation-wrapper.ts"],"sourcesContent":["import { ComponentPlatform, ComponentQuery } from '@telia-ace/widget-core';\nimport { Requester } from '@telia-ace/widget-ui';\nimport { html, LitElement, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport styles from './conversation.scss?inline';\n\nimport './ui/conversation-content';\nimport './ui/conversation-input';\nimport './ui/conversation-message';\nimport './ui/message';\n\nexport default class Conversation extends Requester(LitElement) {\n static styles = unsafeCSS(styles);\n\n @property({ type: Array })\n declare _messages: any[];\n\n @property({ type: String })\n declare _inputPlaceholder: string;\n\n @property({ type: String })\n declare _userLabel: string;\n\n @property({ type: String })\n declare _conversationControllerId: string;\n\n constructor() {\n super();\n this._messages = [];\n this._userLabel = '';\n this._inputPlaceholder = 'Type your message';\n }\n\n onUserSubmit(event: CustomEvent<{ text: string }>) {\n this.dispatch('user-submit', event.detail);\n }\n\n onUserTyping(event: CustomEvent<{ length: number }>) {\n this.dispatch('user-typing', event.detail);\n }\n\n onActionClick(event: CustomEvent<{ action: any }>) {\n this.dispatch('action', event.detail);\n }\n\n async dispatch(type: string, data: any) {\n const container = this.requestInstance('container');\n const descriptor = this.getDescriptor();\n\n if (!container || !descriptor) {\n return;\n }\n const platform = await ComponentPlatform.getInstance(container);\n if (!platform) {\n return;\n }\n\n const component = new ComponentQuery(platform).withId(descriptor.id);\n const actions = platform.actions(component, descriptor.type /*|| uuid()*/);\n\n actions.dispatch(type, data);\n }\n\n getDescriptor() {\n const ev: CustomEvent<{ descriptor?: { [key: string]: any } }> = new CustomEvent(\n 'request-descriptor',\n {\n detail: {},\n bubbles: true,\n composed: true,\n cancelable: true,\n }\n );\n this.dispatchEvent(ev);\n return ev.detail.descriptor || null;\n }\n\n render() {\n return html`\n <div class=\"wrapper\">\n <conversation-content\n .messages=${this._messages}\n .userLabel=${this._userLabel}\n @action=${this.onActionClick}\n ></conversation-content>\n <conversation-input\n @user-submit=${this.onUserSubmit}\n @user-typing=${this.onUserTyping}\n .placeholder=${this._inputPlaceholder}\n >\n </conversation-input>\n </div>\n `;\n }\n}\n","import { NodeConnector, WidgetComponentMixin } from '@telia-ace/widget-ui';\nimport Conversation from './conversation';\n\nexport default class ConversationWrapper extends WidgetComponentMixin(Conversation) {\n connector = new NodeConnector(this);\n\n constructor() {\n super();\n }\n}\n"],"names":["Conversation","Requester","LitElement","event","type","data","__async","container","descriptor","platform","ComponentPlatform","component","ComponentQuery","ev","html","unsafeCSS","styles","__decorateClass","property","ConversationWrapper","WidgetComponentMixin","NodeConnector"],"mappings":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