@telia-ace/widget-conversation 0.0.1

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.
Files changed (47) hide show
  1. package/agent.d.ts +22 -0
  2. package/components/conversation/conversation.d.ts +7 -0
  3. package/components/conversation/plugin.d.ts +48 -0
  4. package/components/conversation/ui/content.d.ts +3 -0
  5. package/components/conversation/ui/input.d.ts +7 -0
  6. package/components/conversation/ui/language-context.d.ts +3 -0
  7. package/components/conversation/ui/loader.d.ts +10 -0
  8. package/components/conversation/ui/message-list-items/button-list.d.ts +9 -0
  9. package/components/conversation/ui/message-list-items/custom.d.ts +10 -0
  10. package/components/conversation/ui/message-list-items/html.d.ts +6 -0
  11. package/components/conversation/ui/message-list-items/item-list.d.ts +9 -0
  12. package/components/conversation/ui/message-list-items/link-list.d.ts +9 -0
  13. package/components/conversation/ui/message-list-items/separator.d.ts +3 -0
  14. package/components/conversation/ui/message-list-items/text.d.ts +7 -0
  15. package/components/conversation/ui/message-list-items/video-request.d.ts +9 -0
  16. package/components/conversation/ui/message-types/agent.d.ts +12 -0
  17. package/components/conversation/ui/message-types/index.d.ts +4 -0
  18. package/components/conversation/ui/message-types/message-list.d.ts +10 -0
  19. package/components/conversation/ui/message-types/system.d.ts +16 -0
  20. package/components/conversation/ui/message-types/timestamp.d.ts +10 -0
  21. package/components/conversation/ui/message-types/user.d.ts +9 -0
  22. package/components/conversation/ui/message.d.ts +6 -0
  23. package/components/conversation/ui/overlay-outlets.d.ts +14 -0
  24. package/components/conversation/ui/skip-link.d.ts +4 -0
  25. package/components/conversation/ui/styles.d.ts +62 -0
  26. package/components/return-button/plugin.d.ts +19 -0
  27. package/components/return-button/return-button.d.ts +7 -0
  28. package/conversation-3787f6ba.mjs +1619 -0
  29. package/conversation-92e4cb62.js +623 -0
  30. package/conversation-controller.d.ts +122 -0
  31. package/conversation-history.d.ts +27 -0
  32. package/conversation-platform.d.ts +55 -0
  33. package/conversation-provider.d.ts +34 -0
  34. package/index.d.ts +13 -0
  35. package/index.js +3 -0
  36. package/index.mjs +1086 -0
  37. package/package.json +27 -0
  38. package/return-button-3e542ab7.mjs +154 -0
  39. package/return-button-f1f43984.js +97 -0
  40. package/store.d.ts +33 -0
  41. package/types.d.ts +130 -0
  42. package/user.d.ts +10 -0
  43. package/utils/custom-message.d.ts +4 -0
  44. package/utils/index.d.ts +1 -0
  45. package/utils/map-actions.d.ts +1 -0
  46. package/utils/open-chat-widget.d.ts +5 -0
  47. package/utils/swap-provider.d.ts +9 -0
@@ -0,0 +1,623 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("@emotion/styled"),n=require("@telia-ace/widget-ui"),w=require("@telia-ace/widget-utilities"),v=require("@emotion/react"),g=require("react"),J=require("@telia-ace/widget-forms"),S=require("./index.js");require("@telia-ace/widget-core");require("@telia-ace/widget-services");require("@telia-ace/widget-plugins");const Q=({className:t})=>{const[e,o]=g.useState(""),[a,i]=g.useState(0),[r,u]=g.useState(0),m=n.useIsTabbing(),d=n.useDispatch(),{inputPlaceholder:f="Type your message",inputHidden:$=!1,inputDisabled:c=!1,sendButtonLabel:h="Send message",inputMultiline:b=!0,secondaryAction:x}=n.useProperties(),[j,p]=n.useScroll(!0),T=n.useContainer();g.useEffect(()=>{if(p.current){const{lineHeight:y,maxHeight:C}=getComputedStyle(p.current);if(y&&y.indexOf("px")>-1){const z=y.split("px"),X=parseInt(z[0],10);i(X);const G=C.split("px");u(parseInt(G[0],10))}}},[p.current]);const I=y=>{!y.shiftKey||!b?(y.preventDefault(),e&&e.length>0&&(d("user-submit",{text:e}),o(""),B(""))):e.length<1&&y.preventDefault()},_=y=>{if(!x)return;y.preventDefault(),d("action",{actionKey:x.action,...x});const{events:C}=T.get("$widget");C.dispatch("tracking:secondary-clicked",{})},Y=y=>{if(b&&p.current){const C=p.current.scrollHeight;if(C>a){p.current.style.height="auto";let z=C;y.length<1&&(z=a),p.current.style.height=`${z}px`,z>=r?p.current.style.overflowY="scroll":p.current.style.overflowY="hidden"}}},B=y=>{Y(y),o(y),y&&y.length>0&&d("user-typing",{textLength:y.length})};return $?null:s.jsxs(se,{grow:b,className:w.appendClassNames("humany-conversation-input",t),scrollableCss:j,isTabbing:m,children:[x&&s.jsx(te,{className:"humany-secondary-button",disabled:c,onClick:_,title:x.label,"aria-label":x.label,children:s.jsx(n.SymbolBadge,{size:24,symbol:{type:"Svg",content:x.icon||"browse"}})}),b?s.jsx(Z,{value:e,onChange:B,onEnter:I,disabled:c,"aria-label":f,placeholder:f,type:"textarea",rows:1,ref:p}):s.jsx(ee,{value:e,onChange:B,onEnter:I,disabled:c,"aria-label":f,placeholder:f}),s.jsx(F,{className:"humany-send-button",disabled:!1,onClick:I,title:h,"aria-label":h,children:s.jsx(ne,{size:22,symbol:{type:"Svg",content:"send"},hasContent:!!e&&!!e.length})})]})},Z=l(n.Input)`
2
+ resize: none;
3
+ flex: 1;
4
+ flex-shrink: 1;
5
+ min-height: 1.2em;
6
+ max-height: 148px;
7
+ line-height: 1.2em;
8
+ height: 1.2em;
9
+ padding: 0;
10
+ margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
11
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
12
+ border: none;
13
+ transition: height 200ms linear;
14
+ outline: none;
15
+ &:focus-visible {
16
+ ${n.borderTabStyle};
17
+ outline-offset: 12px;
18
+ }
19
+ `,ee=l(n.Input)`
20
+ flex: 1;
21
+ border: none;
22
+ background-color: transparent;
23
+ font-weight: 300;
24
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
25
+ line-height: 1.2em;
26
+ outline: none;
27
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
28
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
29
+ &::placeholder {
30
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.textLight}};
31
+ font-style: italic;
32
+ }
33
+ `,F=l(n.Button)`
34
+ flex: 0 0 50px;
35
+ align-self: stretch;
36
+ background-color: transparent;
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ border: none;
41
+ color: #a6a6a6;
42
+ &:focus-visible {
43
+ ${n.borderTabStyle};
44
+ }
45
+ `,te=l(F)`
46
+ border-right: ${t=>t.theme.border};
47
+ margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0;
48
+ `,se=l.div`
49
+ ${t=>t.grow?v.css`
50
+ min-height: 50px;
51
+ max-height: 150px;
52
+ `:v.css`
53
+ height: 50px;
54
+ `}
55
+ flex: 0 0 auto;
56
+ display: flex;
57
+ align-items: center;
58
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.accent}};
59
+ border-top: ${t=>t.theme.inputBorder};
60
+ ${t=>t["data-has-focus"]&&t.isTabbing&&n.borderTabStyle}
61
+ textarea {
62
+ ${t=>!!t.scrollableCss&&t.scrollableCss}
63
+ }
64
+ `,ne=l(({hasContent:t,...e})=>s.jsx(n.SymbolBadge,{...e}))`
65
+ line,
66
+ path {
67
+ stroke: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
68
+ fill: ${t=>{var e;return t.hasContent?(e=t.theme.colors)==null?void 0:e.primary:"#a6a6a6"}};
69
+ }
70
+ `,re=l.div`
71
+ width: ${t=>t.avatarSize||"32px"};
72
+ height: ${t=>t.avatarSize||"32px"};
73
+ border-radius: 50%;
74
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.accent}};
75
+ border: ${t=>t.theme.border};
76
+ grid-area: avatar;
77
+ align-self: flex-end;
78
+ justify-self: center;
79
+ overflow: hidden;
80
+ margin-right: 10px;
81
+ display: flex;
82
+ justify-content: center;
83
+ align-items: center;
84
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
85
+
86
+ > img {
87
+ height: 100%;
88
+ width: 100%;
89
+ object-fit: cover;
90
+ }
91
+
92
+ > svg {
93
+ width: 90%;
94
+ height: 90%;
95
+ padding: 10%;
96
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
97
+
98
+ line,
99
+ path,
100
+ circle,
101
+ fill {
102
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
103
+ }
104
+ }
105
+ `,oe=v.keyframes`
106
+ 0% {
107
+ opacity: 0;
108
+ }
109
+ 75% {
110
+ opacity: 1;
111
+ }
112
+ 100% {
113
+ opacity: 0;
114
+ }
115
+ `,ae=l.div`
116
+ display: flex;
117
+ justify-content: center;
118
+ > div {
119
+ height: 10px;
120
+ width: 10px;
121
+ border-radius: 50%;
122
+ margin: 5px;
123
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
124
+ animation: ${oe} 1s infinite;
125
+ }
126
+ > div:nth-of-type(2) {
127
+ animation-delay: 100ms;
128
+ }
129
+ > div:nth-of-type(3) {
130
+ animation-delay: 200ms;
131
+ }
132
+ `,H=l.div`
133
+ grid-area: content;
134
+ max-width: 100%;
135
+ overflow: hidden;
136
+ `,ie=l(n.Typography)`
137
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
138
+ font-weight: normal;
139
+ margin: 0;
140
+ `,E=l.div`
141
+ display: flex;
142
+ ${t=>t.left&&"justify-content: start;"};
143
+ ${t=>t.center&&"justify-content: center;"};
144
+ ${t=>t.right&&"justify-content: end;"};
145
+ `,R=l.div`
146
+ ${t=>{var e;return t.padded&&`padding: ${(e=t.theme.sizes)==null?void 0:e.medium};`}}
147
+ ${t=>!t.user&&t.stacked&&le(t.stacked,t.theme)}
148
+ ${t=>t.user&&t.stacked&&ce(t.stacked,t.theme)}
149
+
150
+ display: inline-block;
151
+ margin-top: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
152
+ && > * {
153
+ overflow-wrap: break-word;
154
+ word-wrap: break-word;
155
+ word-break: break-all;
156
+ word-break: break-word;
157
+ hyphens: auto;
158
+ }
159
+ max-width: 100%;
160
+ ${t=>t.fullWidth&&"width: 100%;"}
161
+ `,le=(t,e)=>{var a,i;const o=v.css`
162
+ background-color: ${(a=e.colors)==null?void 0:a.accent};
163
+ color: ${(i=e.colors)==null?void 0:i.text};
164
+ ${e.border&&`border: ${e.border};`};
165
+ `;return e.borderRadius?v.css`
166
+ ${o}
167
+
168
+ border-top-right-radius: ${e.borderRadius};
169
+ border-bottom-right-radius: ${e.borderRadius};
170
+
171
+ ${t==="first"&&`
172
+ border-top-left-radius: ${e.borderRadius};
173
+ `}
174
+
175
+ ${t==="last"&&`
176
+ border-bottom-left-radius: ${e.borderRadius};
177
+ `}
178
+ `:o},ce=(t,e)=>{var a,i;const o=v.css`
179
+ background-color: ${(a=e.colors)==null?void 0:a.primary};
180
+ color: ${(i=e.colors)==null?void 0:i.accent};
181
+ `;return e.borderRadius?v.css`
182
+ ${o}
183
+
184
+ border-top-left-radius: ${e.borderRadius};
185
+ border-bottom-left-radius: ${e.borderRadius};
186
+
187
+ ${t==="first"&&`
188
+ border-top-right-radius: ${e.borderRadius};
189
+ `}
190
+
191
+ ${t==="last"&&`
192
+ border-bottom-right-radius: ${e.borderRadius};
193
+ `}
194
+ `:o},N=l.div`
195
+ margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
196
+ &:last-child {
197
+ margin-bottom: 0;
198
+ }
199
+ `,k=t=>{var e,o;return v.css`
200
+ margin: ${(e=t.theme.sizes)==null?void 0:e.medium} 0;
201
+ padding: 0 ${(o=t.theme.sizes)==null?void 0:o.medium};
202
+ `},de=l(J.FormComponent)`
203
+ & button.humany-form-component-button {
204
+ ${t=>{var e,o,a,i;return((e=t.theme.colors)==null?void 0:e.primary)&&((o=t.theme.colors)==null?void 0:o.accent)&&n.invertedHoverButton({active:!1,primaryColor:(a=t.theme.colors)==null?void 0:a.primary,secondaryColor:(i=t.theme.colors)==null?void 0:i.accent,theme:t.theme})}};
205
+ display: block;
206
+ width: 100%;
207
+ margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
208
+ }
209
+ & button.humany-form-component-submit {
210
+ width: 100%;
211
+ margin: 0;
212
+ :not(:last-child) {
213
+ margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
214
+ }
215
+ }
216
+ `,ue=l(n.Html)`
217
+ white-space: pre-wrap;
218
+ a {
219
+ color: ${t=>t.theme.colors.link};
220
+ &:focus {
221
+ ${t=>{var e;return((e=t.theme.accessibility)==null?void 0:e.isTabbing)&&n.borderTabStyle}};
222
+ }
223
+ }
224
+ `,me=l(n.List)`
225
+ padding: 0;
226
+ list-style: none;
227
+ margin: 0 -${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
228
+ > li {
229
+ margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
230
+ }
231
+ `,he=l.button`
232
+ ${t=>n.buttonCss(t)};
233
+ display: block;
234
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
235
+ width: 100%;
236
+ color: #fff;
237
+ &:focus-visible {
238
+ ${n.borderTabStyle}
239
+ background-color: transparent;
240
+ }
241
+ `,K=g.forwardRef(({boxed:t,className:e,agentData:o},a)=>s.jsx(H,{ref:a,children:s.jsx(E,{left:t,center:!t,children:s.jsx(R,{padded:!!t,stacked:t?"first":void 0,children:s.jsxs(ae,{children:[s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})})})})),W=g.createContext(null),ge=l.p`
242
+ && {
243
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
244
+ font-weight: 300;
245
+ }
246
+ margin: 0;
247
+ line-height: 1.5em;
248
+ grid-area: info;
249
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
250
+ `,q=(t,e)=>new Date(t).toLocaleTimeString(e||[],{hour:"numeric",minute:"2-digit"}),L=({className:t,name:e,timestamp:o,ariaHidden:a=!1})=>{const i=g.useContext(W);if(!e&&!o)return null;let r="";return e?o?r=`${e}: ${q(o,i)}`:r=e:o&&(r=q(o,i)),s.jsx(ge,{"aria-hidden":a,children:r})},U=({className:t,children:e,sender:o,timestamp:a})=>{const{avatar:i,name:r}=o,{avatarSize:u,avatarLabel:m="Avatar"}=n.useProperties();return s.jsxs(ye,{hasAvatar:!!i,className:w.appendClassNames(t,"humany-conversation-agent-message"),children:[i&&s.jsx(re,{className:"humany-agent-avatar",avatarSize:u,children:typeof i=="string"?s.jsx("img",{src:i,alt:m}):s.jsx(n.SymbolBadge,{symbol:i})}),e,s.jsx(L,{name:r,timestamp:a,ariaHidden:!0})]})},ye=l.div`
251
+ display: grid;
252
+ margin-right: 10%;
253
+ width: 90%;
254
+ ${t=>t.hasAvatar?v.css`
255
+ grid-template-columns: auto 1fr;
256
+ grid-template-rows: 1fr auto;
257
+ grid-template-areas:
258
+ 'avatar content'
259
+ '. info';
260
+ `:v.css`
261
+ grid-template-columns: 1fr;
262
+ grid-template-rows: 1fr auto;
263
+ grid-template-areas:
264
+ 'content'
265
+ 'info';
266
+ `};
267
+ `,fe=g.forwardRef(({className:t,children:e,timestamp:o,discrete:a,fullWidth:i},r)=>s.jsx(pe,{ref:r,className:w.appendClassNames(t,"humany-conversation-system-message"),fullWidth:i,children:a?s.jsxs(be,{className:"humany-conversation-discrete-message",children:[e,s.jsx(L,{timestamp:o})]}):s.jsxs(s.Fragment,{children:[e,s.jsx(L,{timestamp:o})]})})),pe=l.div`
268
+ ${t=>t.fullWidth&&"width: 100%"};
269
+ padding: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
270
+ overflow: auto;
271
+ `,be=l.div`
272
+ text-align: center;
273
+ word-wrap: break-word;
274
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
275
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
276
+ > p {
277
+ margin: 0;
278
+ }
279
+ `,xe=({className:t,children:e,timestamp:o})=>{const{userLabel:a=""}=n.useProperties();return s.jsxs(ve,{className:w.appendClassNames(t,"humany-conversation-user-message"),children:[e,s.jsx(L,{name:a,timestamp:o,ariaHidden:!0})]})},ve=l.div`
280
+ margin-left: 10%;
281
+ width: 90%;
282
+ display: flex;
283
+ flex-direction: column;
284
+ align-items: flex-end;
285
+ `,D=t=>Array.isArray(t)?t:Object.keys(t).map(e=>({label:t[e],actionKey:e})),$e=({header:t,actions:e,dispatch:o})=>{const a=n.useContainer(),{events:i}=a.get("$widget");return s.jsx(je,{className:"humany-conversation-button-list",header:t,items:D(e),renderItem:r=>{var m;const u=!!((m=r==null?void 0:r.data)!=null&&m.href);return s.jsx("li",{children:u?s.jsxs(Se,{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(we,{onClick:()=>{o("action",r),i.dispatch("tracking:button-list-item-clicked",r)},"aria-label":r.label,title:r.label,children:[s.jsx(n.SymbolBadge,{symbol:r.symbol}),r.label]})},r.actionKey)}})},je=l(n.ItemList)`
286
+ ${n.itemList}
287
+ > ul {
288
+ display: flex;
289
+ flex-wrap: wrap;
290
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
291
+ > li {
292
+ margin: 0;
293
+ }
294
+ }
295
+ ${k}
296
+ `,Se=l(n.Link)`
297
+ ${n.buttonCss};
298
+
299
+ display: block;
300
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
301
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
302
+ width: 100%;
303
+ color: #ffffff;
304
+ overflow: hidden;
305
+ text-overflow: ellipsis;
306
+ &:focus-visible {
307
+ ${n.borderTabStyle}
308
+ background-color: transparent;
309
+ }
310
+
311
+ i,
312
+ svg {
313
+ margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
314
+ }
315
+ `,we=l(n.Button)`
316
+ ${n.buttonCss};
317
+
318
+ display: block;
319
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
320
+ background-color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
321
+ width: 100%;
322
+ color: #ffffff;
323
+ overflow: hidden;
324
+ text-overflow: ellipsis;
325
+ &:focus-visible {
326
+ ${n.borderTabStyle}
327
+ background-color: transparent;
328
+ }
329
+
330
+ i,
331
+ svg {
332
+ margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
333
+ }
334
+ `,ke=({type:t,content:e={}})=>{const o=n.useComponent(t);return!o||!t?null:s.jsx(g.Suspense,{fallback:null,children:s.jsx(o,{...e})})},Ce=({body:t})=>s.jsx(Le,{className:"humany-html",html:t}),Le=l(n.Html)`
335
+ ${n.genericHtml}
336
+ color: inherit;
337
+ white-space: normal;
338
+ ${k}
339
+ a {
340
+ color: ${t=>t.theme.colors.link};
341
+ &:focus-visible {
342
+ ${n.borderTabStyle};
343
+ }
344
+ }
345
+ p {
346
+ word-break: auto-phrase;
347
+ }
348
+ `,ze=({header:t,actions:e,dispatch:o})=>s.jsx(Te,{className:"humany-conversation-item-list",header:t,items:D(e),renderItem:a=>{var i;return s.jsx("li",{children:s.jsxs(Ne,{children:[((i=a.symbol)==null?void 0:i.content)&&s.jsx("div",{className:"item-icon",children:s.jsx(n.SymbolBadge,{size:22,symbol:{type:a.symbol.type,content:a.symbol.content}})}),s.jsxs("div",{className:"item-body",children:[s.jsx(n.Button,{onClick:()=>{o("action",a)},"aria-label":a.label,title:a.label,children:a.label}),a.description&&s.jsx("p",{children:a.description})]})]})},a.actionKey)}}),Te=l(n.ItemList)`
349
+ ${n.itemList}
350
+
351
+ > .humany-paragraph {
352
+ ${k}
353
+ margin-bottom: 0;
354
+
355
+ h1 {
356
+ margin: 0;
357
+ }
358
+ }
359
+
360
+ ${t=>n.headingElement(t)("h1",v.css`
361
+ white-space: normal;
362
+ `)}
363
+
364
+ > ul {
365
+ display: flex;
366
+ flex-direction: column;
367
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
368
+ > li {
369
+ margin: 0;
370
+ }
371
+ }
372
+
373
+ li {
374
+ border-bottom: ${t=>t.theme.border};
375
+
376
+ &:last-of-type {
377
+ border-bottom: none;
378
+ }
379
+ }
380
+ `,Ne=l.div`
381
+ display: flex;
382
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
383
+ ${k}
384
+
385
+ .item-icon {
386
+ }
387
+
388
+ .item-body {
389
+ display: flex;
390
+ flex-direction: column;
391
+ align-items: flex-start;
392
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
393
+
394
+ p {
395
+ margin: 0;
396
+ white-space: normal;
397
+ }
398
+ }
399
+
400
+ button {
401
+ background: transparent;
402
+ border: none;
403
+ font-family: inherit;
404
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
405
+ cursor: pointer;
406
+ padding: 0;
407
+ margin: 0;
408
+
409
+ &:focus-visible {
410
+ ${n.borderTabStyle}
411
+ span {
412
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
413
+ text-decoration: underline;
414
+ }
415
+ }
416
+ }
417
+ `,Me=({header:t,actions:e,dispatch:o})=>{const a=n.usePrevious(e),i=g.useRef(),r=n.useIsTabbing(),u=n.useContainer(),{events:m}=u.get("$widget");return g.useEffect(()=>{if(a&&Array.isArray(e)&&Array.isArray(a)&&a.length<e.length&&i.current){const d=i.current.querySelectorAll(".humany-conversation-link-list > ul > li"),f=d[a.length];if(d.length===e.length&&a.length){const $=d[a.length-1];if($){const c=$.querySelector(".humany-button");c&&c.focus()}}else f&&new MutationObserver((c,h)=>{c.forEach(b=>{if(b.addedNodes){const x=Array.from(b.addedNodes).find(j=>j.tagName==="BUTTON");x&&w.htmlParentContains(i.current,document.activeElement)&&(r&&x.focus(),h.disconnect())}})}).observe(f,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}}),s.jsx(Ie,{ref:i,className:"humany-conversation-link-list",header:t,items:D(e),renderItem:d=>s.jsx("li",{children:s.jsxs(Be,{help:d.actionKey==="help",onClick:()=>{o("action",d),m.dispatch("tracking:link-list-item-clicked",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)})},Ie=l(n.ItemList)`
418
+ ${n.itemList}
419
+ ${k}
420
+
421
+ ${t=>n.headingElement(t)("h1",v.css`
422
+ white-space: normal;
423
+ `)}
424
+
425
+ > ul {
426
+ display: flex;
427
+ flex-direction: column;
428
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
429
+ > li {
430
+ margin: 0;
431
+ }
432
+ }
433
+ `,Be=l(n.Button)`
434
+ display: block;
435
+ text-align: left;
436
+ font-weight: 300;
437
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
438
+ max-width: 100%;
439
+ text-overflow: ellipsis;
440
+ overflow: hidden;
441
+
442
+ ${t=>{var e,o;return t.help&&v.css`
443
+ color: ${(e=t.theme.colors)==null?void 0:e.text};
444
+ text-decoration: underline;
445
+
446
+ i,
447
+ svg {
448
+ margin-left: ${(o=t.theme.sizes)==null?void 0:o.small};
449
+ }
450
+ `}}
451
+
452
+ &:focus-visible {
453
+ ${n.borderTabStyle}
454
+ span {
455
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
456
+ text-decoration: underline;
457
+ }
458
+ }
459
+ `,Ae=()=>s.jsx(Oe,{className:"humany-conversation-separator"}),Oe=l.div`
460
+ ${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
461
+ width: 100%;
462
+ `,He=({text:t})=>s.jsx(Ee,{className:"humany-conversation-text",variant:"span",children:t}),Ee=l(n.Typography)`
463
+ ${k}
464
+ `,Re=({header:t="Video call",acceptLabel:e="Accept",declineLabel:o="Decline",dispatch:a})=>{const i=g.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(De,{className:"humany-conversation-video-request",header:t,items:i,renderItem:r=>{const u=r.actionKey==="accept-video-call"?"#70c48e":"#da5c85";return s.jsx("li",{children:s.jsx(Ke,{onClick:()=>{a("action",r)},"aria-label":r.label,title:r.label,bgColor:u,children:s.jsx(n.SymbolBadge,{symbol:r.symbol,size:25})})},r.actionKey)}})},De=l(n.ItemList)`
465
+ ${t=>n.itemList(t)}
466
+ > ul {
467
+ display: flex;
468
+ flex-wrap: wrap;
469
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
470
+ > li {
471
+ margin: 0;
472
+ }
473
+ }
474
+ ${t=>k(t)}
475
+ `,Ke=l(n.Button)`
476
+ ${n.buttonCss};
477
+
478
+ background-color: ${t=>t.bgColor};
479
+ display: flex;
480
+ justify-content: center;
481
+ align-items: center;
482
+ color: #ffffff;
483
+ width: 46px;
484
+ height: 46px;
485
+ border-radius: 100%;
486
+
487
+ &:focus-visible {
488
+ ${n.borderTabStyle}
489
+ background-color: transparent;
490
+
491
+ i,
492
+ svg {
493
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
494
+
495
+ path {
496
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
497
+ }
498
+ }
499
+ }
500
+
501
+ i,
502
+ svg {
503
+ color: #fff;
504
+
505
+ path {
506
+ stroke: #fff;
507
+ }
508
+ }
509
+ `,M=([t,e])=>({type:t,content:e}),qe=({items:t,dispatch:e})=>{const o=t.map(M).filter(r=>r.type.includes("ace-knowledge")).map(r=>"humany-"+r.type.toString());return!!t.map(M).filter(r=>{const u=r==null?void 0:r.content,m=u==null?void 0:u.actions;return!!(m!=null&&m.filter(d=>d.actionKey==="contact").length)}).length&&o.push("humany-secondary-action-list"),!!t.map(M).filter(r=>{var m;const u=r==null?void 0:r.content;return!!((m=u==null?void 0:u.tags)!=null&&m.includes("category"))}).length&&o.push("humany-category-list"),s.jsx(Pe,{role:"none",className:w.appendClassNames("humany-message-list",o.join(" ")),items:t.map(M),renderLi:!0,renderItem:r=>{switch(r.type){case S.ConversationMessageListItemType.Text:return s.jsx(He,{text:r.content});case S.ConversationMessageListItemType.HTML:return s.jsx(Ce,{...r.content});case S.ConversationMessageListItemType.Separator:return s.jsx(Ae,{...r.content});case S.ConversationMessageListItemType.ItemList:return s.jsx(ze,{...r.content,dispatch:e});case S.ConversationMessageListItemType.LinkList:return s.jsx(Me,{...r.content,dispatch:e});case S.ConversationMessageListItemType.ButtonList:return s.jsx($e,{...r.content,dispatch:e});case S.ConversationMessageListItemType.VideoRequest:return s.jsx(Re,{...r.content,dispatch:e});default:return s.jsx(ke,{type:r.type,content:r.content})}}})},Pe=l(n.List)`
510
+ ${n.list}
511
+
512
+ > li {
513
+ margin: 0;
514
+ }
515
+ `,Fe=g.forwardRef(({className:t,timestamp:e,sender:o,type:a,content:i},r)=>{const u=g.useCallback(c=>{let h="first";return i.length>1&&(h=c===0?"first":c+1===i.length?"last":"middle"),h},[i]),{userLabel:m=""}=n.useProperties(),d=()=>s.jsx(s.Fragment,{children:i.map(c=>{const{key:h,body:b,title:x,form:j,actions:p}=c,T=!!b&&!x&&!j&&!p;return s.jsx(fe,{className:t,discrete:T,ref:r,timestamp:e,fullWidth:!!j||!!p,children:T&&b?s.jsx(n.Html,{html:b}):s.jsx(A,{isSystem:!0,content:c})},h)})}),f=()=>s.jsxs(s.Fragment,{children:[s.jsx(P,{className:"humany-sr-only",children:s.jsx(L,{name:o==null?void 0:o.name,timestamp:e})}),s.jsx(U,{sender:o,timestamp:e,className:t,children:s.jsx(H,{className:"humany-message-content-bundle",children:i.map((c,h)=>s.jsx(E,{className:"humany-message-container",left:!0,ref:r,children:s.jsx(A,{content:c,stacked:u(h)})},c.key))})})]}),$=()=>s.jsxs(s.Fragment,{children:[s.jsx(P,{className:"humany-sr-only",children:s.jsx(L,{name:m,timestamp:e})}),s.jsx(xe,{timestamp:e,className:t,children:s.jsx(H,{className:"humany-message-content-bundle",children:i.map((c,h)=>s.jsx(E,{className:"humany-message-container",right:!0,ref:r,children:s.jsx(A,{isUser:!0,content:c,stacked:u(h)})},c.key))})})]});switch(a){case S.ConversationMessageType.System:return d();case S.ConversationMessageType.Agent:return f();case S.ConversationMessageType.User:return $();default:return null}}),A=({content:t,isUser:e,isSystem:o,stacked:a})=>{const i=n.useDispatch(),{title:r,body:u,actions:m,form:d,items:f}=t;return f?s.jsx(R,{className:"humany-message-content",user:!!e,stacked:a,children:s.jsx(qe,{items:f,dispatch:i})}):s.jsxs(R,{className:"humany-message-content",padded:!o,user:!!e,stacked:a,fullWidth:!!d||!!m,children:[r&&s.jsx(N,{children:s.jsx(ie,{variant:"h2",children:r})}),u&&s.jsx(N,{children:s.jsx(ue,{html:u})}),d&&s.jsx(N,{children:s.jsx(de,{...d,onChange:(c,h)=>{i("form",{data:h,formKey:d.schema.id,actionKey:c})}})}),m&&s.jsx(N,{children:s.jsx(me,{items:Object.keys(m).map(c=>({label:m[c],actionKey:c})),renderItem:c=>s.jsx("li",{children:s.jsx(he,{onClick:()=>{i("action",c.actionKey)},children:c.label})},c.actionKey)})})]})},P=l.div`
516
+ position: absolute !important;
517
+ height: 1px;
518
+ width: 1px;
519
+ overflow: hidden;
520
+ clip: rect(1px 1px 1px 1px);
521
+ clip: rect(1px, 1px, 1px, 1px);
522
+ left: -10000000px;
523
+ top: auto;
524
+ `,We=()=>{const{skipToLatestMessageLabel:t="Skip to latest message"}=n.useProperties(),e=n.useContainer(),o=()=>{const a=e.get("widgetDOMElement");if(a){const i=a.querySelectorAll(".humany-conversation-entry");i.length&&i[i.length-1].focus()}};return s.jsx(Ue,{className:"humany-skip-to-latest-message",onKeyDown:a=>{(a.key==="Enter"||a.keyCode===13)&&o()},onClick:o,children:t})},Ue=l.button`
525
+ position: absolute;
526
+ bottom: 60px;
527
+ text-align: center;
528
+ background-color: white;
529
+ text-decoration: none;
530
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
531
+ border-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
532
+ left: -10000000px;
533
+ &:focus-visible {
534
+ left: 50%;
535
+ transform: translateX(-50%);
536
+ ${n.borderTabStyle};
537
+ }
538
+ `,V=()=>{const t=n.useContainer(),e=g.useCallback(c=>{c&&setTimeout(()=>{c.scrollIntoView({block:"start",behavior:"smooth"})},250)},[]),[o,a]=n.useScroll(!0),{messages:i,loading:r,typingActors:u=[],providers:m=[]}=n.useProperties(),d=()=>u&&u.length?u.map((c,h)=>s.jsx(O,{id:`typing_${c.name}`,children:s.jsx(U,{timestamp:Date.now(),sender:c,children:s.jsx(K,{boxed:!0,ref:e})})},`typing_${c.name}`)):null,f=g.useRef((i==null?void 0:i.length)||0),$=m.includes("ace-knowledge-bot");return g.useEffect(()=>{const c=t.get("widgetDOMElement");if(c&&$){const h=c.querySelectorAll(".humany-conversation-entry");h.length&&h.length>f.current&&(f.current=h.length,h[h.length-1].focus())}}),s.jsxs(s.Fragment,{children:[s.jsxs(Ve,{tabIndex:0,scrollableCss:o,ref:a,children:[i&&i.length?i.map((c,h)=>{const{type:b,timestamp:x,sender:j,content:p}=c;return s.jsx(O,{className:"humany-conversation-entry",tabIndex:-1,children:s.jsx(Fe,{...c,ref:e})},`${b}_${j==null?void 0:j.name}_${x}_${p[0].key}`)}):null,d(),r&&s.jsx(O,{children:s.jsx(K,{ref:e})})]}),s.jsx(Q,{}),s.jsx(We,{})]})},Ve=l.div`
539
+ display: flex;
540
+ flex-direction: column;
541
+ align-items: stretch;
542
+ flex: 0 1 100%;
543
+ padding: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
544
+ ${t=>!!t.scrollableCss&&t.scrollableCss};
545
+ &:focus-visible {
546
+ ${t=>n.borderTabStyle(t)};
547
+ }
548
+ `,O=l.div`
549
+ margin: 0;
550
+ margin-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
551
+
552
+ &:first-of-type {
553
+ margin-top: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
554
+ }
555
+
556
+ &:last-of-type {
557
+ padding-bottom: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
558
+ }
559
+
560
+ & span,
561
+ p,
562
+ a,
563
+ div {
564
+ font-weight: 300;
565
+ }
566
+
567
+ & b,
568
+ h1 {
569
+ font-weight: normal;
570
+ }
571
+
572
+ &:focus-visible {
573
+ ${n.borderTabStyle}
574
+ border-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
575
+ }
576
+ ${t=>n.headingElement(t)("h1",v.css`
577
+ font-weight: normal;
578
+ `)}
579
+ `,_e=({dispatch:t})=>{const e=g.useRef(null);return g.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})},Ye=({dispatch:t,header:e,buttonLabel:o})=>s.jsxs(Xe,{portalId:"humany-conversation-portal",className:"humany-conversation-outlet",children:[s.jsxs(Ge,{className:"humany-conversation-outlet-head",children:[s.jsx(Qe,{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(Je,{className:"humany-conversation-outlet-header",variant:"h1",children:e})]}),s.jsx(V,{})]}),Xe=l(n.WidgetOverlayOutlet)`
580
+ z-index: 11;
581
+ top: auto;
582
+ height: 65%;
583
+ background-color: #ffffff;
584
+ display: flex;
585
+ flex-direction: column;
586
+ border-top-right-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
587
+ border-top-left-radius: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
588
+ `,Ge=l.div`
589
+ display: flex;
590
+ flex-direction: column;
591
+ justify-content: center;
592
+ align-items: center;
593
+ gap: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
594
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
595
+ ${t=>t.theme.border&&`border-bottom: ${t.theme.border};`}
596
+ `,Je=l(n.Typography)`
597
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
598
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
599
+ margin: 0;
600
+ `,Qe=l(n.Button)`
601
+ display: flex;
602
+ align-items: center;
603
+ justify-content: center;
604
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
605
+ ${t=>t.theme.borderRadius&&`border-radius: ${t.theme.borderRadius};`}
606
+
607
+ &:focus-visible {
608
+ ${n.borderTabStyle};
609
+ }
610
+
611
+ svg line {
612
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
613
+ }
614
+ `,Ze=({className:t,...e})=>{const{overlay:o,overlayConversationHeader:a,overlayConversationCloseLabel:i,conversationControllerId:r}=n.useProperties(),u=n.useDispatch(),d=n.useContainer().get("$settings");return s.jsx(n.ConversationContext.Provider,{value:r?{id:r}:null,children:s.jsxs(W.Provider,{value:d==null?void 0:d.language,children:[s.jsx(et,{"aria-live":"polite",...e,className:w.appendClassNames(t,"humany-conversation-component"),children:s.jsx(V,{})}),o&&s.jsxs(s.Fragment,{children:[s.jsx(_e,{dispatch:u}),o.conversation&&s.jsx(Ye,{dispatch:u,header:a,buttonLabel:i})]})]})})},et=l.div`
615
+ position: absolute;
616
+ right: 0;
617
+ left: 0;
618
+ bottom: 0;
619
+ top: 0;
620
+ overflow: hidden;
621
+ display: flex;
622
+ flex-direction: column;
623
+ `;exports.default=Ze;