@telia-ace/widget-conversation 1.1.1-rc.2 → 1.1.1-rc.3

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"),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)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("@emotion/styled"),n=require("@telia-ace/widget-ui"),L=require("@telia-ace/widget-utilities"),y=require("@emotion/react"),g=require("react"),G=require("@telia-ace/widget-forms"),x=require("./index.js");require("@telia-ace/widget-core");require("@telia-ace/widget-services");require("@telia-ace/widget-plugins");const J=({className:e})=>{const[t,r]=g.useState(""),[o,i]=g.useState(!1),[l,h]=g.useState(0),[d,p]=g.useState(0),v=n.useIsTabbing(),m=n.useDispatch(),{inputPlaceholder:c="Type your message",inputHidden:$=!1,inputDisabled:w=!1,sendButtonLabel:C="Send message",inputMultiline:j=!0,secondaryAction:b}=n.useProperties(),[W,f]=n.useScroll(!0);g.useEffect(()=>{if(f.current){const{lineHeight:u,maxHeight:z}=getComputedStyle(f.current);if(u&&u.indexOf("px")>-1){const k=u.split("px"),V=parseInt(k[0],10);h(V);const Y=z.split("px");p(parseInt(Y[0],10))}}},[f.current]);const M=u=>{!u.shiftKey||!j?(u.preventDefault(),t&&t.length>0&&(m("user-submit",{text:t}),r(""),N(""))):t.length<1&&u.preventDefault()},U=u=>{b&&(u.preventDefault(),m("action",{actionKey:b.action,...b}))},_=u=>{if(j&&f.current){const z=f.current.scrollHeight;if(z>l){f.current.style.height="auto";let k=z;u.length<1&&(k=l),f.current.style.height=`${k}px`,k>=d?f.current.style.overflowY="scroll":f.current.style.overflowY="hidden"}}},N=u=>{_(u),r(u),u&&u.length>0&&m("user-typing",{textLength:u.length})};return $?null:s.jsxs(ee,{grow:j,className:L.appendClassNames("humany-conversation-input",e),"data-has-focus":o,scrollableCss:W,isTabbing:v,children:[b&&s.jsx(Z,{disabled:w,onClick:U,title:b.label,"aria-label":b.label,children:s.jsx(n.SymbolBadge,{size:24,symbol:{type:"Svg",content:b.icon||"browse"}})}),j?s.jsx(Q,{value:t,onChange:N,onEnter:M,disabled:w,"aria-label":c,placeholder:c,onFocusChange:i,type:"textarea",rows:1,ref:f}):s.jsx(X,{value:t,onChange:N,onEnter:M,disabled:w,"aria-label":c,placeholder:c,onFocusChange:i}),s.jsx(F,{disabled:w,onClick:M,title:C,"aria-label":C,children:s.jsx(te,{size:22,symbol:{type:"Svg",content:"send"},hasContent:!!t&&!!t.length})})]})},Q=a(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
- `,X=i(n.Input)`
15
+ `,X=a(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
- `,D=i(n.Button)`
29
+ `,F=a(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
- `,Z=i(D)`
41
+ `,Z=a(F)`
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
- `,ee=i.div`
45
- ${e=>e.grow?p.css`
44
+ `,ee=a.div`
45
+ ${e=>e.grow?y.css`
46
46
  min-height: 50px;
47
47
  max-height: 150px;
48
- `:p.css`
48
+ `:y.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
- `,te=i(({hasContent:e,...t})=>s.jsx(n.SymbolBadge,{...t}))`
60
+ `,te=a(({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
- `,se=i.div`
66
+ `,se=a.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
- `,ne=p.keyframes`
101
+ `,ne=y.keyframes`
102
102
  0% {
103
103
  opacity: 0;
104
104
  }
@@ -108,7 +108,7 @@
108
108
  100% {
109
109
  opacity: 0;
110
110
  }
111
- `,re=i.div`
111
+ `,re=a.div`
112
112
  display: flex;
113
113
  justify-content: center;
114
114
  > div {
@@ -125,20 +125,20 @@
125
125
  > div:nth-of-type(3) {
126
126
  animation-delay: 200ms;
127
127
  }
128
- `,H=i.div`
128
+ `,R=a.div`
129
129
  grid-area: content;
130
130
  max-width: 100%;
131
131
  overflow: hidden;
132
- `,oe=i(n.Typography)`
132
+ `,oe=a(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
- `,R=i.div`
136
+ `,A=a.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
- `,A=i.div`
141
+ `,O=a.div`
142
142
  ${e=>{var t;return e.padded&&`padding: ${(t=e.theme.sizes)==null?void 0:t.medium};`}}
143
143
  ${e=>!e.user&&e.stacked&&ae(e.stacked,e.theme)}
144
144
  ${e=>e.user&&e.stacked&&ie(e.stacked,e.theme)}
@@ -154,11 +154,11 @@
154
154
  }
155
155
  max-width: 100%;
156
156
  ${e=>e.fullWidth&&"width: 100%;"}
157
- `,ae=(e,t)=>{var o,a;const r=p.css`
157
+ `,ae=(e,t)=>{var o,i;const r=y.css`
158
158
  background-color: ${(o=t.colors)==null?void 0:o.accent};
159
- color: ${(a=t.colors)==null?void 0:a.text};
159
+ color: ${(i=t.colors)==null?void 0:i.text};
160
160
  ${t.border&&`border: ${t.border};`};
161
- `;return t.borderRadius?p.css`
161
+ `;return t.borderRadius?y.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},ie=(e,t)=>{var o,a;const r=p.css`
174
+ `:r},ie=(e,t)=>{var o,i;const r=y.css`
175
175
  background-color: ${(o=t.colors)==null?void 0:o.primary};
176
- color: ${(a=t.colors)==null?void 0:a.accent};
177
- `;return t.borderRadius?p.css`
176
+ color: ${(i=t.colors)==null?void 0:i.accent};
177
+ `;return t.borderRadius?y.css`
178
178
  ${r}
179
179
 
180
180
  border-top-left-radius: ${t.borderRadius};
@@ -187,17 +187,17 @@
187
187
  ${e==="last"&&`
188
188
  border-bottom-right-radius: ${t.borderRadius};
189
189
  `}
190
- `:r},L=i.div`
190
+ `:r},T=a.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
- `,j=e=>{var t,r;return p.css`
195
+ `,S=e=>{var t,r;return y.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
- `},le=i(n.Form)`
198
+ `},le=a(G.FormComponent)`
199
199
  & button.humany-form-component-button {
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})}};
200
+ ${e=>{var t,r,o,i;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:(i=e.theme.colors)==null?void 0:i.accent,theme:e.theme})}};
201
201
  display: block;
202
202
  width: 100%;
203
203
  margin-bottom: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
@@ -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
- `,ce=i(n.Html)`
212
+ `,ce=a(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
- `,de=i(n.List)`
220
+ `,de=a(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
- `,me=i.button`
227
+ `,me=a.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
- `,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`
237
+ `,q=g.forwardRef(({boxed:e,className:t,agentData:r},o)=>s.jsx(R,{ref:o,children:s.jsx(A,{left:e,center:!e,children:s.jsx(O,{padded:!!e,stacked:e?"first":void 0,children:s.jsxs(re,{children:[s.jsx("div",{}),s.jsx("div",{}),s.jsx("div",{})]})})})})),ue=a.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
- `,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`
246
+ `,D=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),I=({className:e,name:t,timestamp:r})=>{if(!t&&!r)return null;let o="";return t?r?o=`${t}: ${D(r)}`:o=t:r&&(o=D(r)),s.jsx(ue,{children:o})},P=({className:e,children:t,sender:r,timestamp:o})=>{const{avatar:i,name:l}=r,{avatarSize:h}=n.useProperties();return s.jsxs(he,{hasAvatar:!!i,className:L.appendClassNames(e,"humany-conversation-agent-message"),children:[i&&s.jsx(se,{avatarSize:h,children:typeof i=="string"?s.jsx("img",{src:i}):s.jsx(n.SymbolBadge,{symbol:i})}),t,s.jsx(I,{name:l,timestamp:o})]})},he=a.div`
247
247
  display: grid;
248
248
  margin-right: 10%;
249
249
  width: 90%;
250
- ${e=>e.hasAvatar?p.css`
250
+ ${e=>e.hasAvatar?y.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
- `:p.css`
256
+ `:y.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
- `,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`
263
+ `,ge=g.forwardRef(({className:e,children:t,timestamp:r,discrete:o,fullWidth:i},l)=>s.jsx(ye,{ref:l,className:L.appendClassNames(e,"humany-conversation-system-message"),fullWidth:i,children:o?s.jsxs(pe,{className:"humany-conversation-discrete-message",children:[t,s.jsx(I,{timestamp:r})]}):s.jsxs(s.Fragment,{children:[t,s.jsx(I,{timestamp:r})]})})),ye=a.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
- `,pe=i.div`
267
+ `,pe=a.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
- `,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`
275
+ `,be=({className:e,children:t,timestamp:r})=>{const{userLabel:o=""}=n.useProperties();return s.jsxs(fe,{className:L.appendClassNames(e,"humany-conversation-user-message"),children:[t,s.jsx(I,{name:o,timestamp:r})]})},fe=a.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
- `,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)`
281
+ `,K=e=>Array.isArray(e)?e:Object.keys(e).map(t=>({label:e[t],actionKey:t})),xe=({header:e,actions:t,dispatch:r})=>s.jsx($e,{className:"humany-conversation-button-list",header:e,items:K(t),renderItem:o=>s.jsx("li",{children:s.jsxs(ve,{onClick:()=>{r("action",o)},"aria-label":o.label,title:o.label,children:[s.jsx(n.SymbolBadge,{symbol:o.symbol}),o.label]})},o.actionKey)}),$e=a(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
- ${j}
292
- `,$e=i(n.Button)`
291
+ ${S}
292
+ `,ve=a(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
- `,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)`
311
+ `,je=({type:e,content:t={}})=>{const r=n.useComponent(e);return!r||!e?null:s.jsx(g.Suspense,{fallback:null,children:s.jsx(r,{...t})})},Se=({body:e})=>s.jsx(we,{html:e}),we=a(n.Html)`
312
312
  ${n.genericHtml}
313
313
  color: inherit;
314
314
  white-space: pre-wrap;
315
- ${j}
315
+ ${S}
316
316
  a {
317
317
  color: ${e=>e.theme.colors.link};
318
318
  &:focus-visible {
319
319
  ${n.borderTabStyle};
320
320
  }
321
321
  }
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)`
322
+ `,Ce=({header:e,actions:t,dispatch:r})=>s.jsx(ke,{className:"humany-conversation-item-list",header:e,items:K(t),renderItem:o=>{var i;return s.jsx("li",{children:s.jsxs(Le,{children:[((i=o.symbol)==null?void 0:i.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=a(n.ItemList)`
323
323
  ${n.itemList}
324
324
 
325
325
  > .humany-paragraph {
326
- ${j}
326
+ ${S}
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",p.css`
334
+ ${e=>n.headingElement(e)("h1",y.css`
335
335
  white-space: normal;
336
336
  `)}
337
337
 
@@ -351,10 +351,10 @@
351
351
  border-bottom: none;
352
352
  }
353
353
  }
354
- `,Le=i.div`
354
+ `,Le=a.div`
355
355
  display: flex;
356
356
  gap: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}};
357
- ${j}
357
+ ${S}
358
358
 
359
359
  .item-icon {
360
360
  }
@@ -388,11 +388,11 @@
388
388
  }
389
389
  }
390
390
  }
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)`
391
+ `,ze=({header:e,actions:t,dispatch:r})=>s.jsx(Te,{className:"humany-conversation-link-list",header:e,items:K(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=a(n.ItemList)`
392
392
  ${n.itemList}
393
- ${j}
393
+ ${S}
394
394
 
395
- ${e=>n.headingElement(e)("h1",p.css`
395
+ ${e=>n.headingElement(e)("h1",y.css`
396
396
  white-space: normal;
397
397
  `)}
398
398
 
@@ -404,7 +404,7 @@
404
404
  margin: 0;
405
405
  }
406
406
  }
407
- `,Ie=i(n.Button)`
407
+ `,Ie=a(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&&p.css`
416
+ ${e=>{var t,r;return e.help&&y.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
- `,Me=()=>s.jsx(Ne,{className:"humany-conversation-separator"}),Ne=i.div`
433
+ `,Me=()=>s.jsx(Ne,{className:"humany-conversation-separator"}),Ne=a.div`
434
434
  ${e=>e.theme.border&&`border-bottom: ${e.theme.border};`}
435
435
  width: 100%;
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)`
436
+ `,Be=({text:e})=>s.jsx(He,{className:"humany-conversation-text",variant:"span",children:e}),He=a(n.Typography)`
437
+ ${S}
438
+ `,Re=({header:e="Video call",acceptLabel:t="Accept",declineLabel:r="Decline",dispatch:o})=>{const i=g.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:i,renderItem:l=>{const h=l.actionKey==="accept-video-call"?"#70c48e":"#da5c85";return s.jsx("li",{children:s.jsx(Oe,{onClick:()=>{o("action",l)},"aria-label":l.label,title:l.label,bgColor:h,children:s.jsx(n.SymbolBadge,{symbol:l.symbol,size:25})})},l.actionKey)}})},Ae=a(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=>j(e)}
449
- `,Ee=i(n.Button)`
448
+ ${e=>S(e)}
449
+ `,Oe=a(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
- `,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)`
483
+ `,Ke=([e,t])=>({type:e,content:t}),qe=({items:e,dispatch:t})=>s.jsx(De,{className:"humany-message-list",items:e.map(Ke),renderLi:!0,renderItem:r=>{switch(r.type){case x.ConversationMessageListItemType.Text:return s.jsx(Be,{text:r.content});case x.ConversationMessageListItemType.HTML:return s.jsx(Se,{...r.content});case x.ConversationMessageListItemType.Separator:return s.jsx(Me,{...r.content});case x.ConversationMessageListItemType.ItemList:return s.jsx(Ce,{...r.content,dispatch:t});case x.ConversationMessageListItemType.LinkList:return s.jsx(ze,{...r.content,dispatch:t});case x.ConversationMessageListItemType.ButtonList:return s.jsx(xe,{...r.content,dispatch:t});case x.ConversationMessageListItemType.VideoRequest:return s.jsx(Re,{...r.content,dispatch:t});default:return s.jsx(je,{type:r.type,content:r.content})}}}),De=a(n.List)`
484
484
  ${n.list}
485
485
 
486
486
  > li {
487
487
  margin: 0;
488
488
  }
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`
489
+ `,Fe=g.forwardRef(({className:e,timestamp:t,sender:r,type:o,content:i},l)=>{const h=g.useCallback(m=>{let c="first";return i.length>1&&(c=m===0?"first":m+1===i.length?"last":"middle"),c},[i]),d=()=>s.jsx(s.Fragment,{children:i.map(m=>{const{key:c,body:$,title:w,form:C,actions:j}=m,b=!!$&&!w&&!C&&!j;return s.jsx(ge,{className:e,discrete:b,ref:l,timestamp:t,fullWidth:!!C||!!j,children:b&&$?s.jsx(n.Html,{html:$}):s.jsx(B,{isSystem:!0,content:m})},c)})}),p=()=>s.jsx(P,{sender:r,timestamp:t,className:e,children:s.jsx(R,{className:"humany-message-content-bundle",children:i.map((m,c)=>s.jsx(A,{className:"humany-message-container",left:!0,ref:l,children:s.jsx(B,{content:m,stacked:h(c)})},m.key))})}),v=()=>s.jsx(be,{timestamp:t,className:e,children:s.jsx(R,{className:"humany-message-content-bundle",children:i.map((m,c)=>s.jsx(A,{className:"humany-message-container",right:!0,ref:l,children:s.jsx(B,{isUser:!0,content:m,stacked:h(c)})},m.key))})});switch(o){case x.ConversationMessageType.System:return d();case x.ConversationMessageType.Agent:return p();case x.ConversationMessageType.User:return v();default:return null}}),B=({content:e,isUser:t,isSystem:r,stacked:o})=>{const i=n.useDispatch(),{title:l,body:h,actions:d,form:p,items:v}=e;return v?s.jsx(O,{className:"humany-message-content",user:!!t,stacked:o,children:s.jsx(qe,{items:v,dispatch:i})}):s.jsxs(O,{className:"humany-message-content",padded:!r,user:!!t,stacked:o,fullWidth:!!p||!!d,children:[l&&s.jsx(T,{children:s.jsx(oe,{variant:"h2",children:l})}),h&&s.jsx(T,{children:s.jsx(ce,{html:h})}),p&&s.jsx(T,{children:s.jsx(le,{...p,onChange:(c,$)=>{i("form",{data:$,formKey:p.schema.id,actionKey:c})}})}),d&&s.jsx(T,{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:()=>{i("action",c.actionKey)},children:c.label})},c.actionKey)})})]})},E=()=>{const e=g.useCallback(d=>{d&&setTimeout(()=>{d.scrollIntoView({block:"start",behavior:"smooth"})},250)},[]),[t,r]=n.useScroll(!0),{messages:o,loading:i,typingActors:l=[]}=n.useProperties(),h=()=>l&&l.length?l.map((d,p)=>s.jsx(H,{id:`typing_${d.name}`,children:s.jsx(P,{timestamp:Date.now(),sender:d,children:s.jsx(q,{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,p)=>{const{type:v,timestamp:m,sender:c,content:$}=d;return s.jsx(H,{className:"humany-conversation-entry",tabIndex:-1,children:s.jsx(Fe,{...d,ref:e})},`${v}_${c==null?void 0:c.name}_${m}_${$[0].key}`)}):null,h(),i&&s.jsx(H,{children:s.jsx(q,{ref:e})})]}),s.jsx(J,{})]})},Pe=a.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
- `,B=i.div`
499
+ `,H=a.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",p.css`
522
+ ${e=>n.headingElement(e)("h1",y.css`
523
523
  font-weight: normal;
524
524
  `)}
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)`
525
+ `,Ee=({dispatch:e})=>{const t=g.useRef(null);return g.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(E,{})]}),Ue=a(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
- `,_e=i.div`
534
+ `,_e=a.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
- `,Ve=i(n.Typography)`
542
+ `,Ve=a(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
- `,Ye=i(n.Button)`
546
+ `,Ye=a(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
- `,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`
560
+ `,Ge=({className:e,...t})=>{const{overlay:r,overlayConversationHeader:o,overlayConversationCloseLabel:i,conversationControllerId:l}=n.useProperties(),h=n.useDispatch();return s.jsxs(n.ConversationContext.Provider,{value:l?{id:l}:null,children:[s.jsx(Je,{...t,className:L.appendClassNames(e,"humany-conversation-component"),children:s.jsx(E,{})}),r&&s.jsxs(s.Fragment,{children:[s.jsx(Ee,{dispatch:h}),r.conversation&&s.jsx(We,{dispatch:h,header:o,buttonLabel:i})]})]})},Je=a.div`
561
561
  position: absolute;
562
562
  right: 0;
563
563
  left: 0;
package/index.js CHANGED
@@ -1 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-a3c122bb.js");require("react/jsx-runtime");require("@emotion/styled");require("@emotion/react");require("react");require("react-transition-group");require("react-dom");require("react-router-dom");exports.ConversationComponent=e.ConversationComponent;exports.ConversationController=e.ConversationController;exports.ConversationEndedBehavior=e.ConversationEndedBehavior;exports.ConversationEntry=e.ConversationEntry;exports.ConversationMessageListItemType=e.ConversationMessageListItemType;exports.ConversationMessageType=e.ConversationMessageType;exports.ConversationPlatform=e.ConversationPlatform;exports.ConversationReturnButtonComponent=e.ConversationReturnButtonComponent;exports.registerCustomMessageComponent=e.registerCustomMessageComponent;
1
+ "use strict";var $=Object.defineProperty;var q=(i,e,t)=>e in i?$(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var d=(i,e,t)=>(q(i,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@telia-ace/widget-core"),p=require("@telia-ace/widget-services"),x=require("@telia-ace/widget-utilities"),L=require("@telia-ace/widget-forms"),M=require("@telia-ace/widget-plugins"),N=require("@telia-ace/widget-ui"),z=require("react");class U{constructor(e){d(this,"cache",new Map);d(this,"subscriptions",[]);this.controller=e;const{events:t}=e.container.get("$widget"),s=t.subscribe("data-client:fetched",(r,n)=>{n.type==="contact-method"&&this.cache.set(n.response.id,n.response)});this.subscriptions.push(s)}getConversationLogs(){return this.controller.messages.reduce((t,s)=>{const r=P(s),{key:n,content:a,type:o,sender:c,timestamp:h}=r.content,u=this.parseEntry(a,o,c,h);return u&&t.push(u),t},[])}parseEntry(e,t,s,r){const n=h=>{let u=[],l=[],m;if(Array.isArray(h)){const[g,f]=h;m=f}else m=h;return this.createMessageContent(m).length&&(l=[...l,this.createMessageContent(m)]),u=[...u,...this.createMessageOptions(m)],{messagesAsList:l,options:u}};let a=[],o=[];if(Array.isArray(e.items)){const{items:h}=e;h.forEach(u=>{const l=n(u);a=[...a,...l.options],o=[...o,...l.messagesAsList]})}else{const h=n(e);a=[...a,...h.options],o=[...o,...h.messagesAsList]}return{options:a,message:o.length?o.join(`
2
+ `):void 0,source:this.createMessageSource(t),alias:this.createAlias(t,s),timestamp:r}}createMessageSource(e){return e}createAlias(e,t){return e===y.System?"system":(t==null?void 0:t.name)||"Me"}handleContactMethod(e){if(!this.cache.has(e))return;const t=this.cache.get(e);let s="";return s=this.appendText(s,`${t.clientName}:`),s=this.appendText(s,t.title),t.description&&(s=this.appendText(s,t.title)),s}getDetails(e,t=!0){if(!e)return"";const{header:s,title:r,label:n,description:a,text:o,html:c,body:h,contactMethodId:u}=e;let l="";if(u){const m=this.handleContactMethod(u.toString());m&&(l=this.appendText(l,m,t))}return s&&(l=this.appendText(l,s,t)),r&&(l=this.appendText(l,r,t)),a&&(l=this.appendText(l,a,t)),o&&(l=this.appendText(l,o,t)),n&&(l=this.appendText(l,n,t)),c&&(l=this.appendText(l,c,t)),h&&typeof h=="string"&&(l=this.appendText(l,h,t)),l}createMessageContent(e){let t="";return t=this.getDetails(e),t}createMessageOptions(e){let t=[],s=[];return Array.isArray(e==null?void 0:e.actions)?s=e.actions:typeof(e==null?void 0:e.actions)=="object"&&(s=Object.entries(e.actions).map(([r,n])=>({actionKey:r,label:n}))),s.length&&(t=s.map(r=>this.getDetails(r,!1))),t}appendText(e,t,s=!0){return s&&e.length?`${e}
3
+ ${t}`:e.length?`${e} ${t}`:t}dispose(){this.subscriptions.forEach(e=>{e()})}}class A{constructor(e,t){d(this,"id");d(this,"name");d(this,"avatar");d(this,"print",(e,t)=>{const s={name:this.name,avatar:this.avatar,id:this.id},r=P(e,t);return this.provider.createEntry(r.key,r.content,y.Agent,s,r.timestamp)});d(this,"typing",()=>this.provider.setTypingState({name:this.name,avatar:this.avatar}));this.provider=e,this.id=t.id||x.uuid(),this.name=t.name,this.avatar=t.avatar}update(e){var r;const{name:t,avatar:s}=e;s===null?this.avatar=void 0:s&&(this.avatar=s),t===null?this.name=void 0:t&&(this.name=t),(r=this.provider.controller)==null||r.events.dispatch("conversation:agent-updated",{agent:this})}}class E{constructor(e,t,s){d(this,"subscriptions",[]);d(this,"options");d(this,"user");this.name=e,this.container=t,this.controller=s,this.user=s==null?void 0:s.user,this.options={silent:!1}}static create(e,t,s){return new E(e,t,s)}createAgent(e={}){var t;if(this.controller){const s=this.controller.getAgentById(e.id),r=s?new A(this,{...s,...e}):new A(this,e);return s||(t=this.controller)==null||t.events.dispatch("conversation:agent-created",{agent:r}),r}}print(e){var t;return(t=this.controller)==null?void 0:t.print(e)}setTypingState(e,t){var s;return(s=this.controller)==null?void 0:s.setTypingState(e,t)}loading(){return this.controller?this.controller.loader():()=>()=>{}}createEntry(e,t,s,r,n){var a;return(a=this.controller)==null?void 0:a.createEntry(e,t,s,r,n)}dispose(){var e;process.env.NODE_ENV!=="production"&&console.log(`conversation-provider: dispose (${this.name})`),(e=this.controller)==null||e.disposeProvider(this),this.controller=null,this.subscriptions.forEach(t=>t())}isRehydrated(){var e;return((e=this.controller)==null?void 0:e.isRehydrated())||Promise.resolve(!1)}getHistory(){var e;return((e=this.controller)==null?void 0:e.getHistory())||[]}complete(){var e;(e=this.controller)==null||e.onCompleteProvider()}setOptions(e={silent:!1}){this.options=e}onUnreadMessage(e){var t;if(this.controller){const s=(t=this.controller)==null?void 0:t.onUnreadMessage(e);return this.subscriptions.push(s),()=>{s()}}}onMounted(e){var t;if(this.controller){const s=(t=this.controller)==null?void 0:t.events.subscribe("conversation:component-mount-changed",e);return this.subscriptions.push(s),e({},this.controller.getComponentMountedState()),()=>{s()}}}}const O=i=>`conversation-${i}`;class K{constructor(){d(this,"_locking",Promise.resolve());d(this,"_locks",0)}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const t=new Promise(r=>e=()=>{this._locks-=1,r()}),s=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),s}}class Q{constructor(e,t,s){d(this,"sessionStorageKey");d(this,"locker",new K);d(this,"initialStoredAgents",[]);this.container=e,this.conversation=t,this.enabled=s,this.sessionStorageKey=O(t.id),t.onStarted(async()=>{if(t.messages.length>0)return;const{agents:r}=await this.read(),n=[];r&&r.forEach(o=>{const c=t.providerIndex(o.providerName),h=c>-1?t.registeredProviders[c]:t.createProvider(o.providerName),u=new A(h,{name:o.name,avatar:o.avatar,id:o.id});n.push(u)});const{messages:a}=await this.read();a.forEach(o=>{switch(o.type){case"agent":{const c=n.find(h=>{var u;return h.id===((u=o.sender)==null?void 0:u.id)});c&&c.print(o.content.items||o.content,{key:o.key});return}case"user":{t.user.print(o.content.items||o.content,{key:o.key});return}case"system":default:t.print(o.content.items||o.content)}})}),t.onMessageCreated(async(r,n)=>{this.write(n.message,"messages")}),t.events.subscribe("conversation:agent-created",async(r,n)=>{const a={id:n.agent.id,name:n.agent.name,avatar:n.agent.avatar,providerName:n.agent.provider.name};await this.write(a,"agents")}),t.events.subscribe("conversation:agent-updated",async(r,n)=>{const{agents:a}=await this.read();await this.write([...a.map(o=>o.id===n.agent.id?{...o,name:n.agent.name,avatar:n.agent.avatar}:o)],"agents","update")})}setInitialData(e){this.initialStoredAgents=e.agents}async isRehydrated(){const{messages:e}=await this.read();return e.length>0}getStoredAgent(e){if(this.enabled)return this.initialStoredAgents.find(t=>t.id===e)}async write(e,t,s="add"){if(!this.enabled)return;const r=await this.locker.lock();return p.createStorageWriter(this.container,this.sessionStorageKey,p.StorageCategory.Necessary).then(async n=>{if(s==="add"){const a=await this.read();if(t==="messages"&&a.messages.findIndex(c=>c.key===e.key)>-1){r();return}const o={...a};return t==="messages"?o.messages=[...o.messages,e]:t==="agents"&&(o.agents=[...o.agents,e]),n({...a,...o}).then(()=>{r()})}if(s==="update"&&t==="agents"){const a=await this.read();return n({...a,agents:e}).then(()=>{r()})}return n(e).then(()=>{r()})})}async read(){return p.readStorage(this.container,this.sessionStorageKey).then(e=>e||{messages:[],agents:[]})}}class j{constructor(e){d(this,"print",(e,t)=>{const s=P(e,t);return this.controller.createEntry(s.key,s.content,y.User,void 0,s.timestamp)});this.controller=e}}const k=async(i,e,t)=>{const s=await i.getAsync("conversation"),r=await i.getAsync("components"),n=s.controllers.find(a=>a.conversation.id===e);if(n){const a=[...n.conversation.providers];a.forEach(c=>{n.conversation.setProviderOptions(c,{silent:!0})}),n.conversation.queueProviders(a),n.conversation.setProviders([t]);const o=r.components().ofType("conversation");r.write({key:"setConversationProvider",attributes:{properties:{providers:[t]}},target:o,provider:"localStorage"})}};class H{constructor(e){this.writer=e}update(e){const t=this.getNormalizedSettings(e);this.writer(t)}remove(){this.writer(null)}getNormalizedSettings(e){return typeof e=="string"?{body:e}:e.length>-1&&typeof e=="object"?{items:e}:e}}var y=(i=>(i.User="user",i.Agent="agent",i.System="system",i))(y||{});const P=(i,e)=>{let t,s=(e==null?void 0:e.key)||x.uuid(),r=Date.now();if(Array.isArray(i)&&i.length>-1)typeof i[0]=="string"?t={items:[i]}:t={items:i};else if(typeof i=="string")t={body:i};else if(i=i||{},i.type)t={...i};else{if(t={body:i.body,actions:i.actions,title:i.title},i.key&&(s=i.key),i.timestamp&&(r=i.timestamp),typeof i.form=="function"){const n=L.FormBuilder.create(s);i.form(n);const a=n.get();t.form=a}i.timestamp===null&&(r=null)}return{content:t,key:s,timestamp:r}},W=(i,e)=>{if(!e)return;const t=JSON.stringify(e),s=i.findIndex(r=>t===JSON.stringify(r));if(s>-1)return i.splice(s,1)};class B{constructor(e,t,s){d(this,"formHandlers",{});d(this,"user",new j(this));d(this,"events");d(this,"providers",[]);d(this,"active",!1);d(this,"queuedProviders",[]);d(this,"registeredProviders",[]);d(this,"loaders",0);d(this,"componentMounted",!1);d(this,"store");d(this,"messages",[]);d(this,"typingActors",[]);d(this,"conversationHistory");d(this,"print",e=>{const t=P(e);return this.createEntry(t.key,t.content,"system",void 0,t.timestamp)});this.container=e,this.id=t;const r=e.get("$widget");this.events=r.events.createChild(this),this.store=new Q(e,this,s.rehydrate),this.conversationHistory=new U(this)}setInitialStorage(e){this.store.setInitialData(e)}setProviders(e){const t=[],s=[];this.providers.reduce((r,n)=>(e.indexOf(n)===-1&&r.push(n),r),[]).forEach(r=>{const n=this.providers.indexOf(r);n>-1&&(t.push(r),this.providers.splice(n,1))}),e.forEach(r=>{this.providers.indexOf(r)===-1&&(s.push(r),this.providers.push(r))}),(s.length||t.length)&&this.events.dispatch("conversation:providers-changed",{added:s,removed:t})}createProvider(e){const t=this.providerIndex(e);if(t>-1)return this.registeredProviders[t];const s=E.create(e,this.container,this);return this.registeredProviders.push(s),s}providerIndex(e){return this.registeredProviders.findIndex(t=>t.name===e)}getAgentById(e){if(e)return this.store.getStoredAgent(e)}dispose(){this.conversationHistory.dispose(),this.registeredProviders.forEach(e=>e.dispose()),this.messages=[],this.events.dispatch("conversation:controller-disposed",this),this.active=!1}onDispose(e){return this.events.subscribe("conversation:controller-disposed",e)}onStarted(e){return this.events.subscribe("conversation:started",e)}onMessageCreated(e){return this.events.subscribe("conversation:message-created",e)}isRehydrated(){return this.store.isRehydrated()}disposeProvider(e){const t=this.providerIndex(e.name);t>-1&&this.registeredProviders.splice(t,1),this.events.dispatch("conversation:providers-changed",{removed:[e.name]}),this.registeredProviders.length||this.dispose()}onProvidersChange(e){return this.events.subscribe("conversation:providers-changed",e)}setComponentMountedState(e){this.componentMounted!==e&&(this.componentMounted=e,e&&(this.events.dispatch("conversation:unread-message",!1),this.events.dispatch("conversation:started",!0),this.active=!0),this.events.dispatch("conversation:component-mount-changed",e))}setProviderOptions(e,t){const s=this.providerIndex(e);s>-1&&this.registeredProviders[s].setOptions(t)}changeProvider(e){this.registeredProviders.find(s=>s.name===e)&&k(this.container,this.id,e)}queueProviders(e){this.queuedProviders=e}onCompleteProvider(){const e=this.queuedProviders.pop();e&&k(this.container,this.id,e)}getComponentMountedState(){return this.componentMounted}onUnreadMessage(e){return this.events.subscribe("conversation:unread-message",e)}createEntry(e,t,s,r,n){const a={key:e,content:t,type:s,sender:r||null,timestamp:n||n===null?n:Date.now()};this.messages.push(a),a.type==="agent"&&W(this.typingActors,r);const o=new H(c=>{if(c!==null){const{timestamp:h=void 0,...u}=c;a.content=u,h&&(a.timestamp=h)}else{const h=this.messages.indexOf(a);a.content=null,h>-1&&this.messages.splice(h,1)}this.events.dispatch("conversation:message-updated",{message:a}),this.update()});return this.events.dispatch("conversation:message-created",{message:a}),this.update(),this.componentMounted||this.events.dispatch("conversation:unread-message",!0),o}update(){this.events.dispatch("conversation:updated",{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors})}getMessageStream(){return{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors}}setTypingState(e,t){return this.typingActors.indexOf(e)===-1&&(this.typingActors.push(e),this.update()),()=>{W(this.typingActors,e),this.update()}}loader(){this.loaders=this.loaders+1;let e=!1;return this.loaders===1&&this.update(),()=>{e||(e=!0,this.loaders=this.loaders-1,this.loaders===0&&this.update())}}submitForm(e,t){this.formHandlers[e]={...this.formHandlers[e],submit:t}}validateForm(e,t){this.formHandlers[e]={...this.formHandlers[e],validate:t}}getHistory(){return this.conversationHistory.getConversationLogs()}}const F=(i,e)=>{const t=i.split("_contact");return e.widgets.get(t[0])},I=i=>{const e=i.get("$widget"),{name:t,implementation:s}=i.get("$widget"),r=t.indexOf("_contact")>-1?F(t,s):e,{data:n}=i.get("$settings"),{trigger:a}=r.container.get("$settings"),o=`${t.replace("_contact-method","").replace("_contact","")}_contact-method`,c=s.widgets.get(o);return c&&!a?{chatWidget:c,mainWidget:r,data:n}:{mainWidget:r,data:n}},G=i=>{const{chatWidget:e}=I(i);return!!e},R=(i,e,t)=>{const{mainWidget:s,data:r,chatWidget:n}=I(i);return n?n.state==="activated"?n.invoke("open").then(()=>{n.container.getAsync("conversation").then(a=>{a.navigateToConversationIfActive(e.id).then(()=>M.closeAllModals(i))})}):n.activate().then(()=>{const{trigger:a}=n.container.get("$settings");return a.action="hide",n.invoke("setSettings",()=>({data:r,trigger:a,activate:!0})).then(()=>n.container.getAsync("components").then(o=>{const c=o.components().ofType("contact-method");o.write({key:"setContactMethodId",attributes:{properties:{id:e.id,guideId:e.guideId}},target:c,provider:"localStorage"});const h=o.components().ofType("conversation");o.write({key:"setConversationProvider",attributes:{properties:{providers:[e.clientName]}},target:h,provider:"localStorage"})}))}).then(()=>n.invoke("attach",{key:"contact-method",triggerDOMElement:t,withRenderState:"open"})).then(()=>(p.createStorageWriter(n.container,"activeStickyWidget",p.StorageCategory.Necessary,{medium:p.StorageMedium.Local,scope:p.StorageScope.Implementation}).then(a=>a(n.name)),n.container.getAsync("conversation").then(a=>{a.setConversationEndedBehavior(S.Deactivate)}).then(()=>M.closeAllModals(i)).then(()=>!1))):(s.container.getAsync("conversation").then(a=>a.navigateToConversationIfActive(e.id).then(()=>a.setConversationEndedBehavior(S.Navigate))),!n)},J=(i,e,t="conversation")=>{const{mainWidget:s,chatWidget:r}=I(i);return r?r.container.getAsync("router").then(n=>{n.navigate(t,{id:e.id})}):s.container.getAsync("conversation").then(n=>{var a;(a=n.setConversationEndedBehavior(S.Navigate))==null||a.then(()=>{s.container.getAsync("router").then(o=>{s.container.getAsync("components").then(c=>{const h=c.components().ofType("conversation");c.write({key:"setConversationProvider",attributes:{properties:{providers:[e.clientName]}},target:h,provider:"localStorage"})}).then(()=>{o.navigate(t,{id:e.id})})})})})},b="conversations";var S=(i=>(i.Deactivate="deactivate",i.Navigate="navigate",i.None="none",i))(S||{});class w{constructor(e,t){d(this,"events");d(this,"controllers",[]);d(this,"providers",[]);d(this,"disposeProviders",{});d(this,"subscriptions",[]);d(this,"storageWriter",null);d(this,"router",null);d(this,"buttonQuery",null);d(this,"sessionInfo",null);this.container=e,this.components=t;const s=e.get("$widget");this.events=s.events.createChild(this)}initialize(){p.createStorageWriter(this.container,b,p.StorageCategory.Necessary,{medium:p.StorageMedium.Local}).then(e=>this.storageWriter=e),p.readStorage(this.container,b,p.StorageMedium.Local).then(e=>{this.buttonQuery=this.components.components().ofType("conversation-return-button"),e&&(this.sessionInfo=e,e.id&&e.route&&this.writeToComponents({active:!0,alert:{show:!1}}))}),this.container.getAsync("router").then(e=>this.router=e),this.events.subscribe("conversation:ended",(e,t)=>{var s,r,n;switch((s=this.sessionInfo)==null?void 0:s.conversationEndedBehavior){case"deactivate":this.container.get("$widget").deactivate();break;case"navigate":const o=(r=this.router)==null?void 0:r.getInitialRoute();o&&((n=this.router)==null||n.navigate(o.name));break}this.writeToComponents({active:!1}),this.sessionInfo=null,this.storageWriter&&this.storageWriter()})}addSubscription(e){this.subscriptions.push(e)}static getInstance(e,t="conversation"){return x.lock(e)(()=>e.getAsync(t).then(s=>{let r=s;return r||D.ComponentPlatform.getInstance(e).then(n=>(r=new w(e,n),r.initialize(),e.registerAsync(t,()=>r),r))}))}navigateToConversationIfActive(e){return p.readStorage(this.container,b,p.StorageMedium.Local).then(t=>{var s;if(t&&t.id===e&&t.route){const{name:r,params:n}=t.route;(s=this.router)==null||s.navigate(r,n)}})}setConversationEndedBehavior(e){return p.readStorage(this.container,b,p.StorageMedium.Local).then(t=>{let s=t;return s?s.conversationEndedBehavior=e:s={conversationEndedBehavior:e},this.sessionInfo=s,this.storageWriter&&this.storageWriter(this.sessionInfo)||Promise.resolve()})}async createController(e,t){const s=O(e),{agents:r}=await p.readStorage(this.container,s)||{agents:[]},n=this.controllers.findIndex(o=>o.conversation.id===e);let a;return n>-1?a=this.controllers[n].conversation:a=new B(this.container,e,t),a.setInitialStorage({agents:r||[]}),a}registerProvider(e,t){const s={name:e,handler:t};this.providers.push(s),this.controllers.filter(r=>r.conversation.providers.indexOf(e)>-1).forEach(r=>{this.invokeHandler(s,r)})}registerController(e,t){const s=this.controllers.findIndex(n=>n.conversation.id===e.id);let r;if(s<0){r={conversation:e,component:t},this.controllers.push(r);const n=a=>{a&&this.providers.filter(o=>a.indexOf(o.name)>-1).forEach(o=>{this.invokeHandler(o,r)})};return this.subscriptions.push(e.onDispose((a,o)=>{const c=this.controllers.findIndex(h=>h.conversation===o);c>-1&&this.controllers.splice(c,1),this.components.components().ofType("conversation-return-button").select().writeProperties({active:!1}),this.events.dispatch("conversation:ended",{},{bubbles:!0})})),this.subscriptions.push(e.onProvidersChange((a,o)=>{const{added:c,removed:h=[]}=o;h.forEach(u=>{(this.disposeProviders[u]||[]).forEach(l=>{l()})}),n(c)})),this.subscriptions.push(e.onStarted((a,o)=>{var h,u;const c={id:e.id,route:(h=this.router)==null?void 0:h.getRouteData(),conversationEndedBehavior:(u=this.sessionInfo)==null?void 0:u.conversationEndedBehavior};this.sessionInfo=c,this.storageWriter&&this.storageWriter(c),this.writeToComponents({active:o})})),this.subscriptions.push(e.onUnreadMessage((a,o)=>{this.events.dispatch("conversation:unread-message",o),this.writeToComponents({alert:{show:o}})})),n(e.providers),!0}return r=this.controllers[s],!1}writeToComponents(e,t="conversationReturnButtonState"){this.buttonQuery&&this.components.write({key:"conversationReturnButtonState",attributes:{properties:e},target:this.buttonQuery,provider:"localStorage"})}invokeHandler(e,t){const s=e.handler(t.conversation.createProvider(e.name),t.component);s&&(this.disposeProviders[e.name]||(this.disposeProviders[e.name]=[]),this.disposeProviders[e.name].push(s))}getComponentRoute(){return p.readStorage(this.container,b,p.StorageMedium.Local).then(e=>e==null?void 0:e.route)}dispose(){Object.keys(this.disposeProviders).forEach(e=>{this.disposeProviders[e].forEach(t=>{t()})}),this.subscriptions.forEach(e=>{e()}),this.controllers=[],this.providers=[]}static async handleContactMethodClick(e,t,s,r){if(G(t)){e.preventDefault();let n=document.getElementById("humany-dynamic-anchor");n||(n=document.createElement("a"),n.setAttribute("href","#"),n.id="humany-dynamic-anchor",document.body.appendChild(n)),R(t,s,n)}R(t,s)}static async handleContactMethodSubmit(e,t){var s,r;return(r=(s=t==null?void 0:t.body.form.meta)==null?void 0:s.conversation)!=null&&r.id?k(e,t.body.form.meta.conversation.id,t.clientName):J(e,t)}}const V=(i,e)=>i.reduce((t,s,r)=>{var a,o;const n={...s,content:[{...s.content,key:s.key}]};if(t.length>0&&s.type!==y.System){const c=t[t.length-1];if((!e&&e!==0||Math.abs(c.timestamp-s.timestamp)<e)&&((a=c.sender)==null?void 0:a.name)===((o=s.sender)==null?void 0:o.name)&&c.type===s.type)return c.timestamp=s.timestamp,c.content.push({...s.content,key:s.key}),t}return t.push(n),t},[]),Y=i=>Promise.all([w.getInstance(i),i.getAsync("router")]).then(([e,t])=>N.createReactComponent(i,"conversation",Promise.resolve().then(()=>require("./conversation-7c391689.js")),async s=>{const{rehydrate:r=!1}=s.properties(),a=t.getRouteData().params.id||s.node.name||"component",o=await e.createController(a,{rehydrate:r}),c=e.registerController(o,s),h=3*60*1e3,u=v=>{const{providers:g=[]}=v;if(g){const f=Array.isArray(g)?g:[g];return o.setProviders(f),f}};u(s.properties(u)),o.setComponentMountedState(!0);const l=v=>{const{loading:g,typingActors:f,messages:C}=v;s.writeProperties({loading:g,typingActors:f,messages:V(C,h)})};l(o.getMessageStream()),c&&(s.writeProperties({conversationControllerId:o.id}),s.actions.create("user-submit",(v,g)=>{if(g){const{preventDefault:f,validationPromise:C}=g;if(f){C&&C().then(T=>{T&&o.user.print(T)});return}}o.user.print(v.text)}),s.actions.create("user-typing",(v,g)=>{}),s.actions.create("form",(v,g)=>{}),s.actions.create("action",(v,g)=>{}),s.actions.create("overlay-mounted",(v,g)=>{}),s.actions.create("show-overlay",(v,g)=>{s.writeProperties({overlay:{conversation:!1,secondary:!1}})}),s.actions.create("hide-overlay",(v,g)=>{s.writeProperties({overlay:null})}),s.actions.create("show-overlay-conversation",(v,g)=>{s.writeProperties({overlay:{conversation:!0,secondary:!1}})}),s.actions.create("hide-overlay-conversation",(v,g)=>{s.writeProperties({overlay:{conversation:!1,secondary:!1}})}));const m=o.events.subscribe("conversation:updated",(v,g)=>{l(g)});return()=>{o.setComponentMountedState(!1),m(),o.active||l({messages:[],typingActors:[],loading:!1})}},{reuseController:!0})),X=i=>Promise.all([D.ComponentPlatform.getInstance(i),w.getInstance(i),i.getAsync("router")]).then(([e,t,s])=>N.createReactComponent(i,"conversation-return-button",Promise.resolve().then(()=>require("./return-button-cdc53d1f.js")),r=>{r.actions.create("toggle",(n={})=>{var a;(a=t.getComponentRoute())==null||a.then(o=>{o&&s.navigate(o.name,o.params)})})}));var _=(i=>(i.LinkList="link-list",i.Separator="separator",i.ButtonList="button-list",i.ItemList="item-list",i.Text="text",i.HTML="html",i.VideoRequest="video-request",i))(_||{});const Z=(i,e,t)=>i.getAsync("componentResolver").then(async s=>{(await w.getInstance(i)).addSubscription(s.registerComponent(e,z.lazy(()=>t)))});exports.ConversationComponent=Y;exports.ConversationController=B;exports.ConversationEndedBehavior=S;exports.ConversationEntry=H;exports.ConversationMessageListItemType=_;exports.ConversationMessageType=y;exports.ConversationPlatform=w;exports.ConversationReturnButtonComponent=X;exports.registerCustomMessageComponent=Z;