@telia-ace/widget-conversation 1.1.2-rc.11 → 1.1.2-rc.13
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,18 +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"),
|
|
2
|
-
position: absolute;
|
|
3
|
-
bottom: 112px;
|
|
4
|
-
text-align: center;
|
|
5
|
-
background-color: white;
|
|
6
|
-
padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
7
|
-
text-decoration: none;
|
|
8
|
-
border-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
9
|
-
left: -10000000px;
|
|
10
|
-
&:focus-visible {
|
|
11
|
-
left: 50%;
|
|
12
|
-
transform: translateX(-50%);
|
|
13
|
-
${n.borderTabStyle};
|
|
14
|
-
}
|
|
15
|
-
`,te=i(n.Input)`
|
|
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"),X=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 G=({className:t})=>{const[e,o]=y.useState(""),[r,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(),[z,p]=n.useScroll(!0);y.useEffect(()=>{if(p.current){const{lineHeight:g,maxHeight:T}=getComputedStyle(p.current);if(g&&g.indexOf("px")>-1){const L=g.split("px"),_=parseInt(L[0],10);a(_);const Y=T.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}),o(""),M(""))):e.length<1&&g.preventDefault()},U=g=>{$&&(g.preventDefault(),u("action",{actionKey:$.action,...$}))},V=g=>{if(x&&p.current){const T=p.current.scrollHeight;if(T>r){p.current.style.height="auto";let L=T;g.length<1&&(L=r),p.current.style.height=`${L}px`,L>=l?p.current.style.overflowY="scroll":p.current.style.overflowY="hidden"}}},M=g=>{V(g),o(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:z,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(J,{value:e,onChange:M,onEnter:w,disabled:c,"aria-label":f,placeholder:f,type:"textarea",rows:1,ref:p}):s.jsx(Q,{value:e,onChange:M,onEnter:w,disabled:c,"aria-label":f,placeholder:f}),s.jsx(q,{disabled:!1,onClick:w,title:h,"aria-label":h,children:s.jsx(te,{size:22,symbol:{type:"Svg",content:"send"},hasContent:!!e&&!!e.length})})]})},J=i(n.Input)`
|
|
16
2
|
resize: none;
|
|
17
3
|
flex: 1;
|
|
18
4
|
flex-shrink: 1;
|
|
@@ -30,7 +16,7 @@
|
|
|
30
16
|
${n.borderTabStyle};
|
|
31
17
|
outline-offset: 12px;
|
|
32
18
|
}
|
|
33
|
-
`,
|
|
19
|
+
`,Q=i(n.Input)`
|
|
34
20
|
flex: 1;
|
|
35
21
|
border: none;
|
|
36
22
|
background-color: transparent;
|
|
@@ -44,7 +30,7 @@
|
|
|
44
30
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.textLight}};
|
|
45
31
|
font-style: italic;
|
|
46
32
|
}
|
|
47
|
-
`,
|
|
33
|
+
`,q=i(n.Button)`
|
|
48
34
|
flex: 0 0 50px;
|
|
49
35
|
align-self: stretch;
|
|
50
36
|
background-color: transparent;
|
|
@@ -56,14 +42,14 @@
|
|
|
56
42
|
&:focus-visible {
|
|
57
43
|
${n.borderTabStyle};
|
|
58
44
|
}
|
|
59
|
-
`,
|
|
45
|
+
`,Z=i(q)`
|
|
60
46
|
border-right: ${t=>t.theme.border};
|
|
61
47
|
margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0;
|
|
62
|
-
`,
|
|
63
|
-
${t=>t.grow?
|
|
48
|
+
`,ee=i.div`
|
|
49
|
+
${t=>t.grow?b.css`
|
|
64
50
|
min-height: 50px;
|
|
65
51
|
max-height: 150px;
|
|
66
|
-
`:
|
|
52
|
+
`:b.css`
|
|
67
53
|
height: 50px;
|
|
68
54
|
`}
|
|
69
55
|
flex: 0 0 auto;
|
|
@@ -75,13 +61,13 @@
|
|
|
75
61
|
textarea {
|
|
76
62
|
${t=>!!t.scrollableCss&&t.scrollableCss}
|
|
77
63
|
}
|
|
78
|
-
`,
|
|
64
|
+
`,te=i(({hasContent:t,...e})=>s.jsx(n.SymbolBadge,{...e}))`
|
|
79
65
|
line,
|
|
80
66
|
path {
|
|
81
67
|
stroke: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
|
|
82
68
|
fill: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
|
|
83
69
|
}
|
|
84
|
-
`,
|
|
70
|
+
`,se=i.div`
|
|
85
71
|
width: ${t=>t.avatarSize||"32px"};
|
|
86
72
|
height: ${t=>t.avatarSize||"32px"};
|
|
87
73
|
border-radius: 50%;
|
|
@@ -116,7 +102,7 @@
|
|
|
116
102
|
stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
117
103
|
}
|
|
118
104
|
}
|
|
119
|
-
`,
|
|
105
|
+
`,ne=b.keyframes`
|
|
120
106
|
0% {
|
|
121
107
|
opacity: 0;
|
|
122
108
|
}
|
|
@@ -126,7 +112,7 @@
|
|
|
126
112
|
100% {
|
|
127
113
|
opacity: 0;
|
|
128
114
|
}
|
|
129
|
-
`,
|
|
115
|
+
`,re=i.div`
|
|
130
116
|
display: flex;
|
|
131
117
|
justify-content: center;
|
|
132
118
|
> div {
|
|
@@ -135,7 +121,7 @@
|
|
|
135
121
|
border-radius: 50%;
|
|
136
122
|
margin: 5px;
|
|
137
123
|
background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
138
|
-
animation: ${
|
|
124
|
+
animation: ${ne} 1s infinite;
|
|
139
125
|
}
|
|
140
126
|
> div:nth-of-type(2) {
|
|
141
127
|
animation-delay: 100ms;
|
|
@@ -143,23 +129,23 @@
|
|
|
143
129
|
> div:nth-of-type(3) {
|
|
144
130
|
animation-delay: 200ms;
|
|
145
131
|
}
|
|
146
|
-
`,
|
|
132
|
+
`,H=i.div`
|
|
147
133
|
grid-area: content;
|
|
148
134
|
max-width: 100%;
|
|
149
135
|
overflow: hidden;
|
|
150
|
-
`,
|
|
136
|
+
`,oe=i(n.Typography)`
|
|
151
137
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
|
|
152
138
|
font-weight: normal;
|
|
153
139
|
margin: 0;
|
|
154
|
-
`,
|
|
140
|
+
`,A=i.div`
|
|
155
141
|
display: flex;
|
|
156
142
|
${t=>t.left&&"justify-content: start;"};
|
|
157
143
|
${t=>t.center&&"justify-content: center;"};
|
|
158
144
|
${t=>t.right&&"justify-content: end;"};
|
|
159
|
-
`,
|
|
145
|
+
`,O=i.div`
|
|
160
146
|
${t=>{var e;return t.padded&&`padding: ${(e=t.theme.sizes)==null?void 0:e.medium};`}}
|
|
161
|
-
${t=>!t.user&&t.stacked&&
|
|
162
|
-
${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)}
|
|
163
149
|
|
|
164
150
|
display: inline-block;
|
|
165
151
|
margin-top: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
@@ -172,12 +158,12 @@
|
|
|
172
158
|
}
|
|
173
159
|
max-width: 100%;
|
|
174
160
|
${t=>t.fullWidth&&"width: 100%;"}
|
|
175
|
-
`,
|
|
176
|
-
background-color: ${(
|
|
161
|
+
`,ae=(t,e)=>{var r,a;const o=b.css`
|
|
162
|
+
background-color: ${(r=e.colors)==null?void 0:r.accent};
|
|
177
163
|
color: ${(a=e.colors)==null?void 0:a.text};
|
|
178
164
|
${e.border&&`border: ${e.border};`};
|
|
179
|
-
`;return e.borderRadius?
|
|
180
|
-
${
|
|
165
|
+
`;return e.borderRadius?b.css`
|
|
166
|
+
${o}
|
|
181
167
|
|
|
182
168
|
border-top-right-radius: ${e.borderRadius};
|
|
183
169
|
border-bottom-right-radius: ${e.borderRadius};
|
|
@@ -189,11 +175,11 @@
|
|
|
189
175
|
${t==="last"&&`
|
|
190
176
|
border-bottom-left-radius: ${e.borderRadius};
|
|
191
177
|
`}
|
|
192
|
-
`:
|
|
193
|
-
background-color: ${(
|
|
178
|
+
`:o},ie=(t,e)=>{var r,a;const o=b.css`
|
|
179
|
+
background-color: ${(r=e.colors)==null?void 0:r.primary};
|
|
194
180
|
color: ${(a=e.colors)==null?void 0:a.accent};
|
|
195
|
-
`;return e.borderRadius?
|
|
196
|
-
${
|
|
181
|
+
`;return e.borderRadius?b.css`
|
|
182
|
+
${o}
|
|
197
183
|
|
|
198
184
|
border-top-left-radius: ${e.borderRadius};
|
|
199
185
|
border-bottom-left-radius: ${e.borderRadius};
|
|
@@ -205,17 +191,17 @@
|
|
|
205
191
|
${t==="last"&&`
|
|
206
192
|
border-bottom-right-radius: ${e.borderRadius};
|
|
207
193
|
`}
|
|
208
|
-
`:
|
|
194
|
+
`:o},N=i.div`
|
|
209
195
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
210
196
|
&:last-child {
|
|
211
197
|
margin-bottom: 0;
|
|
212
198
|
}
|
|
213
|
-
`,
|
|
199
|
+
`,S=t=>{var e,o;return b.css`
|
|
214
200
|
margin: ${(e=t.theme.sizes)==null?void 0:e.medium} 0;
|
|
215
|
-
padding: 0 ${(
|
|
216
|
-
`},
|
|
201
|
+
padding: 0 ${(o=t.theme.sizes)==null?void 0:o.medium};
|
|
202
|
+
`},le=i(X.FormComponent)`
|
|
217
203
|
& button.humany-form-component-button {
|
|
218
|
-
${t=>{var e,r,
|
|
204
|
+
${t=>{var e,o,r,a;return((e=t.theme.colors)==null?void 0:e.primary)&&((o=t.theme.colors)==null?void 0:o.accent)&&n.invertedHoverButton({active:!1,primaryColor:(r=t.theme.colors)==null?void 0:r.primary,secondaryColor:(a=t.theme.colors)==null?void 0:a.accent,theme:t.theme})}};
|
|
219
205
|
display: block;
|
|
220
206
|
width: 100%;
|
|
221
207
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
@@ -227,7 +213,7 @@
|
|
|
227
213
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
228
214
|
}
|
|
229
215
|
}
|
|
230
|
-
`,
|
|
216
|
+
`,ce=i(n.Html)`
|
|
231
217
|
white-space: pre-wrap;
|
|
232
218
|
a {
|
|
233
219
|
color: ${t=>t.theme.colors.link};
|
|
@@ -235,14 +221,14 @@
|
|
|
235
221
|
${t=>{var e;return((e=t.theme.accessibility)==null?void 0:e.isTabbing)&&n.borderTabStyle}};
|
|
236
222
|
}
|
|
237
223
|
}
|
|
238
|
-
`,
|
|
224
|
+
`,de=i(n.List)`
|
|
239
225
|
padding: 0;
|
|
240
226
|
list-style: none;
|
|
241
227
|
margin: 0 -${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
242
228
|
> li {
|
|
243
229
|
margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
244
230
|
}
|
|
245
|
-
`,
|
|
231
|
+
`,me=i.button`
|
|
246
232
|
${t=>n.buttonCss(t)};
|
|
247
233
|
display: block;
|
|
248
234
|
background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
|
|
@@ -252,7 +238,7 @@
|
|
|
252
238
|
${n.borderTabStyle}
|
|
253
239
|
background-color: transparent;
|
|
254
240
|
}
|
|
255
|
-
`,
|
|
241
|
+
`,E=y.forwardRef(({boxed:t,className:e,agentData:o},r)=>s.jsx(H,{ref:r,children:s.jsx(A,{left:t,center:!t,children:s.jsx(O,{padded:!!t,stacked:t?"first":void 0,children:s.jsxs(re,{children:[s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})})})})),P=y.createContext(null),ue=i.p`
|
|
256
242
|
&& {
|
|
257
243
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
|
|
258
244
|
font-weight: 300;
|
|
@@ -261,28 +247,28 @@
|
|
|
261
247
|
line-height: 1.5em;
|
|
262
248
|
grid-area: info;
|
|
263
249
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
264
|
-
`,
|
|
250
|
+
`,D=(t,e)=>new Date(t).toLocaleTimeString(e||[],{hour:"numeric",minute:"2-digit"}),k=({className:t,name:e,timestamp:o,ariaHidden:r=!1})=>{const a=y.useContext(P);if(!e&&!o)return null;let l="";return e?o?l=`${e}: ${D(o,a)}`:l=e:o&&(l=D(o,a)),s.jsx(ue,{"aria-hidden":r,children:l})},F=({className:t,children:e,sender:o,timestamp:r})=>{const{avatar:a,name:l}=o,{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(k,{name:l,timestamp:r,ariaHidden:!0})]})},he=i.div`
|
|
265
251
|
display: grid;
|
|
266
252
|
margin-right: 10%;
|
|
267
253
|
width: 90%;
|
|
268
|
-
${t=>t.hasAvatar?
|
|
254
|
+
${t=>t.hasAvatar?b.css`
|
|
269
255
|
grid-template-columns: auto 1fr;
|
|
270
256
|
grid-template-rows: 1fr auto;
|
|
271
257
|
grid-template-areas:
|
|
272
258
|
'avatar content'
|
|
273
259
|
'. info';
|
|
274
|
-
`:
|
|
260
|
+
`:b.css`
|
|
275
261
|
grid-template-columns: 1fr;
|
|
276
262
|
grid-template-rows: 1fr auto;
|
|
277
263
|
grid-template-areas:
|
|
278
264
|
'content'
|
|
279
265
|
'info';
|
|
280
266
|
`};
|
|
281
|
-
`,
|
|
267
|
+
`,ge=y.forwardRef(({className:t,children:e,timestamp:o,discrete:r,fullWidth:a},l)=>s.jsx(ye,{ref:l,className:C.appendClassNames(t,"humany-conversation-system-message"),fullWidth:a,children:r?s.jsxs(fe,{className:"humany-conversation-discrete-message",children:[e,s.jsx(k,{timestamp:o})]}):s.jsxs(s.Fragment,{children:[e,s.jsx(k,{timestamp:o})]})})),ye=i.div`
|
|
282
268
|
${t=>t.fullWidth&&"width: 100%"};
|
|
283
269
|
padding: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
284
270
|
overflow: auto;
|
|
285
|
-
`,
|
|
271
|
+
`,fe=i.div`
|
|
286
272
|
text-align: center;
|
|
287
273
|
word-wrap: break-word;
|
|
288
274
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
|
|
@@ -290,13 +276,13 @@
|
|
|
290
276
|
> p {
|
|
291
277
|
margin: 0;
|
|
292
278
|
}
|
|
293
|
-
|
|
279
|
+
`,be=({className:t,children:e,timestamp:o})=>{const{userLabel:r=""}=n.useProperties();return s.jsxs(pe,{className:C.appendClassNames(t,"humany-conversation-user-message"),children:[e,s.jsx(k,{name:r,timestamp:o,ariaHidden:!0})]})},pe=i.div`
|
|
294
280
|
margin-left: 10%;
|
|
295
281
|
width: 90%;
|
|
296
282
|
display: flex;
|
|
297
283
|
flex-direction: column;
|
|
298
284
|
align-items: flex-end;
|
|
299
|
-
`,
|
|
285
|
+
`,R=t=>Array.isArray(t)?t:Object.keys(t).map(e=>({label:t[e],actionKey:e})),xe=({header:t,actions:e,dispatch:o})=>s.jsx(ve,{className:"humany-conversation-button-list",header:t,items:R(e),renderItem:r=>{var l;const a=!!((l=r==null?void 0:r.data)!=null&&l.href);return s.jsx("li",{children:a?s.jsxs($e,{onClick:()=>{o("action",r)},href:r.data.href,target:r.data.target,"aria-label":r.label,title:r.label,children:[s.jsx(n.SymbolBadge,{symbol:r.symbol}),r.label]}):s.jsxs(je,{onClick:()=>{o("action",r)},"aria-label":r.label,title:r.label,children:[s.jsx(n.SymbolBadge,{symbol:r.symbol}),r.label]})},r.actionKey)}}),ve=i(n.ItemList)`
|
|
300
286
|
${n.itemList}
|
|
301
287
|
> ul {
|
|
302
288
|
display: flex;
|
|
@@ -306,8 +292,8 @@
|
|
|
306
292
|
margin: 0;
|
|
307
293
|
}
|
|
308
294
|
}
|
|
309
|
-
${
|
|
310
|
-
|
|
295
|
+
${S}
|
|
296
|
+
`,$e=i(n.Link)`
|
|
311
297
|
${n.buttonCss};
|
|
312
298
|
|
|
313
299
|
display: block;
|
|
@@ -326,7 +312,7 @@
|
|
|
326
312
|
svg {
|
|
327
313
|
margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
328
314
|
}
|
|
329
|
-
`,
|
|
315
|
+
`,je=i(n.Button)`
|
|
330
316
|
${n.buttonCss};
|
|
331
317
|
|
|
332
318
|
display: block;
|
|
@@ -345,22 +331,22 @@
|
|
|
345
331
|
svg {
|
|
346
332
|
margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
347
333
|
}
|
|
348
|
-
`,
|
|
334
|
+
`,Se=({type:t,content:e={}})=>{const o=n.useComponent(t);return!o||!t?null:s.jsx(y.Suspense,{fallback:null,children:s.jsx(o,{...e})})},we=({body:t})=>s.jsx(ke,{html:t}),ke=i(n.Html)`
|
|
349
335
|
${n.genericHtml}
|
|
350
336
|
color: inherit;
|
|
351
337
|
white-space: pre-wrap;
|
|
352
|
-
${
|
|
338
|
+
${S}
|
|
353
339
|
a {
|
|
354
340
|
color: ${t=>t.theme.colors.link};
|
|
355
341
|
&:focus-visible {
|
|
356
342
|
${n.borderTabStyle};
|
|
357
343
|
}
|
|
358
344
|
}
|
|
359
|
-
`,
|
|
345
|
+
`,Ce=({header:t,actions:e,dispatch:o})=>s.jsx(Le,{className:"humany-conversation-item-list",header:t,items:R(e),renderItem:r=>{var a;return s.jsx("li",{children:s.jsxs(ze,{children:[((a=r.symbol)==null?void 0:a.content)&&s.jsx("div",{className:"item-icon",children:s.jsx(n.SymbolBadge,{size:22,symbol:{type:r.symbol.type,content:r.symbol.content}})}),s.jsxs("div",{className:"item-body",children:[s.jsx(n.Button,{onClick:()=>{o("action",r)},"aria-label":r.label,title:r.label,children:r.label}),r.description&&s.jsx("p",{children:r.description})]})]})},r.actionKey)}}),Le=i(n.ItemList)`
|
|
360
346
|
${n.itemList}
|
|
361
347
|
|
|
362
348
|
> .humany-paragraph {
|
|
363
|
-
${
|
|
349
|
+
${S}
|
|
364
350
|
margin-bottom: 0;
|
|
365
351
|
|
|
366
352
|
h1 {
|
|
@@ -368,7 +354,7 @@
|
|
|
368
354
|
}
|
|
369
355
|
}
|
|
370
356
|
|
|
371
|
-
${t=>n.headingElement(t)("h1",
|
|
357
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
372
358
|
white-space: normal;
|
|
373
359
|
`)}
|
|
374
360
|
|
|
@@ -388,10 +374,10 @@
|
|
|
388
374
|
border-bottom: none;
|
|
389
375
|
}
|
|
390
376
|
}
|
|
391
|
-
`,
|
|
377
|
+
`,ze=i.div`
|
|
392
378
|
display: flex;
|
|
393
379
|
gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
|
|
394
|
-
${
|
|
380
|
+
${S}
|
|
395
381
|
|
|
396
382
|
.item-icon {
|
|
397
383
|
}
|
|
@@ -425,11 +411,11 @@
|
|
|
425
411
|
}
|
|
426
412
|
}
|
|
427
413
|
}
|
|
428
|
-
`,
|
|
414
|
+
`,Te=({header:t,actions:e,dispatch:o})=>{const r=n.usePrevious(e),a=y.useRef(),l=n.useIsTabbing();return y.useEffect(()=>{if(r&&Array.isArray(e)&&Array.isArray(r)&&r.length<e.length&&a.current){const d=a.current.querySelectorAll(".humany-conversation-link-list > ul > li"),m=d[r.length];if(d.length===e.length&&r.length){const u=d[r.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:R(e),renderItem:d=>s.jsx("li",{children:s.jsxs(Me,{help:d.actionKey==="help",onClick:()=>{o("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)`
|
|
429
415
|
${n.itemList}
|
|
430
|
-
${
|
|
416
|
+
${S}
|
|
431
417
|
|
|
432
|
-
${t=>n.headingElement(t)("h1",
|
|
418
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
433
419
|
white-space: normal;
|
|
434
420
|
`)}
|
|
435
421
|
|
|
@@ -441,7 +427,7 @@
|
|
|
441
427
|
margin: 0;
|
|
442
428
|
}
|
|
443
429
|
}
|
|
444
|
-
`,
|
|
430
|
+
`,Me=i(n.Button)`
|
|
445
431
|
display: block;
|
|
446
432
|
text-align: left;
|
|
447
433
|
font-weight: 300;
|
|
@@ -450,13 +436,13 @@
|
|
|
450
436
|
text-overflow: ellipsis;
|
|
451
437
|
overflow: hidden;
|
|
452
438
|
|
|
453
|
-
${t=>{var e,
|
|
439
|
+
${t=>{var e,o;return t.help&&b.css`
|
|
454
440
|
color: ${(e=t.theme.colors)==null?void 0:e.text};
|
|
455
441
|
text-decoration: underline;
|
|
456
442
|
|
|
457
443
|
i,
|
|
458
444
|
svg {
|
|
459
|
-
margin-left: ${(
|
|
445
|
+
margin-left: ${(o=t.theme.sizes)==null?void 0:o.small};
|
|
460
446
|
}
|
|
461
447
|
`}}
|
|
462
448
|
|
|
@@ -467,12 +453,12 @@
|
|
|
467
453
|
text-decoration: underline;
|
|
468
454
|
}
|
|
469
455
|
}
|
|
470
|
-
`,
|
|
456
|
+
`,Ie=()=>s.jsx(Be,{className:"humany-conversation-separator"}),Be=i.div`
|
|
471
457
|
${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
|
|
472
458
|
width: 100%;
|
|
473
|
-
`,
|
|
474
|
-
${
|
|
475
|
-
`,
|
|
459
|
+
`,He=({text:t})=>s.jsx(Ae,{className:"humany-conversation-text",variant:"span",children:t}),Ae=i(n.Typography)`
|
|
460
|
+
${S}
|
|
461
|
+
`,Oe=({header:t="Video call",acceptLabel:e="Accept",declineLabel:o="Decline",dispatch:r})=>{const a=y.useMemo(()=>[{label:e,actionKey:"accept-video-call",symbol:{type:"Svg",content:"video"}},{label:o,actionKey:"decline-video-call",symbol:{type:"Svg",content:"close"}}],[e,o]);return s.jsx(Re,{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(Ee,{onClick:()=>{r("action",l)},"aria-label":l.label,title:l.label,bgColor:d,children:s.jsx(n.SymbolBadge,{symbol:l.symbol,size:25})})},l.actionKey)}})},Re=i(n.ItemList)`
|
|
476
462
|
${t=>n.itemList(t)}
|
|
477
463
|
> ul {
|
|
478
464
|
display: flex;
|
|
@@ -482,8 +468,8 @@
|
|
|
482
468
|
margin: 0;
|
|
483
469
|
}
|
|
484
470
|
}
|
|
485
|
-
${t=>
|
|
486
|
-
`,
|
|
471
|
+
${t=>S(t)}
|
|
472
|
+
`,Ee=i(n.Button)`
|
|
487
473
|
${n.buttonCss};
|
|
488
474
|
|
|
489
475
|
background-color: ${t=>t.bgColor};
|
|
@@ -517,20 +503,34 @@
|
|
|
517
503
|
stroke: #fff;
|
|
518
504
|
}
|
|
519
505
|
}
|
|
520
|
-
`,
|
|
506
|
+
`,De=([t,e])=>({type:t,content:e}),Ke=({items:t,dispatch:e})=>s.jsx(qe,{role:"none",className:"humany-message-list",items:t.map(De),renderLi:!0,renderItem:o=>{switch(o.type){case v.ConversationMessageListItemType.Text:return s.jsx(He,{text:o.content});case v.ConversationMessageListItemType.HTML:return s.jsx(we,{...o.content});case v.ConversationMessageListItemType.Separator:return s.jsx(Ie,{...o.content});case v.ConversationMessageListItemType.ItemList:return s.jsx(Ce,{...o.content,dispatch:e});case v.ConversationMessageListItemType.LinkList:return s.jsx(Te,{...o.content,dispatch:e});case v.ConversationMessageListItemType.ButtonList:return s.jsx(xe,{...o.content,dispatch:e});case v.ConversationMessageListItemType.VideoRequest:return s.jsx(Oe,{...o.content,dispatch:e});default:return s.jsx(Se,{type:o.type,content:o.content})}}}),qe=i(n.List)`
|
|
521
507
|
${n.list}
|
|
522
508
|
|
|
523
509
|
> li {
|
|
524
510
|
margin: 0;
|
|
525
511
|
}
|
|
526
|
-
`,
|
|
512
|
+
`,Pe=y.forwardRef(({className:t,timestamp:e,sender:o,type:r,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:z,actions:p}=c,w=!!x&&!$&&!z&&!p;return s.jsx(ge,{className:t,discrete:w,ref:l,timestamp:e,fullWidth:!!z||!!p,children:w&&x?s.jsx(n.Html,{html:x}):s.jsx(I,{isSystem:!0,content:c})},h)})}),f=()=>s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"humany-sr-only",children:s.jsx(k,{name:o==null?void 0:o.name,timestamp:e})}),s.jsx(F,{sender:o,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(I,{content:c,stacked:d(h)})},c.key))})})]}),j=()=>s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"humany-sr-only",children:s.jsx(k,{name:m,timestamp:e})}),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(I,{isUser:!0,content:c,stacked:d(h)})},c.key))})})]});switch(r){case v.ConversationMessageType.System:return u();case v.ConversationMessageType.Agent:return f();case v.ConversationMessageType.User:return j();default:return null}}),I=({content:t,isUser:e,isSystem:o,stacked:r})=>{const a=n.useDispatch(),{title:l,body:d,actions:m,form:u,items:f}=t;return f?s.jsx(O,{className:"humany-message-content",user:!!e,stacked:r,children:s.jsx(Ke,{items:f,dispatch:a})}):s.jsxs(O,{className:"humany-message-content",padded:!o,user:!!e,stacked:r,fullWidth:!!u||!!m,children:[l&&s.jsx(N,{children:s.jsx(oe,{variant:"h2",children:l})}),d&&s.jsx(N,{children:s.jsx(ce,{html:d})}),u&&s.jsx(N,{children:s.jsx(le,{...u,onChange:(c,h)=>{a("form",{data:h,formKey:u.schema.id,actionKey:c})}})}),m&&s.jsx(N,{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)})})]})},K=i.div`
|
|
527
513
|
position: absolute;
|
|
528
514
|
left: -10000px;
|
|
529
515
|
top: auto;
|
|
530
516
|
width: 1px;
|
|
531
517
|
height: 1px;
|
|
532
518
|
overflow: hidden;
|
|
533
|
-
`,
|
|
519
|
+
`,Fe=()=>{const{skipToLatestMessageLabel:t="Skip to latest message"}=n.useProperties(),e=n.useContainer(),o=()=>{const r=e.get("widgetDOMElement");if(r){const a=r.querySelectorAll(".humany-conversation-entry");a.length&&a[a.length-1].focus()}};return s.jsx(We,{className:"humany-skip-to-latest-message",onKeyDown:r=>{(r.key==="Enter"||r.keyCode===13)&&o()},onClick:o,children:t})},We=i.button`
|
|
520
|
+
position: absolute;
|
|
521
|
+
bottom: 60px;
|
|
522
|
+
text-align: center;
|
|
523
|
+
background-color: white;
|
|
524
|
+
text-decoration: none;
|
|
525
|
+
padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
526
|
+
border-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
527
|
+
left: -10000000px;
|
|
528
|
+
&:focus-visible {
|
|
529
|
+
left: 50%;
|
|
530
|
+
transform: translateX(-50%);
|
|
531
|
+
${n.borderTabStyle};
|
|
532
|
+
}
|
|
533
|
+
`,W=()=>{const t=y.useCallback(m=>{m&&setTimeout(()=>{m.scrollIntoView({block:"start",behavior:"smooth"})},250)},[]),[e,o]=n.useScroll(!0),{messages:r,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(E,{boxed:!0,ref:t})})},`typing_${m.name}`)):null;return s.jsxs(s.Fragment,{children:[s.jsxs(Ue,{tabIndex:0,scrollableCss:e,ref:o,children:[r&&r.length?r.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(Pe,{...m,ref:t})},`${f}_${c==null?void 0:c.name}_${j}_${h[0].key}`)}):null,d(),a&&s.jsx(B,{children:s.jsx(E,{ref:t})})]}),s.jsx(G,{}),s.jsx(Fe,{})]})},Ue=i.div`
|
|
534
534
|
display: flex;
|
|
535
535
|
flex-direction: column;
|
|
536
536
|
align-items: stretch;
|
|
@@ -540,7 +540,7 @@
|
|
|
540
540
|
&:focus-visible {
|
|
541
541
|
${t=>n.borderTabStyle(t)};
|
|
542
542
|
}
|
|
543
|
-
`,
|
|
543
|
+
`,B=i.div`
|
|
544
544
|
margin: 0;
|
|
545
545
|
margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
|
|
546
546
|
|
|
@@ -568,10 +568,10 @@
|
|
|
568
568
|
${n.borderTabStyle}
|
|
569
569
|
border-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
|
|
570
570
|
}
|
|
571
|
-
${t=>n.headingElement(t)("h1",
|
|
571
|
+
${t=>n.headingElement(t)("h1",b.css`
|
|
572
572
|
font-weight: normal;
|
|
573
573
|
`)}
|
|
574
|
-
`,
|
|
574
|
+
`,Ve=({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})},_e=({dispatch:t,header:e,buttonLabel:o})=>s.jsxs(Ye,{portalId:"humany-conversation-portal",className:"humany-conversation-outlet",children:[s.jsxs(Xe,{className:"humany-conversation-outlet-head",children:[s.jsx(Je,{className:"humany-conversation-outlet-head-button","aria-label":o,title:o,onClick:()=>t("hide-overlay-conversation"),children:s.jsx(n.SymbolBadge,{symbol:{type:"Svg",content:"caret-down"},size:20})}),e&&s.jsx(Ge,{className:"humany-conversation-outlet-header",variant:"h1",children:e})]}),s.jsx(W,{})]}),Ye=i(n.WidgetOverlayOutlet)`
|
|
575
575
|
z-index: 11;
|
|
576
576
|
top: auto;
|
|
577
577
|
height: 65%;
|
|
@@ -580,7 +580,7 @@
|
|
|
580
580
|
flex-direction: column;
|
|
581
581
|
border-top-right-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
582
582
|
border-top-left-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
|
|
583
|
-
`,
|
|
583
|
+
`,Xe=i.div`
|
|
584
584
|
display: flex;
|
|
585
585
|
flex-direction: column;
|
|
586
586
|
justify-content: center;
|
|
@@ -588,11 +588,11 @@
|
|
|
588
588
|
gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
589
589
|
padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
|
|
590
590
|
${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
|
|
591
|
-
`,
|
|
591
|
+
`,Ge=i(n.Typography)`
|
|
592
592
|
font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
|
|
593
593
|
color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
594
594
|
margin: 0;
|
|
595
|
-
`,
|
|
595
|
+
`,Je=i(n.Button)`
|
|
596
596
|
display: flex;
|
|
597
597
|
align-items: center;
|
|
598
598
|
justify-content: center;
|
|
@@ -606,7 +606,7 @@
|
|
|
606
606
|
svg line {
|
|
607
607
|
stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
608
608
|
}
|
|
609
|
-
`,
|
|
609
|
+
`,Qe=({className:t,...e})=>{const{overlay:o,overlayConversationHeader:r,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(P.Provider,{value:u==null?void 0:u.language,children:[s.jsx(Ze,{"aria-live":"assertive",...e,className:C.appendClassNames(t,"humany-conversation-component"),children:s.jsx(W,{})}),o&&s.jsxs(s.Fragment,{children:[s.jsx(Ve,{dispatch:d}),o.conversation&&s.jsx(_e,{dispatch:d,header:r,buttonLabel:a})]})]})})},Ze=i.div`
|
|
610
610
|
position: absolute;
|
|
611
611
|
right: 0;
|
|
612
612
|
left: 0;
|
|
@@ -615,4 +615,4 @@
|
|
|
615
615
|
overflow: hidden;
|
|
616
616
|
display: flex;
|
|
617
617
|
flex-direction: column;
|
|
618
|
-
`;exports.default=
|
|
618
|
+
`;exports.default=Qe;
|