@telia-ace/widget-conversation 1.1.2-rc.3 → 1.1.2-rc.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("@emotion/styled"),n=require("@telia-ace/widget-ui"),C=require("@telia-ace/widget-utilities"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("@emotion/styled"),n=require("@telia-ace/widget-ui"),C=require("@telia-ace/widget-utilities"),b=require("@emotion/react"),y=require("react"),G=require("@telia-ace/widget-forms"),v=require("./index.js");require("@telia-ace/widget-core");require("@telia-ace/widget-services");require("@telia-ace/widget-plugins");const J=({className:t})=>{const[e,r]=y.useState(""),[o,a]=y.useState(0),[l,d]=y.useState(0),m=n.useIsTabbing(),u=n.useDispatch(),{inputPlaceholder:f="Type your message",inputHidden:j=!1,inputDisabled:c=!1,sendButtonLabel:h="Send message",inputMultiline:x=!0,secondaryAction:$}=n.useProperties(),[L,p]=n.useScroll(!0);y.useEffect(()=>{if(p.current){const{lineHeight:g,maxHeight:z}=getComputedStyle(p.current);if(g&&g.indexOf("px")>-1){const k=g.split("px"),_=parseInt(k[0],10);a(_);const Y=z.split("px");d(parseInt(Y[0],10))}}},[p.current]);const w=g=>{!g.shiftKey||!x?(g.preventDefault(),e&&e.length>0&&(u("user-submit",{text:e}),r(""),I(""))):e.length<1&&g.preventDefault()},U=g=>{$&&(g.preventDefault(),u("action",{actionKey:$.action,...$}))},V=g=>{if(x&&p.current){const z=p.current.scrollHeight;if(z>o){p.current.style.height="auto";let k=z;g.length<1&&(k=o),p.current.style.height=`${k}px`,k>=l?p.current.style.overflowY="scroll":p.current.style.overflowY="hidden"}}},I=g=>{V(g),r(g),g&&g.length>0&&u("user-typing",{textLength:g.length})};return j?null:s.jsxs(ee,{grow:x,className:C.appendClassNames("humany-conversation-input",t),scrollableCss:L,isTabbing:m,children:[$&&s.jsx(Z,{disabled:c,onClick:U,title:$.label,"aria-label":$.label,children:s.jsx(n.SymbolBadge,{size:24,symbol:{type:"Svg",content:$.icon||"browse"}})}),x?s.jsx(Q,{value:e,onChange:I,onEnter:w,disabled:c,"aria-label":f,placeholder:f,type:"textarea",rows:1,ref:p}):s.jsx(X,{value:e,onChange:I,onEnter:w,disabled:c,"aria-label":f,placeholder:f}),s.jsx(P,{disabled:!1,onClick:w,title:h,"aria-label":h,children:s.jsx(te,{size:22,symbol:{type:"Svg",content:"send"},hasContent:!!e&&!!e.length})})]})},Q=i(n.Input)`
|
|
2
2
|
resize: none;
|
|
3
3
|
flex: 1;
|
|
4
4
|
flex-shrink: 1;
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
border: none;
|
|
13
13
|
transition: height 200ms linear;
|
|
14
14
|
outline: none;
|
|
15
|
-
|
|
15
|
+
&:focus-visible {
|
|
16
|
+
${n.borderTabStyle};
|
|
17
|
+
outline-offset: 12px;
|
|
18
|
+
}
|
|
19
|
+
`,X=i(n.Input)`
|
|
16
20
|
flex: 1;
|
|
17
21
|
border: none;
|
|
18
22
|
background-color: transparent;
|
|
@@ -26,7 +30,7 @@
|
|
|
26
30
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.textLight}};
|
|
27
31
|
font-style: italic;
|
|
28
32
|
}
|
|
29
|
-
`,
|
|
33
|
+
`,P=i(n.Button)`
|
|
30
34
|
flex: 0 0 50px;
|
|
31
35
|
align-self: stretch;
|
|
32
36
|
background-color: transparent;
|
|
@@ -38,14 +42,14 @@
|
|
|
38
42
|
&:focus-visible {
|
|
39
43
|
${n.borderTabStyle};
|
|
40
44
|
}
|
|
41
|
-
`,
|
|
45
|
+
`,Z=i(P)`
|
|
42
46
|
border-right: ${t=>t.theme.border};
|
|
43
47
|
margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0;
|
|
44
|
-
`,
|
|
45
|
-
${t=>t.grow?
|
|
48
|
+
`,ee=i.div`
|
|
49
|
+
${t=>t.grow?b.css`
|
|
46
50
|
min-height: 50px;
|
|
47
51
|
max-height: 150px;
|
|
48
|
-
`:
|
|
52
|
+
`:b.css`
|
|
49
53
|
height: 50px;
|
|
50
54
|
`}
|
|
51
55
|
flex: 0 0 auto;
|
|
@@ -57,13 +61,13 @@
|
|
|
57
61
|
textarea {
|
|
58
62
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
59
63
|
}
|
|
60
|
-
`,
|
|
64
|
+
`,te=i(({hasContent:t,...e})=>s.jsx(n.SymbolBadge,{...e}))`
|
|
61
65
|
line,
|
|
62
66
|
path {
|
|
63
67
|
stroke: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
|
|
64
68
|
fill: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
|
|
65
69
|
}
|
|
66
|
-
`,
|
|
70
|
+
`,se=i.div`
|
|
67
71
|
width: ${t=>t.avatarSize||"32px"};
|
|
68
72
|
height: ${t=>t.avatarSize||"32px"};
|
|
69
73
|
border-radius: 50%;
|
|
@@ -98,7 +102,7 @@
|
|
|
98
102
|
stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
|
-
`,
|
|
105
|
+
`,ne=b.keyframes`
|
|
102
106
|
0% {
|
|
103
107
|
opacity: 0;
|
|
104
108
|
}
|
|
@@ -108,7 +112,7 @@
|
|
|
108
112
|
100% {
|
|
109
113
|
opacity: 0;
|
|
110
114
|
}
|
|
111
|
-
`,
|
|
115
|
+
`,re=i.div`
|
|
112
116
|
display: flex;
|
|
113
117
|
justify-content: center;
|
|
114
118
|
> div {
|
|
@@ -117,7 +121,7 @@
|
|
|
117
121
|
border-radius: 50%;
|
|
118
122
|
margin: 5px;
|
|
119
123
|
background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
120
|
-
animation: ${
|
|
124
|
+
animation: ${ne} 1s infinite;
|
|
121
125
|
}
|
|
122
126
|
> div:nth-of-type(2) {
|
|
123
127
|
animation-delay: 100ms;
|
|
@@ -125,23 +129,23 @@
|
|
|
125
129
|
> div:nth-of-type(3) {
|
|
126
130
|
animation-delay: 200ms;
|
|
127
131
|
}
|
|
128
|
-
`,
|
|
132
|
+
`,H=i.div`
|
|
129
133
|
grid-area: content;
|
|
130
134
|
max-width: 100%;
|
|
131
135
|
overflow: hidden;
|
|
132
|
-
`,
|
|
136
|
+
`,oe=i(n.Typography)`
|
|
133
137
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
|
|
134
138
|
font-weight: normal;
|
|
135
139
|
margin: 0;
|
|
136
|
-
`,
|
|
140
|
+
`,A=i.div`
|
|
137
141
|
display: flex;
|
|
138
142
|
${t=>t.left&&"justify-content: start;"};
|
|
139
143
|
${t=>t.center&&"justify-content: center;"};
|
|
140
144
|
${t=>t.right&&"justify-content: end;"};
|
|
141
|
-
`,
|
|
145
|
+
`,R=i.div`
|
|
142
146
|
${t=>{var e;return t.padded&&`padding: ${(e=t.theme.sizes)==null?void 0:e.medium};`}}
|
|
143
|
-
${t=>!t.user&&t.stacked&&
|
|
144
|
-
${t=>t.user&&t.stacked&&
|
|
147
|
+
${t=>!t.user&&t.stacked&&ae(t.stacked,t.theme)}
|
|
148
|
+
${t=>t.user&&t.stacked&&ie(t.stacked,t.theme)}
|
|
145
149
|
|
|
146
150
|
display: inline-block;
|
|
147
151
|
margin-top: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
@@ -154,11 +158,11 @@
|
|
|
154
158
|
}
|
|
155
159
|
max-width: 100%;
|
|
156
160
|
${t=>t.fullWidth&&"width: 100%;"}
|
|
157
|
-
`,
|
|
161
|
+
`,ae=(t,e)=>{var o,a;const r=b.css`
|
|
158
162
|
background-color: ${(o=e.colors)==null?void 0:o.accent};
|
|
159
163
|
color: ${(a=e.colors)==null?void 0:a.text};
|
|
160
164
|
${e.border&&`border: ${e.border};`};
|
|
161
|
-
`;return e.borderRadius?
|
|
165
|
+
`;return e.borderRadius?b.css`
|
|
162
166
|
${r}
|
|
163
167
|
|
|
164
168
|
border-top-right-radius: ${e.borderRadius};
|
|
@@ -171,10 +175,10 @@
|
|
|
171
175
|
${t==="last"&&`
|
|
172
176
|
border-bottom-left-radius: ${e.borderRadius};
|
|
173
177
|
`}
|
|
174
|
-
`:r},
|
|
178
|
+
`:r},ie=(t,e)=>{var o,a;const r=b.css`
|
|
175
179
|
background-color: ${(o=e.colors)==null?void 0:o.primary};
|
|
176
180
|
color: ${(a=e.colors)==null?void 0:a.accent};
|
|
177
|
-
`;return e.borderRadius?
|
|
181
|
+
`;return e.borderRadius?b.css`
|
|
178
182
|
${r}
|
|
179
183
|
|
|
180
184
|
border-top-left-radius: ${e.borderRadius};
|
|
@@ -187,15 +191,15 @@
|
|
|
187
191
|
${t==="last"&&`
|
|
188
192
|
border-bottom-right-radius: ${e.borderRadius};
|
|
189
193
|
`}
|
|
190
|
-
`:r},
|
|
194
|
+
`:r},T=i.div`
|
|
191
195
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
192
196
|
&:last-child {
|
|
193
197
|
margin-bottom: 0;
|
|
194
198
|
}
|
|
195
|
-
`,
|
|
199
|
+
`,S=t=>{var e,r;return b.css`
|
|
196
200
|
margin: ${(e=t.theme.sizes)==null?void 0:e.medium} 0;
|
|
197
201
|
padding: 0 ${(r=t.theme.sizes)==null?void 0:r.medium};
|
|
198
|
-
`},
|
|
202
|
+
`},le=i(G.FormComponent)`
|
|
199
203
|
& button.humany-form-component-button {
|
|
200
204
|
${t=>{var e,r,o,a;return((e=t.theme.colors)==null?void 0:e.primary)&&((r=t.theme.colors)==null?void 0:r.accent)&&n.invertedHoverButton({active:!1,primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:(a=t.theme.colors)==null?void 0:a.accent,theme:t.theme})}};
|
|
201
205
|
display: block;
|
|
@@ -209,7 +213,7 @@
|
|
|
209
213
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
|
-
`,
|
|
216
|
+
`,ce=i(n.Html)`
|
|
213
217
|
white-space: pre-wrap;
|
|
214
218
|
a {
|
|
215
219
|
color: ${t=>t.theme.colors.link};
|
|
@@ -217,14 +221,14 @@
|
|
|
217
221
|
${t=>{var e;return((e=t.theme.accessibility)==null?void 0:e.isTabbing)&&n.borderTabStyle}};
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
|
-
`,
|
|
224
|
+
`,de=i(n.List)`
|
|
221
225
|
padding: 0;
|
|
222
226
|
list-style: none;
|
|
223
227
|
margin: 0 -${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
224
228
|
> li {
|
|
225
229
|
margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
226
230
|
}
|
|
227
|
-
`,
|
|
231
|
+
`,me=i.button`
|
|
228
232
|
${t=>n.buttonCss(t)};
|
|
229
233
|
display: block;
|
|
230
234
|
background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
|
|
@@ -234,7 +238,7 @@
|
|
|
234
238
|
${n.borderTabStyle}
|
|
235
239
|
background-color: transparent;
|
|
236
240
|
}
|
|
237
|
-
`,
|
|
241
|
+
`,K=y.forwardRef(({boxed:t,className:e,agentData:r},o)=>s.jsx(H,{ref:o,children:s.jsx(A,{left:t,center:!t,children:s.jsx(R,{padded:!!t,stacked:t?"first":void 0,children:s.jsxs(re,{children:[s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})})})})),E=y.createContext(null),ue=i.p`
|
|
238
242
|
&& {
|
|
239
243
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
|
|
240
244
|
font-weight: 300;
|
|
@@ -243,28 +247,28 @@
|
|
|
243
247
|
line-height: 1.5em;
|
|
244
248
|
grid-area: info;
|
|
245
249
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
246
|
-
`,
|
|
250
|
+
`,q=(t,e)=>new Date(t).toLocaleTimeString(e||[],{hour:"2-digit",minute:"2-digit"}),N=({className:t,name:e,timestamp:r})=>{const o=y.useContext(E);if(!e&&!r)return null;let a="";return e?r?a=`${e}: ${q(r,o)}`:a=e:r&&(a=q(r,o)),s.jsx(ue,{children:a})},F=({className:t,children:e,sender:r,timestamp:o})=>{const{avatar:a,name:l}=r,{avatarSize:d}=n.useProperties();return s.jsxs(he,{hasAvatar:!!a,className:C.appendClassNames(t,"humany-conversation-agent-message"),children:[a&&s.jsx(se,{avatarSize:d,children:typeof a=="string"?s.jsx("img",{src:a}):s.jsx(n.SymbolBadge,{symbol:a})}),e,s.jsx(N,{name:l,timestamp:o})]})},he=i.div`
|
|
247
251
|
display: grid;
|
|
248
252
|
margin-right: 10%;
|
|
249
253
|
width: 90%;
|
|
250
|
-
${t=>t.hasAvatar?
|
|
254
|
+
${t=>t.hasAvatar?b.css`
|
|
251
255
|
grid-template-columns: auto 1fr;
|
|
252
256
|
grid-template-rows: 1fr auto;
|
|
253
257
|
grid-template-areas:
|
|
254
258
|
'avatar content'
|
|
255
259
|
'. info';
|
|
256
|
-
`:
|
|
260
|
+
`:b.css`
|
|
257
261
|
grid-template-columns: 1fr;
|
|
258
262
|
grid-template-rows: 1fr auto;
|
|
259
263
|
grid-template-areas:
|
|
260
264
|
'content'
|
|
261
265
|
'info';
|
|
262
266
|
`};
|
|
263
|
-
`,
|
|
267
|
+
`,ge=y.forwardRef(({className:t,children:e,timestamp:r,discrete:o,fullWidth:a},l)=>s.jsx(ye,{ref:l,className:C.appendClassNames(t,"humany-conversation-system-message"),fullWidth:a,children:o?s.jsxs(fe,{className:"humany-conversation-discrete-message",children:[e,s.jsx(N,{timestamp:r})]}):s.jsxs(s.Fragment,{children:[e,s.jsx(N,{timestamp:r})]})})),ye=i.div`
|
|
264
268
|
${t=>t.fullWidth&&"width: 100%"};
|
|
265
269
|
padding: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
266
270
|
overflow: auto;
|
|
267
|
-
`,
|
|
271
|
+
`,fe=i.div`
|
|
268
272
|
text-align: center;
|
|
269
273
|
word-wrap: break-word;
|
|
270
274
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
|
|
@@ -272,13 +276,13 @@
|
|
|
272
276
|
> p {
|
|
273
277
|
margin: 0;
|
|
274
278
|
}
|
|
275
|
-
`,
|
|
279
|
+
`,be=({className:t,children:e,timestamp:r})=>{const{userLabel:o=""}=n.useProperties();return s.jsxs(pe,{className:C.appendClassNames(t,"humany-conversation-user-message"),children:[e,s.jsx(N,{name:o,timestamp:r})]})},pe=i.div`
|
|
276
280
|
margin-left: 10%;
|
|
277
281
|
width: 90%;
|
|
278
282
|
display: flex;
|
|
279
283
|
flex-direction: column;
|
|
280
284
|
align-items: flex-end;
|
|
281
|
-
`,
|
|
285
|
+
`,O=t=>Array.isArray(t)?t:Object.keys(t).map(e=>({label:t[e],actionKey:e})),xe=({header:t,actions:e,dispatch:r})=>s.jsx(ve,{className:"humany-conversation-button-list",header:t,items:O(e),renderItem:o=>{var l;const a=!!((l=o==null?void 0:o.data)!=null&&l.href);return s.jsx("li",{children:a?s.jsxs($e,{onClick:()=>{r("action",o)},href:o.data.href,target:o.data.target,"aria-label":o.label,title:o.label,children:[s.jsx(n.SymbolBadge,{symbol:o.symbol}),o.label]}):s.jsxs(je,{onClick:()=>{r("action",o)},"aria-label":o.label,title:o.label,children:[s.jsx(n.SymbolBadge,{symbol:o.symbol}),o.label]})},o.actionKey)}}),ve=i(n.ItemList)`
|
|
282
286
|
${n.itemList}
|
|
283
287
|
> ul {
|
|
284
288
|
display: flex;
|
|
@@ -288,8 +292,8 @@
|
|
|
288
292
|
margin: 0;
|
|
289
293
|
}
|
|
290
294
|
}
|
|
291
|
-
${
|
|
292
|
-
|
|
295
|
+
${S}
|
|
296
|
+
`,$e=i(n.Link)`
|
|
293
297
|
${n.buttonCss};
|
|
294
298
|
|
|
295
299
|
display: block;
|
|
@@ -308,7 +312,7 @@
|
|
|
308
312
|
svg {
|
|
309
313
|
margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
310
314
|
}
|
|
311
|
-
`,
|
|
315
|
+
`,je=i(n.Button)`
|
|
312
316
|
${n.buttonCss};
|
|
313
317
|
|
|
314
318
|
display: block;
|
|
@@ -327,22 +331,22 @@
|
|
|
327
331
|
svg {
|
|
328
332
|
margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
329
333
|
}
|
|
330
|
-
`,
|
|
334
|
+
`,Se=({type:t,content:e={}})=>{const r=n.useComponent(t);return!r||!t?null:s.jsx(y.Suspense,{fallback:null,children:s.jsx(r,{...e})})},we=({body:t})=>s.jsx(Ce,{html:t}),Ce=i(n.Html)`
|
|
331
335
|
${n.genericHtml}
|
|
332
336
|
color: inherit;
|
|
333
337
|
white-space: pre-wrap;
|
|
334
|
-
${
|
|
338
|
+
${S}
|
|
335
339
|
a {
|
|
336
340
|
color: ${t=>t.theme.colors.link};
|
|
337
341
|
&:focus-visible {
|
|
338
342
|
${n.borderTabStyle};
|
|
339
343
|
}
|
|
340
344
|
}
|
|
341
|
-
`,
|
|
345
|
+
`,ke=({header:t,actions:e,dispatch:r})=>s.jsx(Le,{className:"humany-conversation-item-list",header:t,items:O(e),renderItem:o=>{var a;return s.jsx("li",{children:s.jsxs(ze,{children:[((a=o.symbol)==null?void 0:a.content)&&s.jsx("div",{className:"item-icon",children:s.jsx(n.SymbolBadge,{size:22,symbol:{type:o.symbol.type,content:o.symbol.content}})}),s.jsxs("div",{className:"item-body",children:[s.jsx(n.Button,{onClick:()=>{r("action",o)},"aria-label":o.label,title:o.label,children:o.label}),o.description&&s.jsx("p",{children:o.description})]})]})},o.actionKey)}}),Le=i(n.ItemList)`
|
|
342
346
|
${n.itemList}
|
|
343
347
|
|
|
344
348
|
> .humany-paragraph {
|
|
345
|
-
${
|
|
349
|
+
${S}
|
|
346
350
|
margin-bottom: 0;
|
|
347
351
|
|
|
348
352
|
h1 {
|
|
@@ -350,7 +354,7 @@
|
|
|
350
354
|
}
|
|
351
355
|
}
|
|
352
356
|
|
|
353
|
-
${t=>n.headingElement(t)("h1",
|
|
357
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
354
358
|
white-space: normal;
|
|
355
359
|
`)}
|
|
356
360
|
|
|
@@ -370,10 +374,10 @@
|
|
|
370
374
|
border-bottom: none;
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
|
-
`,
|
|
377
|
+
`,ze=i.div`
|
|
374
378
|
display: flex;
|
|
375
379
|
gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
|
|
376
|
-
${
|
|
380
|
+
${S}
|
|
377
381
|
|
|
378
382
|
.item-icon {
|
|
379
383
|
}
|
|
@@ -407,11 +411,11 @@
|
|
|
407
411
|
}
|
|
408
412
|
}
|
|
409
413
|
}
|
|
410
|
-
`,
|
|
414
|
+
`,Te=({header:t,actions:e,dispatch:r})=>{const o=n.usePrevious(e),a=y.useRef(),l=n.useIsTabbing();return y.useEffect(()=>{if(o&&Array.isArray(e)&&Array.isArray(o)&&o.length<e.length&&a.current){const d=a.current.querySelectorAll(".humany-conversation-link-list > ul > li"),m=d[o.length];if(d.length===e.length&&o.length){const u=d[o.length-1];if(u){const f=u.querySelector(".humany-button");f&&f.focus()}}else m&&new MutationObserver((f,j)=>{f.forEach(c=>{if(c.addedNodes){const h=Array.from(c.addedNodes).find(x=>x.tagName==="BUTTON");h&&C.htmlParentContains(a.current,document.activeElement)&&(l&&h.focus(),j.disconnect())}})}).observe(m,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}}),s.jsx(Ne,{ref:a,className:"humany-conversation-link-list",header:t,items:O(e),renderItem:d=>s.jsx("li",{children:s.jsxs(Ie,{help:d.actionKey==="help",onClick:()=>{r("action",d)},"aria-label":d.label,title:d.label,children:[d.label,d.actionKey==="help"&&s.jsx(n.SymbolBadge,{size:14,symbol:{type:"Svg",content:"caret-down"}})]})},d.actionKey)})},Ne=i(n.ItemList)`
|
|
411
415
|
${n.itemList}
|
|
412
|
-
${
|
|
416
|
+
${S}
|
|
413
417
|
|
|
414
|
-
${t=>n.headingElement(t)("h1",
|
|
418
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
415
419
|
white-space: normal;
|
|
416
420
|
`)}
|
|
417
421
|
|
|
@@ -423,7 +427,7 @@
|
|
|
423
427
|
margin: 0;
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
|
-
`,
|
|
430
|
+
`,Ie=i(n.Button)`
|
|
427
431
|
display: block;
|
|
428
432
|
text-align: left;
|
|
429
433
|
font-weight: 300;
|
|
@@ -432,7 +436,7 @@
|
|
|
432
436
|
text-overflow: ellipsis;
|
|
433
437
|
overflow: hidden;
|
|
434
438
|
|
|
435
|
-
${t=>{var e,r;return t.help&&
|
|
439
|
+
${t=>{var e,r;return t.help&&b.css`
|
|
436
440
|
color: ${(e=t.theme.colors)==null?void 0:e.text};
|
|
437
441
|
text-decoration: underline;
|
|
438
442
|
|
|
@@ -449,12 +453,12 @@
|
|
|
449
453
|
text-decoration: underline;
|
|
450
454
|
}
|
|
451
455
|
}
|
|
452
|
-
`,
|
|
456
|
+
`,Me=()=>s.jsx(Be,{className:"humany-conversation-separator"}),Be=i.div`
|
|
453
457
|
${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
|
|
454
458
|
width: 100%;
|
|
455
|
-
`,
|
|
456
|
-
${
|
|
457
|
-
`,
|
|
459
|
+
`,He=({text:t})=>s.jsx(Ae,{className:"humany-conversation-text",variant:"span",children:t}),Ae=i(n.Typography)`
|
|
460
|
+
${S}
|
|
461
|
+
`,Re=({header:t="Video call",acceptLabel:e="Accept",declineLabel:r="Decline",dispatch:o})=>{const a=y.useMemo(()=>[{label:e,actionKey:"accept-video-call",symbol:{type:"Svg",content:"video"}},{label:r,actionKey:"decline-video-call",symbol:{type:"Svg",content:"close"}}],[e,r]);return s.jsx(Oe,{className:"humany-conversation-video-request",header:t,items:a,renderItem:l=>{const d=l.actionKey==="accept-video-call"?"#70c48e":"#da5c85";return s.jsx("li",{children:s.jsx(Ke,{onClick:()=>{o("action",l)},"aria-label":l.label,title:l.label,bgColor:d,children:s.jsx(n.SymbolBadge,{symbol:l.symbol,size:25})})},l.actionKey)}})},Oe=i(n.ItemList)`
|
|
458
462
|
${t=>n.itemList(t)}
|
|
459
463
|
> ul {
|
|
460
464
|
display: flex;
|
|
@@ -464,8 +468,8 @@
|
|
|
464
468
|
margin: 0;
|
|
465
469
|
}
|
|
466
470
|
}
|
|
467
|
-
${t=>
|
|
468
|
-
`,
|
|
471
|
+
${t=>S(t)}
|
|
472
|
+
`,Ke=i(n.Button)`
|
|
469
473
|
${n.buttonCss};
|
|
470
474
|
|
|
471
475
|
background-color: ${t=>t.bgColor};
|
|
@@ -499,20 +503,20 @@
|
|
|
499
503
|
stroke: #fff;
|
|
500
504
|
}
|
|
501
505
|
}
|
|
502
|
-
`,
|
|
506
|
+
`,qe=([t,e])=>({type:t,content:e}),De=({items:t,dispatch:e})=>s.jsx(Pe,{role:"none",className:"humany-message-list",items:t.map(qe),renderLi:!0,renderItem:r=>{switch(r.type){case v.ConversationMessageListItemType.Text:return s.jsx(He,{text:r.content});case v.ConversationMessageListItemType.HTML:return s.jsx(we,{...r.content});case v.ConversationMessageListItemType.Separator:return s.jsx(Me,{...r.content});case v.ConversationMessageListItemType.ItemList:return s.jsx(ke,{...r.content,dispatch:e});case v.ConversationMessageListItemType.LinkList:return s.jsx(Te,{...r.content,dispatch:e});case v.ConversationMessageListItemType.ButtonList:return s.jsx(xe,{...r.content,dispatch:e});case v.ConversationMessageListItemType.VideoRequest:return s.jsx(Re,{...r.content,dispatch:e});default:return s.jsx(Se,{type:r.type,content:r.content})}}}),Pe=i(n.List)`
|
|
503
507
|
${n.list}
|
|
504
508
|
|
|
505
509
|
> li {
|
|
506
510
|
margin: 0;
|
|
507
511
|
}
|
|
508
|
-
`,
|
|
512
|
+
`,Ee=y.forwardRef(({className:t,timestamp:e,sender:r,type:o,content:a},l)=>{const d=y.useCallback(c=>{let h="first";return a.length>1&&(h=c===0?"first":c+1===a.length?"last":"middle"),h},[a]),{userLabel:m=""}=n.useProperties(),u=()=>s.jsx(s.Fragment,{children:a.map(c=>{const{key:h,body:x,title:$,form:L,actions:p}=c,w=!!x&&!$&&!L&&!p;return s.jsx(ge,{className:t,discrete:w,ref:l,timestamp:e,fullWidth:!!L||!!p,children:w&&x?s.jsx(n.Html,{html:x}):s.jsx(M,{isSystem:!0,content:c})},h)})}),f=()=>s.jsxs(s.Fragment,{children:[s.jsxs(D,{className:"humany-sr-only",children:[r==null?void 0:r.name,":"]}),s.jsx(F,{sender:r,timestamp:e,className:t,children:s.jsx(H,{className:"humany-message-content-bundle",children:a.map((c,h)=>s.jsx(A,{className:"humany-message-container",left:!0,ref:l,children:s.jsx(M,{content:c,stacked:d(h)})},c.key))})})]}),j=()=>s.jsxs(s.Fragment,{children:[s.jsxs(D,{className:"humany-sr-only",children:[m,":"]}),s.jsx(be,{timestamp:e,className:t,children:s.jsx(H,{className:"humany-message-content-bundle",children:a.map((c,h)=>s.jsx(A,{className:"humany-message-container",right:!0,ref:l,children:s.jsx(M,{isUser:!0,content:c,stacked:d(h)})},c.key))})})]});switch(o){case v.ConversationMessageType.System:return u();case v.ConversationMessageType.Agent:return f();case v.ConversationMessageType.User:return j();default:return null}}),M=({content:t,isUser:e,isSystem:r,stacked:o})=>{const a=n.useDispatch(),{title:l,body:d,actions:m,form:u,items:f}=t;return f?s.jsx(R,{className:"humany-message-content",user:!!e,stacked:o,children:s.jsx(De,{items:f,dispatch:a})}):s.jsxs(R,{className:"humany-message-content",padded:!r,user:!!e,stacked:o,fullWidth:!!u||!!m,children:[l&&s.jsx(T,{children:s.jsx(oe,{variant:"h2",children:l})}),d&&s.jsx(T,{children:s.jsx(ce,{html:d})}),u&&s.jsx(T,{children:s.jsx(le,{...u,onChange:(c,h)=>{a("form",{data:h,formKey:u.schema.id,actionKey:c})}})}),m&&s.jsx(T,{children:s.jsx(de,{items:Object.keys(m).map(c=>({label:m[c],actionKey:c})),renderItem:c=>s.jsx("li",{children:s.jsx(me,{onClick:()=>{a("action",c.actionKey)},children:c.label})},c.actionKey)})})]})},D=i.div`
|
|
509
513
|
position: absolute;
|
|
510
514
|
left: -10000px;
|
|
511
515
|
top: auto;
|
|
512
516
|
width: 1px;
|
|
513
517
|
height: 1px;
|
|
514
518
|
overflow: hidden;
|
|
515
|
-
`,
|
|
519
|
+
`,W=()=>{const t=y.useCallback(m=>{m&&setTimeout(()=>{m.scrollIntoView({block:"start",behavior:"smooth"})},250)},[]),[e,r]=n.useScroll(!0),{messages:o,loading:a,typingActors:l=[]}=n.useProperties(),d=()=>l&&l.length?l.map((m,u)=>s.jsx(B,{id:`typing_${m.name}`,children:s.jsx(F,{timestamp:Date.now(),sender:m,children:s.jsx(K,{boxed:!0,ref:t})})},`typing_${m.name}`)):null;return s.jsxs(s.Fragment,{children:[s.jsxs(Fe,{tabIndex:0,scrollableCss:e,ref:r,children:[o&&o.length?o.map((m,u)=>{const{type:f,timestamp:j,sender:c,content:h}=m;return s.jsx(B,{className:"humany-conversation-entry",tabIndex:-1,children:s.jsx(Ee,{...m,ref:t})},`${f}_${c==null?void 0:c.name}_${j}_${h[0].key}`)}):null,d(),a&&s.jsx(B,{children:s.jsx(K,{ref:t})})]}),s.jsx(J,{})]})},Fe=i.div`
|
|
516
520
|
display: flex;
|
|
517
521
|
flex-direction: column;
|
|
518
522
|
align-items: stretch;
|
|
@@ -522,7 +526,7 @@
|
|
|
522
526
|
&:focus-visible {
|
|
523
527
|
${t=>n.borderTabStyle(t)};
|
|
524
528
|
}
|
|
525
|
-
`,
|
|
529
|
+
`,B=i.div`
|
|
526
530
|
margin: 0;
|
|
527
531
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
|
|
528
532
|
|
|
@@ -545,10 +549,10 @@
|
|
|
545
549
|
h1 {
|
|
546
550
|
font-weight: normal;
|
|
547
551
|
}
|
|
548
|
-
${t=>n.headingElement(t)("h1",
|
|
552
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
549
553
|
font-weight: normal;
|
|
550
554
|
`)}
|
|
551
|
-
`,
|
|
555
|
+
`,We=({dispatch:t})=>{const e=y.useRef(null);return y.useEffect(()=>{e.current&&e.current.parentNode&&t("overlay-mounted",e.current)},[e]),s.jsx(n.WidgetOverlayOutlet,{portalId:"humany-conversation-overlay-portal",className:"humany-conversation-overlay-outlet",ref:e})},Ue=({dispatch:t,header:e,buttonLabel:r})=>s.jsxs(Ve,{portalId:"humany-conversation-portal",className:"humany-conversation-outlet",children:[s.jsxs(_e,{className:"humany-conversation-outlet-head",children:[s.jsx(Ge,{className:"humany-conversation-outlet-head-button","aria-label":r,title:r,onClick:()=>t("hide-overlay-conversation"),children:s.jsx(n.SymbolBadge,{symbol:{type:"Svg",content:"caret-down"},size:20})}),e&&s.jsx(Ye,{className:"humany-conversation-outlet-header",variant:"h1",children:e})]}),s.jsx(W,{})]}),Ve=i(n.WidgetOverlayOutlet)`
|
|
552
556
|
z-index: 11;
|
|
553
557
|
top: auto;
|
|
554
558
|
height: 65%;
|
|
@@ -557,7 +561,7 @@
|
|
|
557
561
|
flex-direction: column;
|
|
558
562
|
border-top-right-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
559
563
|
border-top-left-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
560
|
-
`,
|
|
564
|
+
`,_e=i.div`
|
|
561
565
|
display: flex;
|
|
562
566
|
flex-direction: column;
|
|
563
567
|
justify-content: center;
|
|
@@ -565,11 +569,11 @@
|
|
|
565
569
|
gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
566
570
|
padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
567
571
|
${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
|
|
568
|
-
`,
|
|
572
|
+
`,Ye=i(n.Typography)`
|
|
569
573
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
|
|
570
574
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
571
575
|
margin: 0;
|
|
572
|
-
`,
|
|
576
|
+
`,Ge=i(n.Button)`
|
|
573
577
|
display: flex;
|
|
574
578
|
align-items: center;
|
|
575
579
|
justify-content: center;
|
|
@@ -583,7 +587,7 @@
|
|
|
583
587
|
svg line {
|
|
584
588
|
stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
585
589
|
}
|
|
586
|
-
`,
|
|
590
|
+
`,Je=({className:t,...e})=>{const{overlay:r,overlayConversationHeader:o,overlayConversationCloseLabel:a,conversationControllerId:l}=n.useProperties(),d=n.useDispatch(),u=n.useContainer().get("$settings");return s.jsx(n.ConversationContext.Provider,{value:l?{id:l}:null,children:s.jsxs(E.Provider,{value:u==null?void 0:u.language,children:[s.jsx(Qe,{"aria-live":"assertive",...e,className:C.appendClassNames(t,"humany-conversation-component"),children:s.jsx(W,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(We,{dispatch:d}),r.conversation&&s.jsx(Ue,{dispatch:d,header:o,buttonLabel:a})]})]})})},Qe=i.div`
|
|
587
591
|
position: absolute;
|
|
588
592
|
right: 0;
|
|
589
593
|
left: 0;
|
|
@@ -592,4 +596,4 @@
|
|
|
592
596
|
overflow: hidden;
|
|
593
597
|
display: flex;
|
|
594
598
|
flex-direction: column;
|
|
595
|
-
`;exports.default=
|
|
599
|
+
`;exports.default=Je;
|