@telia-ace/widget-conversation 1.1.1-rc.0 → 1.1.1-rc.2
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/{conversation-905bdeb3.js → conversation-6ba99c32.js} +66 -66
- package/{conversation-78019545.mjs → conversation-a6e3c255.mjs} +61 -57
- package/index-4649598b.mjs +7433 -0
- package/index-a3c122bb.js +1179 -0
- package/index.js +1 -1
- package/index.mjs +14 -10
- package/package.json +8 -8
- package/{return-button-f3f52295.mjs → return-button-6e4d528a.mjs} +11 -7
- package/{return-button-7560bd06.js → return-button-9eaa8113.js} +14 -14
- package/{use-dispatch-7cf7db21.js → use-dispatch-1d56ade2.js} +1 -1
- package/{use-dispatch-86019505.mjs → use-dispatch-f89f5e06.mjs} +7 -7
- package/index-1180f4a4.js +0 -1212
- package/index-bfc77c45.mjs +0 -11311
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("@emotion/styled"),p=require("@emotion/react"),n=require("./index-a3c122bb.js"),h=require("react");require("react-dom");require("react-transition-group");const T=require("./use-dispatch-1d56ade2.js");require("react-router-dom");const Y=(e,t)=>{const r=T.useComponentDescriptor(),o=n.useContainer(),[a,l]=h.useState(void 0),u=n.useIsMounted(),d=e||r.type||"";return h.useEffect(()=>{if(d){let y;return(t||o).getAsync("componentResolver").then(b=>{if(u.current){const m=b.getComponent(d);l(m)}y=b.registerResolver(d,m=>{u.current&&l(m)})}),()=>{y&&y()}}},[u,d,t,o]),a},G=()=>{const[e,t]=h.useState(!1);return h.useEffect(()=>{const r=()=>{t(!1)},o=a=>{a.keyCode===9&&t(!0)};return window.addEventListener("keydown",o),window.addEventListener("click",r),()=>{window.removeEventListener("keydown",o),window.removeEventListener("click",r)}},[]),e},J=({className:e})=>{const[t,r]=h.useState(""),[o,a]=h.useState(!1),[l,u]=h.useState(0),[d,y]=h.useState(0),b=G(),m=T.useDispatch(),{inputPlaceholder:c="Type your message",inputHidden:v=!1,inputDisabled:w=!1,sendButtonLabel:S="Send message",inputMultiline:$=!0,secondaryAction:f}=n.useProperties(),[F,x]=n.useScroll(!0);h.useEffect(()=>{if(x.current){const{lineHeight:g,maxHeight:k}=getComputedStyle(x.current);if(g&&g.indexOf("px")>-1){const C=g.split("px"),_=parseInt(C[0],10);u(_);const V=k.split("px");y(parseInt(V[0],10))}}},[x.current]);const I=g=>{!g.shiftKey||!$?(g.preventDefault(),t&&t.length>0&&(m("user-submit",{text:t}),r(""),M(""))):t.length<1&&g.preventDefault()},W=g=>{f&&(g.preventDefault(),m("action",{actionKey:f.action,...f}))},U=g=>{if($&&x.current){const k=x.current.scrollHeight;if(k>l){x.current.style.height="auto";let C=k;g.length<1&&(C=l),x.current.style.height=`${C}px`,C>=d?x.current.style.overflowY="scroll":x.current.style.overflowY="hidden"}}},M=g=>{U(g),r(g),g&&g.length>0&&m("user-typing",{textLength:g.length})};return v?null:s.jsxs(ee,{grow:$,className:n.appendClassNames("humany-conversation-input",e),"data-has-focus":o,scrollableCss:F,isTabbing:b,children:[f&&s.jsx(Z,{disabled:w,onClick:W,title:f.label,"aria-label":f.label,children:s.jsx(n.SymbolBadge,{size:24,symbol:{type:"Svg",content:f.icon||"browse"}})}),$?s.jsx(Q,{value:t,onChange:M,onEnter:I,disabled:w,"aria-label":c,placeholder:c,onFocusChange:a,type:"textarea",rows:1,ref:x}):s.jsx(X,{value:t,onChange:M,onEnter:I,disabled:w,"aria-label":c,placeholder:c,onFocusChange:a}),s.jsx(D,{disabled:w,onClick:I,title:S,"aria-label":S,children:s.jsx(te,{size:22,symbol:{type:"Svg",content:"send"},hasContent:!!t&&!!t.length})})]})},Q=i(n.Input)`
|
|
2
2
|
resize: none;
|
|
3
3
|
flex: 1;
|
|
4
4
|
flex-shrink: 1;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
border: none;
|
|
13
13
|
transition: height 200ms linear;
|
|
14
14
|
outline: none;
|
|
15
|
-
`,
|
|
15
|
+
`,X=i(n.Input)`
|
|
16
16
|
flex: 1;
|
|
17
17
|
border: none;
|
|
18
18
|
background-color: transparent;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.textLight}};
|
|
27
27
|
font-style: italic;
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,D=i(n.Button)`
|
|
30
30
|
flex: 0 0 50px;
|
|
31
31
|
align-self: stretch;
|
|
32
32
|
background-color: transparent;
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
&:focus-visible {
|
|
39
39
|
${n.borderTabStyle};
|
|
40
40
|
}
|
|
41
|
-
`,
|
|
41
|
+
`,Z=i(D)`
|
|
42
42
|
border-right: ${e=>e.theme.border};
|
|
43
43
|
margin: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}} 0;
|
|
44
|
-
`,
|
|
45
|
-
${e=>e.grow?
|
|
44
|
+
`,ee=i.div`
|
|
45
|
+
${e=>e.grow?p.css`
|
|
46
46
|
min-height: 50px;
|
|
47
47
|
max-height: 150px;
|
|
48
|
-
`:
|
|
48
|
+
`:p.css`
|
|
49
49
|
height: 50px;
|
|
50
50
|
`}
|
|
51
51
|
flex: 0 0 auto;
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
textarea {
|
|
58
58
|
${e=>!!e.scrollableCss&&e.scrollableCss}
|
|
59
59
|
}
|
|
60
|
-
`,
|
|
60
|
+
`,te=i(({hasContent:e,...t})=>s.jsx(n.SymbolBadge,{...t}))`
|
|
61
61
|
line,
|
|
62
62
|
path {
|
|
63
63
|
stroke: ${e=>{var t;return e.hasContent?(t=e.theme.colors)==null?void 0:t.primary:"#a6a6a6"}};
|
|
64
64
|
fill: ${e=>{var t;return e.hasContent?(t=e.theme.colors)==null?void 0:t.primary:"#a6a6a6"}};
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,se=i.div`
|
|
67
67
|
width: ${e=>e.avatarSize||"32px"};
|
|
68
68
|
height: ${e=>e.avatarSize||"32px"};
|
|
69
69
|
border-radius: 50%;
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
`,
|
|
101
|
+
`,ne=p.keyframes`
|
|
102
102
|
0% {
|
|
103
103
|
opacity: 0;
|
|
104
104
|
}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
100% {
|
|
109
109
|
opacity: 0;
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`,re=i.div`
|
|
112
112
|
display: flex;
|
|
113
113
|
justify-content: center;
|
|
114
114
|
> div {
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
border-radius: 50%;
|
|
118
118
|
margin: 5px;
|
|
119
119
|
background-color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
120
|
-
animation: ${
|
|
120
|
+
animation: ${ne} 1s infinite;
|
|
121
121
|
}
|
|
122
122
|
> div:nth-of-type(2) {
|
|
123
123
|
animation-delay: 100ms;
|
|
@@ -125,23 +125,23 @@
|
|
|
125
125
|
> div:nth-of-type(3) {
|
|
126
126
|
animation-delay: 200ms;
|
|
127
127
|
}
|
|
128
|
-
`,
|
|
128
|
+
`,H=i.div`
|
|
129
129
|
grid-area: content;
|
|
130
130
|
max-width: 100%;
|
|
131
131
|
overflow: hidden;
|
|
132
|
-
`,
|
|
132
|
+
`,oe=i(n.Typography)`
|
|
133
133
|
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
134
134
|
font-weight: normal;
|
|
135
135
|
margin: 0;
|
|
136
|
-
`,
|
|
136
|
+
`,R=i.div`
|
|
137
137
|
display: flex;
|
|
138
138
|
${e=>e.left&&"justify-content: start;"};
|
|
139
139
|
${e=>e.center&&"justify-content: center;"};
|
|
140
140
|
${e=>e.right&&"justify-content: end;"};
|
|
141
|
-
`,
|
|
141
|
+
`,A=i.div`
|
|
142
142
|
${e=>{var t;return e.padded&&`padding: ${(t=e.theme.sizes)==null?void 0:t.medium};`}}
|
|
143
|
-
${e=>!e.user&&e.stacked&&
|
|
144
|
-
${e=>e.user&&e.stacked&&
|
|
143
|
+
${e=>!e.user&&e.stacked&&ae(e.stacked,e.theme)}
|
|
144
|
+
${e=>e.user&&e.stacked&&ie(e.stacked,e.theme)}
|
|
145
145
|
|
|
146
146
|
display: inline-block;
|
|
147
147
|
margin-top: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
@@ -154,11 +154,11 @@
|
|
|
154
154
|
}
|
|
155
155
|
max-width: 100%;
|
|
156
156
|
${e=>e.fullWidth&&"width: 100%;"}
|
|
157
|
-
`,
|
|
157
|
+
`,ae=(e,t)=>{var o,a;const r=p.css`
|
|
158
158
|
background-color: ${(o=t.colors)==null?void 0:o.accent};
|
|
159
159
|
color: ${(a=t.colors)==null?void 0:a.text};
|
|
160
160
|
${t.border&&`border: ${t.border};`};
|
|
161
|
-
`;return t.borderRadius?
|
|
161
|
+
`;return t.borderRadius?p.css`
|
|
162
162
|
${r}
|
|
163
163
|
|
|
164
164
|
border-top-right-radius: ${t.borderRadius};
|
|
@@ -171,10 +171,10 @@
|
|
|
171
171
|
${e==="last"&&`
|
|
172
172
|
border-bottom-left-radius: ${t.borderRadius};
|
|
173
173
|
`}
|
|
174
|
-
`:r},
|
|
174
|
+
`:r},ie=(e,t)=>{var o,a;const r=p.css`
|
|
175
175
|
background-color: ${(o=t.colors)==null?void 0:o.primary};
|
|
176
176
|
color: ${(a=t.colors)==null?void 0:a.accent};
|
|
177
|
-
`;return t.borderRadius?
|
|
177
|
+
`;return t.borderRadius?p.css`
|
|
178
178
|
${r}
|
|
179
179
|
|
|
180
180
|
border-top-left-radius: ${t.borderRadius};
|
|
@@ -187,15 +187,15 @@
|
|
|
187
187
|
${e==="last"&&`
|
|
188
188
|
border-bottom-right-radius: ${t.borderRadius};
|
|
189
189
|
`}
|
|
190
|
-
`:r},
|
|
190
|
+
`:r},L=i.div`
|
|
191
191
|
margin-bottom: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
192
192
|
&:last-child {
|
|
193
193
|
margin-bottom: 0;
|
|
194
194
|
}
|
|
195
|
-
`,
|
|
195
|
+
`,j=e=>{var t,r;return p.css`
|
|
196
196
|
margin: ${(t=e.theme.sizes)==null?void 0:t.medium} 0;
|
|
197
197
|
padding: 0 ${(r=e.theme.sizes)==null?void 0:r.medium};
|
|
198
|
-
`},
|
|
198
|
+
`},le=i(n.Form)`
|
|
199
199
|
& button.humany-form-component-button {
|
|
200
200
|
${e=>{var t,r,o,a;return((t=e.theme.colors)==null?void 0:t.primary)&&((r=e.theme.colors)==null?void 0:r.accent)&&n.invertedHoverButton({active:!1,primaryColor:(o=e.theme.colors)==null?void 0:o.primary,secondaryColor:(a=e.theme.colors)==null?void 0:a.accent,theme:e.theme})}};
|
|
201
201
|
display: block;
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
margin-bottom: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
`,
|
|
212
|
+
`,ce=i(n.Html)`
|
|
213
213
|
white-space: pre-wrap;
|
|
214
214
|
a {
|
|
215
215
|
color: ${e=>e.theme.colors.link};
|
|
@@ -217,14 +217,14 @@
|
|
|
217
217
|
${e=>{var t;return((t=e.theme.accessibility)==null?void 0:t.isTabbing)&&n.borderTabStyle}};
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
`,
|
|
220
|
+
`,de=i(n.List)`
|
|
221
221
|
padding: 0;
|
|
222
222
|
list-style: none;
|
|
223
223
|
margin: 0 -${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
224
224
|
> li {
|
|
225
225
|
margin: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
226
226
|
}
|
|
227
|
-
`,
|
|
227
|
+
`,me=i.button`
|
|
228
228
|
${e=>n.buttonCss(e)};
|
|
229
229
|
display: block;
|
|
230
230
|
background-color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
${n.borderTabStyle}
|
|
235
235
|
background-color: transparent;
|
|
236
236
|
}
|
|
237
|
-
`,
|
|
237
|
+
`,K=h.forwardRef(({boxed:e,className:t,agentData:r},o)=>s.jsx(H,{ref:o,children:s.jsx(R,{left:e,center:!e,children:s.jsx(A,{padded:!!e,stacked:e?"first":void 0,children:s.jsxs(re,{children:[s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})})})})),ue=i.p`
|
|
238
238
|
&& {
|
|
239
239
|
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.small}};
|
|
240
240
|
font-weight: 300;
|
|
@@ -243,28 +243,28 @@
|
|
|
243
243
|
line-height: 1.5em;
|
|
244
244
|
grid-area: info;
|
|
245
245
|
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
246
|
-
`,
|
|
246
|
+
`,O=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),z=({className:e,name:t,timestamp:r})=>{if(!t&&!r)return null;let o="";return t?r?o=`${t}: ${O(r)}`:o=t:r&&(o=O(r)),s.jsx(ue,{children:o})},q=({className:e,children:t,sender:r,timestamp:o})=>{const{avatar:a,name:l}=r,{avatarSize:u}=n.useProperties();return s.jsxs(he,{hasAvatar:!!a,className:n.appendClassNames(e,"humany-conversation-agent-message"),children:[a&&s.jsx(se,{avatarSize:u,children:typeof a=="string"?s.jsx("img",{src:a}):s.jsx(n.SymbolBadge,{symbol:a})}),t,s.jsx(z,{name:l,timestamp:o})]})},he=i.div`
|
|
247
247
|
display: grid;
|
|
248
248
|
margin-right: 10%;
|
|
249
249
|
width: 90%;
|
|
250
|
-
${e=>e.hasAvatar?
|
|
250
|
+
${e=>e.hasAvatar?p.css`
|
|
251
251
|
grid-template-columns: auto 1fr;
|
|
252
252
|
grid-template-rows: 1fr auto;
|
|
253
253
|
grid-template-areas:
|
|
254
254
|
'avatar content'
|
|
255
255
|
'. info';
|
|
256
|
-
`:
|
|
256
|
+
`:p.css`
|
|
257
257
|
grid-template-columns: 1fr;
|
|
258
258
|
grid-template-rows: 1fr auto;
|
|
259
259
|
grid-template-areas:
|
|
260
260
|
'content'
|
|
261
261
|
'info';
|
|
262
262
|
`};
|
|
263
|
-
`,
|
|
263
|
+
`,ge=h.forwardRef(({className:e,children:t,timestamp:r,discrete:o,fullWidth:a},l)=>s.jsx(ye,{ref:l,className:n.appendClassNames(e,"humany-conversation-system-message"),fullWidth:a,children:o?s.jsxs(pe,{className:"humany-conversation-discrete-message",children:[t,s.jsx(z,{timestamp:r})]}):s.jsxs(s.Fragment,{children:[t,s.jsx(z,{timestamp:r})]})})),ye=i.div`
|
|
264
264
|
${e=>e.fullWidth&&"width: 100%"};
|
|
265
265
|
padding: 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.large}};
|
|
266
266
|
overflow: auto;
|
|
267
|
-
`,
|
|
267
|
+
`,pe=i.div`
|
|
268
268
|
text-align: center;
|
|
269
269
|
word-wrap: break-word;
|
|
270
270
|
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
@@ -272,13 +272,13 @@
|
|
|
272
272
|
> p {
|
|
273
273
|
margin: 0;
|
|
274
274
|
}
|
|
275
|
-
`,
|
|
275
|
+
`,be=({className:e,children:t,timestamp:r})=>{const{userLabel:o=""}=n.useProperties();return s.jsxs(fe,{className:n.appendClassNames(e,"humany-conversation-user-message"),children:[t,s.jsx(z,{name:o,timestamp:r})]})},fe=i.div`
|
|
276
276
|
margin-left: 10%;
|
|
277
277
|
width: 90%;
|
|
278
278
|
display: flex;
|
|
279
279
|
flex-direction: column;
|
|
280
280
|
align-items: flex-end;
|
|
281
|
-
`,
|
|
281
|
+
`,E=e=>Array.isArray(e)?e:Object.keys(e).map(t=>({label:e[t],actionKey:t})),xe=({header:e,actions:t,dispatch:r})=>s.jsx(ve,{className:"humany-conversation-button-list",header:e,items:E(t),renderItem:o=>s.jsx("li",{children:s.jsxs($e,{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
282
|
${n.itemList}
|
|
283
283
|
> ul {
|
|
284
284
|
display: flex;
|
|
@@ -288,8 +288,8 @@
|
|
|
288
288
|
margin: 0;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
${
|
|
292
|
-
|
|
291
|
+
${j}
|
|
292
|
+
`,$e=i(n.Button)`
|
|
293
293
|
${n.buttonCss};
|
|
294
294
|
|
|
295
295
|
display: block;
|
|
@@ -308,22 +308,22 @@
|
|
|
308
308
|
svg {
|
|
309
309
|
margin-right: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}};
|
|
310
310
|
}
|
|
311
|
-
`,
|
|
311
|
+
`,je=({type:e,content:t={}})=>{const r=Y(e);return!r||!e?null:s.jsx(h.Suspense,{fallback:null,children:s.jsx(r,{...t})})},we=({body:e})=>s.jsx(Se,{html:e}),Se=i(n.Html)`
|
|
312
312
|
${n.genericHtml}
|
|
313
313
|
color: inherit;
|
|
314
314
|
white-space: pre-wrap;
|
|
315
|
-
${
|
|
315
|
+
${j}
|
|
316
316
|
a {
|
|
317
317
|
color: ${e=>e.theme.colors.link};
|
|
318
318
|
&:focus-visible {
|
|
319
319
|
${n.borderTabStyle};
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
`,
|
|
322
|
+
`,Ce=({header:e,actions:t,dispatch:r})=>s.jsx(ke,{className:"humany-conversation-item-list",header:e,items:E(t),renderItem:o=>{var a;return s.jsx("li",{children:s.jsxs(Le,{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)}}),ke=i(n.ItemList)`
|
|
323
323
|
${n.itemList}
|
|
324
324
|
|
|
325
325
|
> .humany-paragraph {
|
|
326
|
-
${
|
|
326
|
+
${j}
|
|
327
327
|
margin-bottom: 0;
|
|
328
328
|
|
|
329
329
|
h1 {
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
${e=>n.headingElement(e)("h1",
|
|
334
|
+
${e=>n.headingElement(e)("h1",p.css`
|
|
335
335
|
white-space: normal;
|
|
336
336
|
`)}
|
|
337
337
|
|
|
@@ -351,10 +351,10 @@
|
|
|
351
351
|
border-bottom: none;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
`,
|
|
354
|
+
`,Le=i.div`
|
|
355
355
|
display: flex;
|
|
356
356
|
gap: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}};
|
|
357
|
-
${
|
|
357
|
+
${j}
|
|
358
358
|
|
|
359
359
|
.item-icon {
|
|
360
360
|
}
|
|
@@ -388,11 +388,11 @@
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
`,
|
|
391
|
+
`,ze=({header:e,actions:t,dispatch:r})=>s.jsx(Te,{className:"humany-conversation-link-list",header:e,items:E(t),renderItem:o=>s.jsx("li",{children:s.jsxs(Ie,{help:o.actionKey==="help",onClick:()=>{r("action",o)},"aria-label":o.label,title:o.label,children:[o.label,o.actionKey==="help"&&s.jsx(n.SymbolBadge,{size:14,symbol:{type:"Svg",content:"caret-down"}})]})},o.actionKey)}),Te=i(n.ItemList)`
|
|
392
392
|
${n.itemList}
|
|
393
|
-
${
|
|
393
|
+
${j}
|
|
394
394
|
|
|
395
|
-
${e=>n.headingElement(e)("h1",
|
|
395
|
+
${e=>n.headingElement(e)("h1",p.css`
|
|
396
396
|
white-space: normal;
|
|
397
397
|
`)}
|
|
398
398
|
|
|
@@ -404,7 +404,7 @@
|
|
|
404
404
|
margin: 0;
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
`,
|
|
407
|
+
`,Ie=i(n.Button)`
|
|
408
408
|
display: block;
|
|
409
409
|
text-align: left;
|
|
410
410
|
font-weight: 300;
|
|
@@ -413,7 +413,7 @@
|
|
|
413
413
|
text-overflow: ellipsis;
|
|
414
414
|
overflow: hidden;
|
|
415
415
|
|
|
416
|
-
${e=>{var t,r;return e.help&&
|
|
416
|
+
${e=>{var t,r;return e.help&&p.css`
|
|
417
417
|
color: ${(t=e.theme.colors)==null?void 0:t.text};
|
|
418
418
|
text-decoration: underline;
|
|
419
419
|
|
|
@@ -430,12 +430,12 @@
|
|
|
430
430
|
text-decoration: underline;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
`,
|
|
433
|
+
`,Me=()=>s.jsx(Ne,{className:"humany-conversation-separator"}),Ne=i.div`
|
|
434
434
|
${e=>e.theme.border&&`border-bottom: ${e.theme.border};`}
|
|
435
435
|
width: 100%;
|
|
436
|
-
`,
|
|
437
|
-
${
|
|
438
|
-
`,
|
|
436
|
+
`,Be=({text:e})=>s.jsx(He,{className:"humany-conversation-text",variant:"span",children:e}),He=i(n.Typography)`
|
|
437
|
+
${j}
|
|
438
|
+
`,Re=({header:e="Video call",acceptLabel:t="Accept",declineLabel:r="Decline",dispatch:o})=>{const a=h.useMemo(()=>[{label:t,actionKey:"accept-video-call",symbol:{type:"Svg",content:"video"}},{label:r,actionKey:"decline-video-call",symbol:{type:"Svg",content:"close"}}],[t,r]);return s.jsx(Ae,{className:"humany-conversation-video-request",header:e,items:a,renderItem:l=>{const u=l.actionKey==="accept-video-call"?"#70c48e":"#da5c85";return s.jsx("li",{children:s.jsx(Ee,{onClick:()=>{o("action",l)},"aria-label":l.label,title:l.label,bgColor:u,children:s.jsx(n.SymbolBadge,{symbol:l.symbol,size:25})})},l.actionKey)}})},Ae=i(n.ItemList)`
|
|
439
439
|
${e=>n.itemList(e)}
|
|
440
440
|
> ul {
|
|
441
441
|
display: flex;
|
|
@@ -445,8 +445,8 @@
|
|
|
445
445
|
margin: 0;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
${e=>
|
|
449
|
-
`,
|
|
448
|
+
${e=>j(e)}
|
|
449
|
+
`,Ee=i(n.Button)`
|
|
450
450
|
${n.buttonCss};
|
|
451
451
|
|
|
452
452
|
background-color: ${e=>e.bgColor};
|
|
@@ -480,13 +480,13 @@
|
|
|
480
480
|
stroke: #fff;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
`,
|
|
483
|
+
`,Ke=([e,t])=>({type:e,content:t}),Oe=({items:e,dispatch:t})=>s.jsx(De,{className:"humany-message-list",items:e.map(Ke),renderLi:!0,renderItem:r=>{switch(r.type){case n.ConversationMessageListItemType.Text:return s.jsx(Be,{text:r.content});case n.ConversationMessageListItemType.HTML:return s.jsx(we,{...r.content});case n.ConversationMessageListItemType.Separator:return s.jsx(Me,{...r.content});case n.ConversationMessageListItemType.ItemList:return s.jsx(Ce,{...r.content,dispatch:t});case n.ConversationMessageListItemType.LinkList:return s.jsx(ze,{...r.content,dispatch:t});case n.ConversationMessageListItemType.ButtonList:return s.jsx(xe,{...r.content,dispatch:t});case n.ConversationMessageListItemType.VideoRequest:return s.jsx(Re,{...r.content,dispatch:t});default:return s.jsx(je,{type:r.type,content:r.content})}}}),De=i(n.List)`
|
|
484
484
|
${n.list}
|
|
485
485
|
|
|
486
486
|
> li {
|
|
487
487
|
margin: 0;
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`,qe=h.forwardRef(({className:e,timestamp:t,sender:r,type:o,content:a},l)=>{const u=h.useCallback(m=>{let c="first";return a.length>1&&(c=m===0?"first":m+1===a.length?"last":"middle"),c},[a]),d=()=>s.jsx(s.Fragment,{children:a.map(m=>{const{key:c,body:v,title:w,form:S,actions:$}=m,f=!!v&&!w&&!S&&!$;return s.jsx(ge,{className:e,discrete:f,ref:l,timestamp:t,fullWidth:!!S||!!$,children:f&&v?s.jsx(n.Html,{html:v}):s.jsx(N,{isSystem:!0,content:m})},c)})}),y=()=>s.jsx(q,{sender:r,timestamp:t,className:e,children:s.jsx(H,{className:"humany-message-content-bundle",children:a.map((m,c)=>s.jsx(R,{className:"humany-message-container",left:!0,ref:l,children:s.jsx(N,{content:m,stacked:u(c)})},m.key))})}),b=()=>s.jsx(be,{timestamp:t,className:e,children:s.jsx(H,{className:"humany-message-content-bundle",children:a.map((m,c)=>s.jsx(R,{className:"humany-message-container",right:!0,ref:l,children:s.jsx(N,{isUser:!0,content:m,stacked:u(c)})},m.key))})});switch(o){case n.ConversationMessageType.System:return d();case n.ConversationMessageType.Agent:return y();case n.ConversationMessageType.User:return b();default:return null}}),N=({content:e,isUser:t,isSystem:r,stacked:o})=>{const a=T.useDispatch(),{title:l,body:u,actions:d,form:y,items:b}=e;return b?s.jsx(A,{className:"humany-message-content",user:!!t,stacked:o,children:s.jsx(Oe,{items:b,dispatch:a})}):s.jsxs(A,{className:"humany-message-content",padded:!r,user:!!t,stacked:o,fullWidth:!!y||!!d,children:[l&&s.jsx(L,{children:s.jsx(oe,{variant:"h2",children:l})}),u&&s.jsx(L,{children:s.jsx(ce,{html:u})}),y&&s.jsx(L,{children:s.jsx(le,{...y,onChange:(c,v)=>{a("form",{data:v,formKey:y.schema.id,actionKey:c})}})}),d&&s.jsx(L,{children:s.jsx(de,{items:Object.keys(d).map(c=>({label:d[c],actionKey:c})),renderItem:c=>s.jsx("li",{children:s.jsx(me,{onClick:()=>{a("action",c.actionKey)},children:c.label})},c.actionKey)})})]})},P=()=>{const e=h.useCallback(d=>{d&&setTimeout(()=>{d.scrollIntoView({block:"start",behavior:"smooth"})},250)},[]),[t,r]=n.useScroll(!0),{messages:o,loading:a,typingActors:l=[]}=n.useProperties(),u=()=>l&&l.length?l.map((d,y)=>s.jsx(B,{id:`typing_${d.name}`,children:s.jsx(q,{timestamp:Date.now(),sender:d,children:s.jsx(K,{boxed:!0,ref:e})})},`typing_${d.name}`)):null;return s.jsxs(s.Fragment,{children:[s.jsxs(Pe,{tabIndex:0,scrollableCss:t,ref:r,children:[o&&o.length?o.map((d,y)=>{const{type:b,timestamp:m,sender:c,content:v}=d;return s.jsx(B,{className:"humany-conversation-entry",tabIndex:-1,children:s.jsx(qe,{...d,ref:e})},`${b}_${c==null?void 0:c.name}_${m}_${v[0].key}`)}):null,u(),a&&s.jsx(B,{children:s.jsx(K,{ref:e})})]}),s.jsx(J,{})]})},Pe=i.div`
|
|
490
490
|
display: flex;
|
|
491
491
|
flex-direction: column;
|
|
492
492
|
align-items: stretch;
|
|
@@ -496,7 +496,7 @@
|
|
|
496
496
|
&:focus-visible {
|
|
497
497
|
${e=>n.borderTabStyle(e)};
|
|
498
498
|
}
|
|
499
|
-
`,
|
|
499
|
+
`,B=i.div`
|
|
500
500
|
margin: 0;
|
|
501
501
|
margin-bottom: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}};
|
|
502
502
|
|
|
@@ -519,10 +519,10 @@
|
|
|
519
519
|
h1 {
|
|
520
520
|
font-weight: normal;
|
|
521
521
|
}
|
|
522
|
-
${e=>n.headingElement(e)("h1",
|
|
522
|
+
${e=>n.headingElement(e)("h1",p.css`
|
|
523
523
|
font-weight: normal;
|
|
524
524
|
`)}
|
|
525
|
-
`,
|
|
525
|
+
`,Fe=({dispatch:e})=>{const t=h.useRef(null);return h.useEffect(()=>{t.current&&t.current.parentNode&&e("overlay-mounted",t.current)},[t]),s.jsx(n.WidgetOverlayOutlet,{portalId:"humany-conversation-overlay-portal",className:"humany-conversation-overlay-outlet",ref:t})},We=({dispatch:e,header:t,buttonLabel:r})=>s.jsxs(Ue,{portalId:"humany-conversation-portal",className:"humany-conversation-outlet",children:[s.jsxs(_e,{className:"humany-conversation-outlet-head",children:[s.jsx(Ye,{className:"humany-conversation-outlet-head-button","aria-label":r,title:r,onClick:()=>e("hide-overlay-conversation"),children:s.jsx(n.SymbolBadge,{symbol:{type:"Svg",content:"caret-down"},size:20})}),t&&s.jsx(Ve,{className:"humany-conversation-outlet-header",variant:"h1",children:t})]}),s.jsx(P,{})]}),Ue=i(n.WidgetOverlayOutlet)`
|
|
526
526
|
z-index: 11;
|
|
527
527
|
top: auto;
|
|
528
528
|
height: 65%;
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
flex-direction: column;
|
|
532
532
|
border-top-right-radius: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.large}};
|
|
533
533
|
border-top-left-radius: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.large}};
|
|
534
|
-
`,
|
|
534
|
+
`,_e=i.div`
|
|
535
535
|
display: flex;
|
|
536
536
|
flex-direction: column;
|
|
537
537
|
justify-content: center;
|
|
@@ -539,11 +539,11 @@
|
|
|
539
539
|
gap: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
540
540
|
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
541
541
|
${e=>e.theme.border&&`border-bottom: ${e.theme.border};`}
|
|
542
|
-
`,
|
|
542
|
+
`,Ve=i(n.Typography)`
|
|
543
543
|
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.medium}};
|
|
544
544
|
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
545
545
|
margin: 0;
|
|
546
|
-
`,
|
|
546
|
+
`,Ye=i(n.Button)`
|
|
547
547
|
display: flex;
|
|
548
548
|
align-items: center;
|
|
549
549
|
justify-content: center;
|
|
@@ -557,7 +557,7 @@
|
|
|
557
557
|
svg line {
|
|
558
558
|
stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
559
559
|
}
|
|
560
|
-
`,
|
|
560
|
+
`,Ge=({className:e,...t})=>{const{overlay:r,overlayConversationHeader:o,overlayConversationCloseLabel:a,conversationControllerId:l}=n.useProperties(),u=T.useDispatch();return s.jsxs(n.ConversationContext.Provider,{value:l?{id:l}:null,children:[s.jsx(Je,{...t,className:n.appendClassNames(e,"humany-conversation-component"),children:s.jsx(P,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Fe,{dispatch:u}),r.conversation&&s.jsx(We,{dispatch:u,header:o,buttonLabel:a})]})]})},Je=i.div`
|
|
561
561
|
position: absolute;
|
|
562
562
|
right: 0;
|
|
563
563
|
left: 0;
|
|
@@ -566,4 +566,4 @@
|
|
|
566
566
|
overflow: hidden;
|
|
567
567
|
display: flex;
|
|
568
568
|
flex-direction: column;
|
|
569
|
-
`;exports.default=
|
|
569
|
+
`;exports.default=Ge;
|