@telia-ace/widget-conversation 1.0.23 → 1.0.24

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,1398 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- import { Input, Button, borderTabStyle, SymbolBadge, useDispatch, useProperties, useScroll, Typography, invertedHoverButton, List, buttonCss, Html as Html$1, genericHtml, ItemList, itemList, useComponent, list, headingElement, WidgetOverlayOutlet } from "@telia-ace/widget-ui";
33
- import { appendClassNames, uuid } from "@telia-ace/widget-utilities";
34
- import React, { useState, useEffect, forwardRef, Suspense, useMemo, useCallback, useRef } from "react";
35
- import styled, { css, keyframes } from "styled-components";
36
- import { FormComponent } from "@telia-ace/widget-forms";
37
- import { ConversationMessageListItemType, ConversationMessageType } from "./index.js";
38
- import "@telia-ace/widget-core";
39
- import "@telia-ace/widget-services";
40
- import "@telia-ace/widget-plugins";
41
- const ConversationInput = ({ className }) => {
42
- const [inputText, setInputText] = useState("");
43
- const [inputFocus, setInputFocus] = useState(false);
44
- const [calculatedLineHeight, setCalculatedLineHeight] = useState(0);
45
- const [textareaMaxHeight, setTextareaMaxHeight] = useState(0);
46
- const dispatch = useDispatch();
47
- const {
48
- inputPlaceholder = "Type your message",
49
- inputHidden = false,
50
- inputDisabled = false,
51
- sendButtonLabel = "Send message",
52
- inputMultiline: multiline = true,
53
- secondaryAction
54
- } = useProperties();
55
- const [scrollableCss, inputRef] = useScroll(true);
56
- useEffect(() => {
57
- if (inputRef.current) {
58
- const { lineHeight, maxHeight } = getComputedStyle(inputRef.current);
59
- if (lineHeight && lineHeight.indexOf("px") > -1) {
60
- const lineHeightNumber = lineHeight.split("px");
61
- const calcLH = parseInt(lineHeightNumber[0], 10);
62
- setCalculatedLineHeight(calcLH);
63
- const maxHeightNumber = maxHeight.split("px");
64
- setTextareaMaxHeight(parseInt(maxHeightNumber[0], 10));
65
- }
66
- }
67
- }, [inputRef.current]);
68
- const submit = (e) => {
69
- if (!e.shiftKey || !multiline) {
70
- e.preventDefault();
71
- if (inputText && inputText.length > 0) {
72
- dispatch("user-submit", { text: inputText });
73
- setInputText("");
74
- onChange("");
75
- }
76
- } else if (inputText.length < 1) {
77
- e.preventDefault();
78
- }
79
- };
80
- const onSecondaryActionButtonClick = (e) => {
81
- if (!secondaryAction) {
82
- return;
83
- }
84
- e.preventDefault();
85
- dispatch("action", __spreadValues({
86
- actionKey: secondaryAction.action
87
- }, secondaryAction));
88
- };
89
- const calculateHeight = (value) => {
90
- if (multiline && inputRef.current) {
91
- const scrollHeight = inputRef.current.scrollHeight;
92
- if (scrollHeight > calculatedLineHeight) {
93
- inputRef.current.style.height = "auto";
94
- let areaHeight = scrollHeight;
95
- if (value.length < 1) {
96
- areaHeight = calculatedLineHeight;
97
- }
98
- inputRef.current.style.height = `${areaHeight}px`;
99
- if (areaHeight >= textareaMaxHeight) {
100
- inputRef.current.style.overflowY = "scroll";
101
- } else {
102
- inputRef.current.style.overflowY = "hidden";
103
- }
104
- }
105
- }
106
- };
107
- const onChange = (value) => {
108
- calculateHeight(value);
109
- setInputText(value);
110
- if (value && value.length > 0) {
111
- dispatch("user-typing", { textLength: value.length });
112
- }
113
- };
114
- if (inputHidden) {
115
- return null;
116
- }
117
- return /* @__PURE__ */ React.createElement(Wrapper$1, {
118
- grow: multiline,
119
- className: appendClassNames("humany-conversation-input", className),
120
- "data-has-focus": inputFocus,
121
- scrollableCss
122
- }, secondaryAction && /* @__PURE__ */ React.createElement(SecondaryActionButton, {
123
- disabled: inputDisabled,
124
- onClick: onSecondaryActionButtonClick,
125
- title: secondaryAction.label,
126
- "aria-label": secondaryAction.label
127
- }, /* @__PURE__ */ React.createElement(SymbolBadge, {
128
- size: 24,
129
- symbol: { type: "Svg", content: secondaryAction.icon || "browse" }
130
- })), multiline ? /* @__PURE__ */ React.createElement(StyledTextArea, {
131
- value: inputText,
132
- onChange,
133
- onEnter: submit,
134
- disabled: inputDisabled,
135
- "aria-label": inputPlaceholder,
136
- placeholder: inputPlaceholder,
137
- onFocusChange: setInputFocus,
138
- type: "textarea",
139
- rows: 1,
140
- ref: inputRef
141
- }) : /* @__PURE__ */ React.createElement(StyledInput, {
142
- value: inputText,
143
- onChange,
144
- onEnter: submit,
145
- disabled: inputDisabled,
146
- "aria-label": inputPlaceholder,
147
- placeholder: inputPlaceholder,
148
- onFocusChange: setInputFocus
149
- }), /* @__PURE__ */ React.createElement(StyledButton$1, {
150
- disabled: inputDisabled,
151
- onClick: submit,
152
- title: sendButtonLabel,
153
- "aria-label": sendButtonLabel
154
- }, /* @__PURE__ */ React.createElement(SendSymbol, {
155
- size: 22,
156
- symbol: { type: "Svg", content: "send" },
157
- hasContent: inputText && inputText.length
158
- })));
159
- };
160
- const StyledTextArea = styled(Input)`
161
- resize: none;
162
- flex: 1;
163
- flex-shrink: 1;
164
- min-height: 1.2em;
165
- max-height: 148px;
166
- line-height: 1.2em;
167
- height: 1.2em;
168
- padding: 0;
169
- margin: calc(${(p) => {
170
- var _a;
171
- return (_a = p.theme.sizes) == null ? void 0 : _a.small;
172
- }} * 2);
173
- font-size: ${(p) => {
174
- var _a;
175
- return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
176
- }};
177
- border: none;
178
- transition: height 200ms linear;
179
- outline: none;
180
- `;
181
- const StyledInput = styled(Input)`
182
- flex: 1;
183
- border: none;
184
- background-color: transparent;
185
- font-weight: 300;
186
- font-size: ${(p) => {
187
- var _a;
188
- return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
189
- }};
190
- line-height: 1.2em;
191
- outline: none;
192
- padding-left: ${(p) => {
193
- var _a;
194
- return (_a = p.theme.sizes) == null ? void 0 : _a.large;
195
- }};
196
- color: ${(p) => {
197
- var _a;
198
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
199
- }};
200
- &::placeholder {
201
- color: ${(p) => {
202
- var _a;
203
- return (_a = p.theme.colors) == null ? void 0 : _a.textLight;
204
- }};
205
- font-style: italic;
206
- }
207
- `;
208
- const StyledButton$1 = styled(Button)`
209
- flex: 0 0 50px;
210
- align-self: stretch;
211
- background-color: transparent;
212
- display: flex;
213
- align-items: center;
214
- justify-content: center;
215
- border: none;
216
- color: #a6a6a6;
217
- &:focus {
218
- ${(p) => {
219
- var _a;
220
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
221
- }};
222
- }
223
- `;
224
- const SecondaryActionButton = styled(StyledButton$1)`
225
- border-right: ${(p) => p.theme.border};
226
- margin: ${(p) => {
227
- var _a;
228
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
229
- }} 0;
230
- `;
231
- const Wrapper$1 = styled.div`
232
- ${(p) => p.grow ? css`
233
- min-height: 50px;
234
- max-height: 150px;
235
- ` : css`
236
- height: 50px;
237
- `}
238
- flex: 0 0 auto;
239
- display: flex;
240
- align-items: center;
241
- background-color: ${(p) => {
242
- var _a;
243
- return (_a = p.theme.colors) == null ? void 0 : _a.accent;
244
- }};
245
- border-top: ${(p) => p.theme.inputBorder};
246
- ${(p) => p["data-has-focus"] && css`
247
- ${(p2) => {
248
- var _a;
249
- return ((_a = p2.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
250
- }};
251
- `}
252
- ${StyledTextArea} {
253
- ${(p) => !!p.scrollableCss && p.scrollableCss}
254
- }
255
- `;
256
- const SendSymbol = styled((_a) => {
257
- var _b = _a, { hasContent } = _b, other = __objRest(_b, ["hasContent"]);
258
- return /* @__PURE__ */ React.createElement(SymbolBadge, __spreadValues({}, other));
259
- })`
260
- line,
261
- path {
262
- stroke: ${(p) => {
263
- var _a;
264
- return p.hasContent ? (_a = p.theme.colors) == null ? void 0 : _a.primary : "#a6a6a6";
265
- }};
266
- fill: ${(p) => {
267
- var _a;
268
- return p.hasContent ? (_a = p.theme.colors) == null ? void 0 : _a.primary : "#a6a6a6";
269
- }};
270
- }
271
- `;
272
- const Avatar = styled.div`
273
- width: ${(p) => p.avatarSize || "32px"};
274
- height: ${(p) => p.avatarSize || "32px"};
275
- border-radius: 50%;
276
- background-color: ${(p) => {
277
- var _a;
278
- return (_a = p.theme.colors) == null ? void 0 : _a.accent;
279
- }};
280
- border: ${(p) => p.theme.border};
281
- grid-area: avatar;
282
- align-self: flex-end;
283
- justify-self: center;
284
- overflow: hidden;
285
- margin-right: ${(p) => {
286
- var _a;
287
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
288
- }};
289
- display: flex;
290
- justify-content: center;
291
- align-items: center;
292
- color: ${(p) => {
293
- var _a;
294
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
295
- }};
296
-
297
- > img {
298
- height: 100%;
299
- width: 100%;
300
- object-fit: cover;
301
- }
302
-
303
- > svg {
304
- width: 90%;
305
- height: 90%;
306
- padding: 10%;
307
- color: ${(p) => {
308
- var _a;
309
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
310
- }};
311
-
312
- line,
313
- path,
314
- circle,
315
- fill {
316
- stroke: ${(p) => {
317
- var _a;
318
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
319
- }};
320
- }
321
- }
322
- `;
323
- const LoaderAnimation = keyframes`
324
- 0% {
325
- opacity: 0;
326
- }
327
- 75% {
328
- opacity: 1;
329
- }
330
- 100% {
331
- opacity: 0;
332
- }
333
- `;
334
- const Loader = styled.div`
335
- display: flex;
336
- justify-content: center;
337
- padding: 0 0 ${(p) => {
338
- var _a;
339
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
340
- }};
341
- > div {
342
- height: 10px;
343
- width: 10px;
344
- border-radius: 50%;
345
- margin: 5px;
346
- background-color: ${(p) => {
347
- var _a;
348
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
349
- }};
350
- animation: ${LoaderAnimation} 1s infinite;
351
- }
352
- > div:nth-child(2) {
353
- animation-delay: 100ms;
354
- }
355
- > div:nth-child(3) {
356
- animation-delay: 200ms;
357
- }
358
- `;
359
- const ContentBundle = styled.div`
360
- grid-area: content;
361
- max-width: 100%;
362
- overflow: hidden;
363
- `;
364
- const MessageTitle = styled(Typography)`
365
- font-size: ${(p) => {
366
- var _a;
367
- return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
368
- }};
369
- font-weight: normal;
370
- margin: 0;
371
- `;
372
- const MessageContainer = styled.div`
373
- display: flex;
374
- justify-content: ${(p) => p.user ? "end" : "start"};
375
- `;
376
- const MessageContent = styled.div`
377
- ${(p) => !p.user && p.stacked && nonUserMessageStyling(p.stacked, p.theme)}
378
- ${(p) => p.user && p.stacked && userMessageStyling(p.stacked, p.theme)}
379
-
380
- display: inline-block;
381
- margin-top: ${(p) => {
382
- var _a;
383
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
384
- }};
385
- && > * {
386
- overflow-wrap: break-word;
387
- word-wrap: break-word;
388
- word-break: break-all;
389
- word-break: break-word;
390
- hyphens: auto;
391
- }
392
- max-width: 100%;
393
- ${(p) => p.fullWidth && "width: 100%;"}
394
- `;
395
- const nonUserMessageStyling = (stacked, theme) => {
396
- var _a, _b;
397
- const colors = css`
398
- background-color: ${(_a = theme.colors) == null ? void 0 : _a.accent};
399
- color: ${(_b = theme.colors) == null ? void 0 : _b.text};
400
- ${theme.border && `border: ${theme.border};`};
401
- `;
402
- if (!theme.borderRadius) {
403
- return colors;
404
- }
405
- return css`
406
- ${colors}
407
-
408
- border-top-right-radius: ${theme.borderRadius};
409
- border-bottom-right-radius: ${theme.borderRadius};
410
-
411
- ${stacked === "first" && `
412
- border-top-left-radius: ${theme.borderRadius};
413
- `}
414
-
415
- ${stacked === "last" && `
416
- border-bottom-left-radius: ${theme.borderRadius};
417
- `}
418
- `;
419
- };
420
- const userMessageStyling = (stacked, theme) => {
421
- var _a, _b;
422
- const colors = css`
423
- background-color: ${(_a = theme.colors) == null ? void 0 : _a.primary};
424
- color: ${(_b = theme.colors) == null ? void 0 : _b.accent};
425
- `;
426
- if (!theme.borderRadius) {
427
- return colors;
428
- }
429
- return css`
430
- ${colors}
431
-
432
- border-top-left-radius: ${theme.borderRadius};
433
- border-bottom-left-radius: ${theme.borderRadius};
434
-
435
- ${stacked === "first" && `
436
- border-top-right-radius: ${theme.borderRadius};
437
- `}
438
-
439
- ${stacked === "last" && `
440
- border-bottom-right-radius: ${theme.borderRadius};
441
- `}
442
- `;
443
- };
444
- const MessageContentPart = styled.div`
445
- margin-bottom: ${(p) => {
446
- var _a;
447
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
448
- }};
449
- &:last-child {
450
- margin-bottom: 0;
451
- }
452
- `;
453
- const messageContentPadding = css`
454
- margin: ${(p) => {
455
- var _a;
456
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
457
- }} 0;
458
- padding: 0 ${(p) => {
459
- var _a;
460
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
461
- }};
462
- `;
463
- const StyledForm = styled(FormComponent)`
464
- margin: ${(p) => {
465
- var _a;
466
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
467
- }} 0;
468
- padding: 0 ${(p) => {
469
- var _a;
470
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
471
- }};
472
- & button.humany-form-component-button {
473
- ${(p) => {
474
- var _a, _b;
475
- return invertedHoverButton({
476
- active: false,
477
- primaryColor: (_a = p.theme.colors) == null ? void 0 : _a.primary,
478
- secondaryColor: (_b = p.theme.colors) == null ? void 0 : _b.accent
479
- });
480
- }};
481
- display: block;
482
- width: 100%;
483
- margin-bottom: ${(p) => {
484
- var _a;
485
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
486
- }};
487
- }
488
- & button.humany-form-component-submit {
489
- width: 100%;
490
- margin: 0;
491
- :not(:last-child) {
492
- margin-bottom: ${(p) => {
493
- var _a;
494
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
495
- }};
496
- }
497
- }
498
- `;
499
- const StyledActionList = styled(List)`
500
- padding: 0;
501
- list-style: none;
502
- button {
503
- font-size: inherit;
504
- }
505
- margin: ${(p) => {
506
- var _a;
507
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
508
- }} 0;
509
- padding: 0 ${(p) => {
510
- var _a;
511
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
512
- }};
513
- display: flex;
514
- gap: ${(p) => {
515
- var _a;
516
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
517
- }};
518
- `;
519
- const StyledActionButton = styled.button`
520
- ${buttonCss};
521
- display: block;
522
- background-color: ${(p) => {
523
- var _a;
524
- return (_a = p.theme.colors) == null ? void 0 : _a.primary;
525
- }};
526
- width: 100%;
527
- color: #fff;
528
- margin: ${(p) => {
529
- var _a;
530
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
531
- }} 0;
532
- padding: 0 ${(p) => {
533
- var _a;
534
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
535
- }};
536
- font-family: Lato;
537
- font-size: ${(p) => {
538
- var _a;
539
- return (_a = p.theme.fonts) == null ? void 0 : _a.huge;
540
- }};
541
- font-weight: 300;
542
- &:focus {
543
- ${(p) => {
544
- var _a;
545
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
546
- ${borderTabStyle}
547
- background-color: transparent;
548
- `;
549
- }}
550
- }
551
- `;
552
- const ConversationLoader = forwardRef(({ className, agentData }, ref) => {
553
- return /* @__PURE__ */ React.createElement(ContentBundle, {
554
- ref
555
- }, /* @__PURE__ */ React.createElement(MessageContainer, null, /* @__PURE__ */ React.createElement(MessageContent, null, /* @__PURE__ */ React.createElement(Loader, null, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement("div", null)))));
556
- });
557
- const Html = ({ body }) => {
558
- return /* @__PURE__ */ React.createElement(StyledHtml, {
559
- html: body
560
- });
561
- };
562
- const StyledHtml = styled(Html$1)`
563
- ${genericHtml}
564
- color: inherit;
565
- white-space: pre-wrap;
566
- ${messageContentPadding}
567
- a {
568
- color: ${(p) => p.theme.colors.link};
569
- &:focus {
570
- ${(p) => {
571
- var _a;
572
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
573
- }};
574
- }
575
- }
576
- `;
577
- const StyledTimestamp = styled.p`
578
- && {
579
- font-size: ${(p) => {
580
- var _a;
581
- return (_a = p.theme.fonts) == null ? void 0 : _a.small;
582
- }};
583
- font-weight: 300;
584
- }
585
- padding-top: ${(p) => {
586
- var _a;
587
- return (_a = p.theme.sizes) == null ? void 0 : _a.small;
588
- }};
589
- margin: 0;
590
- line-height: 1.5em;
591
- grid-area: info;
592
- color: ${(p) => {
593
- var _a;
594
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
595
- }};
596
- `;
597
- const getTimestamp = (raw) => {
598
- return new Date(raw).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
599
- };
600
- const Timestamp = ({ className, name, timestamp }) => {
601
- if (!name && !timestamp) {
602
- return null;
603
- }
604
- let output = "";
605
- if (name) {
606
- if (timestamp) {
607
- output = `${name}: ${getTimestamp(timestamp)}`;
608
- } else {
609
- output = name;
610
- }
611
- } else if (timestamp) {
612
- output = getTimestamp(timestamp);
613
- }
614
- return /* @__PURE__ */ React.createElement(StyledTimestamp, null, output);
615
- };
616
- const AgentMessage = ({ className, children, sender, timestamp }) => {
617
- const { avatar, name } = sender;
618
- const { avatarSize } = useProperties();
619
- return /* @__PURE__ */ React.createElement(StyledAgentMessage, {
620
- hasAvatar: !!avatar,
621
- className: appendClassNames(className, "humany-conversation-agent-message")
622
- }, avatar && /* @__PURE__ */ React.createElement(Avatar, {
623
- avatarSize
624
- }, typeof avatar === "string" ? /* @__PURE__ */ React.createElement("img", {
625
- src: avatar
626
- }) : /* @__PURE__ */ React.createElement(SymbolBadge, {
627
- symbol: avatar
628
- })), children, /* @__PURE__ */ React.createElement(Timestamp, {
629
- name,
630
- timestamp
631
- }));
632
- };
633
- const StyledAgentMessage = styled.div`
634
- display: grid;
635
- margin-right: 10%;
636
- width: 90%;
637
- ${(p) => p.hasAvatar ? css`
638
- grid-template-columns: auto 1fr;
639
- grid-template-rows: 1fr auto;
640
- grid-template-areas:
641
- 'avatar content'
642
- '. info';
643
- ` : css`
644
- grid-template-columns: 1fr;
645
- grid-template-rows: 1fr auto;
646
- grid-template-areas:
647
- 'content'
648
- 'info';
649
- `};
650
- `;
651
- const SystemMessage = ({
652
- className,
653
- children,
654
- timestamp,
655
- discrete,
656
- fullWidth
657
- }) => {
658
- return /* @__PURE__ */ React.createElement(StyledSystemMessage, {
659
- className: appendClassNames(className, "humany-conversation-system-message"),
660
- fullWidth
661
- }, discrete ? /* @__PURE__ */ React.createElement(Discrete, {
662
- className: "humany-conversation-discrete-message"
663
- }, children, /* @__PURE__ */ React.createElement(Timestamp, {
664
- timestamp
665
- })) : /* @__PURE__ */ React.createElement(React.Fragment, null, children, /* @__PURE__ */ React.createElement(Timestamp, {
666
- timestamp
667
- })));
668
- };
669
- const StyledSystemMessage = styled.div`
670
- ${(p) => p.fullWidth && "width: 100%"};
671
- padding: 0 ${(p) => {
672
- var _a;
673
- return (_a = p.theme.sizes) == null ? void 0 : _a.large;
674
- }};
675
- overflow: auto;
676
- `;
677
- const Discrete = styled.div`
678
- text-align: center;
679
- word-wrap: break-word;
680
- font-size: ${(p) => {
681
- var _a;
682
- return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
683
- }};
684
- color: ${(p) => {
685
- var _a;
686
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
687
- }};
688
- > p {
689
- margin: 0;
690
- }
691
- `;
692
- const UserMessage = ({ className, children, timestamp }) => {
693
- const { userLabel = "" } = useProperties();
694
- return /* @__PURE__ */ React.createElement(StyledUserMessage, {
695
- className: appendClassNames(className, "humany-conversation-user-message")
696
- }, children, /* @__PURE__ */ React.createElement(Timestamp, {
697
- name: userLabel,
698
- timestamp
699
- }));
700
- };
701
- const StyledUserMessage = styled.div`
702
- margin-left: 10%;
703
- width: 90%;
704
- display: flex;
705
- flex-direction: column;
706
- align-items: flex-end;
707
- `;
708
- const mapActions = (actions) => Array.isArray(actions) ? actions : Object.keys(actions).map((i) => {
709
- return {
710
- label: actions[i],
711
- actionKey: i
712
- };
713
- });
714
- const ButtonList = ({ header, actions, dispatch }) => {
715
- return /* @__PURE__ */ React.createElement(StyledButtonList, {
716
- header,
717
- items: mapActions(actions),
718
- renderItem: (item) => {
719
- return /* @__PURE__ */ React.createElement("li", {
720
- key: item.actionKey
721
- }, /* @__PURE__ */ React.createElement(StyledButtonListButton, {
722
- onClick: () => {
723
- dispatch("action", item);
724
- },
725
- "aria-label": item.label,
726
- title: item.label
727
- }, /* @__PURE__ */ React.createElement(SymbolBadge, {
728
- symbol: item.symbol
729
- }), item.label));
730
- }
731
- });
732
- };
733
- const StyledButtonList = styled(ItemList)`
734
- ${itemList}
735
- > ul {
736
- display: flex;
737
- flex-wrap: wrap;
738
- gap: ${(p) => {
739
- var _a;
740
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
741
- }};
742
- > li {
743
- margin: 0;
744
- }
745
- }
746
- ${messageContentPadding}
747
- `;
748
- const StyledButtonListButton = styled(Button)`
749
- ${buttonCss};
750
-
751
- display: block;
752
- padding: ${(p) => {
753
- var _a;
754
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
755
- }};
756
- background-color: ${(p) => {
757
- var _a;
758
- return (_a = p.theme.colors) == null ? void 0 : _a.primary;
759
- }};
760
- width: 100%;
761
- color: #ffffff;
762
- &:focus {
763
- ${(p) => {
764
- var _a;
765
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
766
- ${borderTabStyle}
767
- background-color: transparent;
768
- `;
769
- }}
770
- }
771
-
772
- i,
773
- svg {
774
- margin-right: ${(p) => {
775
- var _a;
776
- return (_a = p.theme.sizes) == null ? void 0 : _a.small;
777
- }};
778
- }
779
- `;
780
- const Custom = ({ type, content = {} }) => {
781
- const Component = useComponent(type);
782
- if (!Component || !type) {
783
- return null;
784
- }
785
- return /* @__PURE__ */ React.createElement(Suspense, {
786
- fallback: null
787
- }, /* @__PURE__ */ React.createElement(Component, __spreadValues({}, content)));
788
- };
789
- const LinkList = ({ header, actions, dispatch }) => {
790
- return /* @__PURE__ */ React.createElement(StyledLinkList, {
791
- header,
792
- items: mapActions(actions),
793
- renderItem: (item) => {
794
- return /* @__PURE__ */ React.createElement("li", {
795
- key: item.actionKey
796
- }, /* @__PURE__ */ React.createElement(StyledLinkButton, {
797
- help: item.actionKey === "help",
798
- onClick: () => {
799
- dispatch("action", item);
800
- },
801
- "aria-label": item.label,
802
- title: item.label
803
- }, item.label, item.actionKey === "help" && /* @__PURE__ */ React.createElement(SymbolBadge, {
804
- size: 14,
805
- symbol: {
806
- type: "Svg",
807
- content: "caret-down"
808
- }
809
- })));
810
- }
811
- });
812
- };
813
- const StyledLinkList = styled(ItemList)`
814
- ${itemList}
815
- ${messageContentPadding}
816
- > ul {
817
- display: flex;
818
- flex-direction: column;
819
- gap: ${(p) => {
820
- var _a;
821
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
822
- }};
823
- > li {
824
- margin: 0;
825
- }
826
- }
827
- `;
828
- const StyledLinkButton = styled(Button)`
829
- display: block;
830
- text-align: left;
831
- font-weight: 300;
832
- color: ${(p) => {
833
- var _a;
834
- return (_a = p.theme.colors) == null ? void 0 : _a.primary;
835
- }};
836
- max-width: 100%;
837
- text-overflow: ellipsis;
838
- overflow: hidden;
839
-
840
- ${(p) => {
841
- var _a, _b;
842
- return p.help && css`
843
- color: ${(_a = p.theme.colors) == null ? void 0 : _a.text};
844
- text-decoration: underline;
845
-
846
- i,
847
- svg {
848
- margin-left: ${(_b = p.theme.sizes) == null ? void 0 : _b.small};
849
- }
850
- `;
851
- }}
852
-
853
- &:focus {
854
- ${(p) => {
855
- var _a, _b;
856
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
857
- ${borderTabStyle}
858
- span {
859
- color: ${(_b = p.theme.colors) == null ? void 0 : _b.primary};
860
- text-decoration: underline;
861
- }
862
- `;
863
- }};
864
- }
865
- `;
866
- const Separator = () => {
867
- return /* @__PURE__ */ React.createElement(StyledSeparator, null);
868
- };
869
- const StyledSeparator = styled.div`
870
- ${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}
871
- width: 100%;
872
- `;
873
- const Text = ({ text }) => {
874
- return /* @__PURE__ */ React.createElement(StyledTypography, {
875
- variant: "span"
876
- }, text);
877
- };
878
- const StyledTypography = styled(Typography)`
879
- ${messageContentPadding}
880
- `;
881
- const VideoRequest = ({
882
- header = "Video call",
883
- acceptLabel = "Accept",
884
- declineLabel = "Decline",
885
- dispatch
886
- }) => {
887
- const actions = useMemo(() => {
888
- return [
889
- {
890
- label: acceptLabel,
891
- actionKey: "accept-video-call",
892
- symbol: {
893
- type: "Svg",
894
- content: "video"
895
- }
896
- },
897
- {
898
- label: declineLabel,
899
- actionKey: "decline-video-call",
900
- symbol: {
901
- type: "Svg",
902
- content: "close"
903
- }
904
- }
905
- ];
906
- }, [acceptLabel, declineLabel]);
907
- return /* @__PURE__ */ React.createElement(StyledItemList, {
908
- header,
909
- items: actions,
910
- renderItem: (item) => {
911
- const bgColor = item.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
912
- return /* @__PURE__ */ React.createElement("li", {
913
- key: item.actionKey
914
- }, /* @__PURE__ */ React.createElement(StyledButton, {
915
- onClick: () => {
916
- dispatch("action", item);
917
- },
918
- "aria-label": item.label,
919
- title: item.label,
920
- bgColor
921
- }, /* @__PURE__ */ React.createElement(SymbolBadge, {
922
- symbol: item.symbol,
923
- size: 25
924
- })));
925
- }
926
- });
927
- };
928
- const StyledItemList = styled(ItemList)`
929
- ${itemList}
930
- > ul {
931
- display: flex;
932
- flex-wrap: wrap;
933
- gap: ${(p) => {
934
- var _a;
935
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
936
- }};
937
- > li {
938
- margin: 0;
939
- }
940
- }
941
- ${messageContentPadding}
942
- `;
943
- const StyledButton = styled(Button)`
944
- ${buttonCss};
945
-
946
- background-color: ${(p) => p.bgColor};
947
- display: flex;
948
- justify-content: center;
949
- align-items: center;
950
- color: #ffffff;
951
- width: 46px;
952
- height: 46px;
953
- border-radius: 100%;
954
-
955
- &:focus {
956
- ${(p) => {
957
- var _a;
958
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
959
- ${borderTabStyle}
960
- background-color: transparent;
961
-
962
- i,
963
- svg {
964
- color: ${(p2) => {
965
- var _a2;
966
- return (_a2 = p2.theme.colors) == null ? void 0 : _a2.primary;
967
- }};
968
-
969
- path {
970
- stroke: ${(p2) => {
971
- var _a2;
972
- return (_a2 = p2.theme.colors) == null ? void 0 : _a2.primary;
973
- }};
974
- }
975
- }
976
- `;
977
- }}
978
- }
979
-
980
- i,
981
- svg {
982
- color: #fff;
983
-
984
- path {
985
- stroke: #fff;
986
- }
987
- }
988
- `;
989
- const mapItem = ([type, content]) => {
990
- return { type, content, id: uuid() };
991
- };
992
- const MessageList = ({ items, dispatch }) => {
993
- return /* @__PURE__ */ React.createElement(StyledList, {
994
- items: items.map(mapItem),
995
- renderLi: true,
996
- renderItem: (item) => {
997
- switch (item.type) {
998
- case ConversationMessageListItemType.Text: {
999
- return /* @__PURE__ */ React.createElement(Text, {
1000
- text: item.content
1001
- });
1002
- }
1003
- case ConversationMessageListItemType.HTML: {
1004
- return /* @__PURE__ */ React.createElement(Html, __spreadValues({}, item.content));
1005
- }
1006
- case ConversationMessageListItemType.Separator: {
1007
- return /* @__PURE__ */ React.createElement(Separator, __spreadValues({}, item.content));
1008
- }
1009
- case ConversationMessageListItemType.LinkList: {
1010
- return /* @__PURE__ */ React.createElement(LinkList, __spreadProps(__spreadValues({}, item.content), {
1011
- dispatch
1012
- }));
1013
- }
1014
- case ConversationMessageListItemType.ButtonList: {
1015
- return /* @__PURE__ */ React.createElement(ButtonList, __spreadProps(__spreadValues({}, item.content), {
1016
- dispatch
1017
- }));
1018
- }
1019
- case ConversationMessageListItemType.VideoRequest: {
1020
- return /* @__PURE__ */ React.createElement(VideoRequest, __spreadProps(__spreadValues({}, item.content), {
1021
- dispatch
1022
- }));
1023
- }
1024
- default: {
1025
- return /* @__PURE__ */ React.createElement(Custom, {
1026
- type: item.type,
1027
- content: item.content
1028
- });
1029
- }
1030
- }
1031
- }
1032
- });
1033
- };
1034
- const StyledList = styled(List)`
1035
- ${list}
1036
-
1037
- > li {
1038
- margin: 0;
1039
- }
1040
- `;
1041
- const ConversationMessage = ({
1042
- className,
1043
- timestamp,
1044
- sender,
1045
- type,
1046
- content
1047
- }) => {
1048
- const getMessageStackPosition = useCallback((index) => {
1049
- let messageOrder = "first";
1050
- if (content.length > 1) {
1051
- messageOrder = index === 0 ? "first" : index + 1 === content.length ? "last" : "middle";
1052
- }
1053
- return messageOrder;
1054
- }, [content]);
1055
- const createSystemMessage = () => {
1056
- return /* @__PURE__ */ React.createElement(React.Fragment, null, content.map((item) => {
1057
- const { key, body, title, form, actions } = item;
1058
- const discrete = !!body && !title && !form && !actions;
1059
- return /* @__PURE__ */ React.createElement(SystemMessage, {
1060
- className,
1061
- key,
1062
- discrete,
1063
- timestamp,
1064
- fullWidth: !!form || !!actions
1065
- }, discrete && body ? /* @__PURE__ */ React.createElement(Html, {
1066
- body
1067
- }) : /* @__PURE__ */ React.createElement(Message, {
1068
- content: item,
1069
- isUser: false
1070
- }));
1071
- }));
1072
- };
1073
- const createAgentMessage = () => {
1074
- return /* @__PURE__ */ React.createElement(AgentMessage, {
1075
- sender,
1076
- timestamp,
1077
- className
1078
- }, /* @__PURE__ */ React.createElement(ContentBundle, null, content.map((item, index) => {
1079
- return /* @__PURE__ */ React.createElement(MessageContainer, {
1080
- key: item.key
1081
- }, /* @__PURE__ */ React.createElement(Message, {
1082
- content: item,
1083
- isUser: false,
1084
- stacked: getMessageStackPosition(index)
1085
- }));
1086
- })));
1087
- };
1088
- const createUserMessage = () => {
1089
- return /* @__PURE__ */ React.createElement(UserMessage, {
1090
- timestamp,
1091
- className
1092
- }, /* @__PURE__ */ React.createElement(ContentBundle, null, content.map((item, index) => {
1093
- return /* @__PURE__ */ React.createElement(MessageContainer, {
1094
- user: true,
1095
- key: item.key
1096
- }, /* @__PURE__ */ React.createElement(Message, {
1097
- content: item,
1098
- isUser: true,
1099
- stacked: getMessageStackPosition(index)
1100
- }));
1101
- })));
1102
- };
1103
- switch (type) {
1104
- case ConversationMessageType.System:
1105
- return createSystemMessage();
1106
- case ConversationMessageType.Agent:
1107
- return createAgentMessage();
1108
- case ConversationMessageType.User:
1109
- return createUserMessage();
1110
- default:
1111
- return null;
1112
- }
1113
- };
1114
- const Message = ({ content, isUser, stacked }) => {
1115
- const dispatch = useDispatch();
1116
- const { title, body, actions, form, items } = content;
1117
- return /* @__PURE__ */ React.createElement(MessageContent, {
1118
- user: isUser,
1119
- stacked,
1120
- fullWidth: !!form || !!actions
1121
- }, title && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(MessageTitle, {
1122
- variant: "h2"
1123
- }, title)), body && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(Html, {
1124
- body
1125
- })), form && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(StyledForm, __spreadProps(__spreadValues({}, form), {
1126
- onChange: (key, data) => {
1127
- dispatch("form", {
1128
- data,
1129
- formKey: form.schema.id,
1130
- actionKey: key
1131
- });
1132
- }
1133
- }))), actions && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(StyledActionList, {
1134
- items: Object.keys(actions).map((i) => {
1135
- return { label: actions[i], actionKey: i };
1136
- }),
1137
- renderItem: (item) => {
1138
- return /* @__PURE__ */ React.createElement("li", {
1139
- key: item.actionKey
1140
- }, /* @__PURE__ */ React.createElement(StyledActionButton, {
1141
- onClick: () => {
1142
- dispatch("action", item.actionKey);
1143
- }
1144
- }, item.label));
1145
- }
1146
- })), items && /* @__PURE__ */ React.createElement(MessageList, {
1147
- key: uuid(),
1148
- items,
1149
- dispatch
1150
- }));
1151
- };
1152
- const ConversationContent = () => {
1153
- const lastEntry = useRef(null);
1154
- const [scrollableCss, viewElem] = useScroll(true);
1155
- const {
1156
- messages,
1157
- loading,
1158
- typingActors = []
1159
- } = useProperties();
1160
- const scrollView = useCallback(() => {
1161
- if (lastEntry.current) {
1162
- lastEntry.current.scrollIntoView({
1163
- block: "end",
1164
- behavior: "smooth"
1165
- });
1166
- }
1167
- }, [lastEntry]);
1168
- useEffect(() => {
1169
- const handler = setTimeout(scrollView, 250);
1170
- return () => clearTimeout(handler);
1171
- }, [messages, typingActors]);
1172
- const isLoadingOrTyping = useMemo(() => {
1173
- return !!typingActors.length || loading;
1174
- }, [typingActors, loading]);
1175
- const renderTypingActors = () => {
1176
- if (typingActors && typingActors.length) {
1177
- return typingActors.map((actor, index) => {
1178
- const isLast = index === typingActors.length - 1;
1179
- return /* @__PURE__ */ React.createElement(MessageEntry, {
1180
- id: `typing_${actor.name}`,
1181
- ref: loading ? null : isLast ? lastEntry : null,
1182
- key: `typing_${actor.name}`
1183
- }, /* @__PURE__ */ React.createElement(AgentMessage, {
1184
- timestamp: Date.now(),
1185
- sender: actor
1186
- }, /* @__PURE__ */ React.createElement(ConversationLoader, null)));
1187
- });
1188
- }
1189
- return null;
1190
- };
1191
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Scrollable, {
1192
- tabIndex: 0,
1193
- scrollableCss,
1194
- ref: viewElem
1195
- }, messages && messages.length ? messages.map((message, index) => {
1196
- const { type, timestamp, sender, content } = message;
1197
- const isLast = index === messages.length - 1;
1198
- return /* @__PURE__ */ React.createElement(MessageEntry, {
1199
- className: "humany-conversation-entry",
1200
- tabIndex: -1,
1201
- key: `${type}_${sender == null ? void 0 : sender.name}_${timestamp}_${content[0].key}`,
1202
- ref: isLoadingOrTyping ? null : isLast ? lastEntry : null
1203
- }, /* @__PURE__ */ React.createElement(ConversationMessage, __spreadValues({}, message)));
1204
- }) : null, renderTypingActors(), loading && /* @__PURE__ */ React.createElement(MessageEntry, null, /* @__PURE__ */ React.createElement(ConversationLoader, {
1205
- ref: lastEntry
1206
- }))), /* @__PURE__ */ React.createElement(ConversationInput, null));
1207
- };
1208
- const Scrollable = styled.div`
1209
- display: flex;
1210
- flex-direction: column;
1211
- align-items: stretch;
1212
- flex: 0 1 100%;
1213
- padding: 0 ${(p) => {
1214
- var _a;
1215
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
1216
- }};
1217
- ${(p) => !!p.scrollableCss && p.scrollableCss};
1218
- &:focus {
1219
- ${(p) => {
1220
- var _a;
1221
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
1222
- }};
1223
- }
1224
- `;
1225
- const MessageEntry = styled.div`
1226
- margin: 0;
1227
- margin-bottom: ${(p) => {
1228
- var _a;
1229
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
1230
- }};
1231
-
1232
- &:first-of-type {
1233
- margin-top: ${(p) => {
1234
- var _a;
1235
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
1236
- }};
1237
- }
1238
-
1239
- &:last-of-type {
1240
- padding-bottom: ${(p) => {
1241
- var _a;
1242
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
1243
- }};
1244
- }
1245
-
1246
- & span,
1247
- p,
1248
- a,
1249
- div {
1250
- font-weight: 300;
1251
- }
1252
-
1253
- & b,
1254
- h1 {
1255
- font-weight: normal;
1256
- }
1257
-
1258
- ${headingElement("h1", css`
1259
- font-weight: normal;
1260
- `)}
1261
- `;
1262
- const OverlayOutlet = ({ dispatch }) => {
1263
- const wrapperRef = useRef(null);
1264
- useEffect(() => {
1265
- if (wrapperRef.current && wrapperRef.current.parentNode) {
1266
- dispatch("overlay-mounted", wrapperRef.current);
1267
- }
1268
- }, [wrapperRef]);
1269
- return /* @__PURE__ */ React.createElement(WidgetOverlayOutlet, {
1270
- portalId: "humany-conversation-overlay-portal",
1271
- className: "humany-conversation-overlay-outlet",
1272
- ref: wrapperRef
1273
- });
1274
- };
1275
- const ConversationOverlayOutlet = ({
1276
- dispatch,
1277
- header,
1278
- buttonLabel
1279
- }) => {
1280
- return /* @__PURE__ */ React.createElement(StyledWidgetOverlayOutlet, {
1281
- portalId: "humany-conversation-portal",
1282
- className: "humany-conversation-outlet"
1283
- }, /* @__PURE__ */ React.createElement(ConversationOverlayHead, {
1284
- className: "humany-conversation-outlet-head"
1285
- }, /* @__PURE__ */ React.createElement(ConversationOverlayHeadButton, {
1286
- className: "humany-conversation-outlet-head-button",
1287
- "aria-label": buttonLabel,
1288
- title: buttonLabel,
1289
- onClick: () => dispatch("hide-overlay-conversation")
1290
- }, /* @__PURE__ */ React.createElement(SymbolBadge, {
1291
- symbol: {
1292
- type: "Svg",
1293
- content: "caret-down"
1294
- },
1295
- size: 20
1296
- })), header && /* @__PURE__ */ React.createElement(ConversationOverlayHeader, {
1297
- className: "humany-conversation-outlet-header",
1298
- variant: "h1"
1299
- }, header)), /* @__PURE__ */ React.createElement(ConversationContent, null));
1300
- };
1301
- const StyledWidgetOverlayOutlet = styled(WidgetOverlayOutlet)`
1302
- z-index: 11;
1303
- top: auto;
1304
- height: 65%;
1305
- background-color: #ffffff;
1306
- display: flex;
1307
- flex-direction: column;
1308
- border-top-right-radius: ${(p) => {
1309
- var _a;
1310
- return (_a = p.theme.sizes) == null ? void 0 : _a.large;
1311
- }};
1312
- border-top-left-radius: ${(p) => {
1313
- var _a;
1314
- return (_a = p.theme.sizes) == null ? void 0 : _a.large;
1315
- }};
1316
- `;
1317
- const ConversationOverlayHead = styled.div`
1318
- display: flex;
1319
- flex-direction: column;
1320
- justify-content: center;
1321
- align-items: center;
1322
- gap: ${(p) => {
1323
- var _a;
1324
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
1325
- }};
1326
- padding: ${(p) => {
1327
- var _a;
1328
- return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
1329
- }};
1330
- ${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}
1331
- `;
1332
- const ConversationOverlayHeader = styled(Typography)`
1333
- font-size: ${(p) => {
1334
- var _a;
1335
- return (_a = p.theme.fonts) == null ? void 0 : _a.medium;
1336
- }};
1337
- color: ${(p) => {
1338
- var _a;
1339
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
1340
- }};
1341
- margin: 0;
1342
- `;
1343
- const ConversationOverlayHeadButton = styled(Button)`
1344
- display: flex;
1345
- align-items: center;
1346
- justify-content: center;
1347
- padding: ${(p) => {
1348
- var _a;
1349
- return (_a = p.theme.sizes) == null ? void 0 : _a.small;
1350
- }} ${(p) => {
1351
- var _a;
1352
- return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
1353
- }};
1354
- ${(p) => p.theme.borderRadius && `border-radius: ${p.theme.borderRadius};`}
1355
-
1356
- &:focus {
1357
- ${(p) => {
1358
- var _a;
1359
- return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
1360
- }};
1361
- }
1362
-
1363
- svg line {
1364
- stroke: ${(p) => {
1365
- var _a;
1366
- return (_a = p.theme.colors) == null ? void 0 : _a.text;
1367
- }};
1368
- }
1369
- `;
1370
- const Conversation = ({ className }) => {
1371
- const {
1372
- overlay,
1373
- overlayConversationHeader,
1374
- overlayConversationCloseLabel
1375
- } = useProperties();
1376
- const dispatch = useDispatch();
1377
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Wrapper, {
1378
- className: appendClassNames(className, "humany-conversation-component")
1379
- }, /* @__PURE__ */ React.createElement(ConversationContent, null)), overlay && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(OverlayOutlet, {
1380
- dispatch
1381
- }), overlay.conversation && /* @__PURE__ */ React.createElement(ConversationOverlayOutlet, {
1382
- dispatch,
1383
- header: overlayConversationHeader,
1384
- buttonLabel: overlayConversationCloseLabel
1385
- })));
1386
- };
1387
- const Wrapper = styled.div`
1388
- position: absolute;
1389
- right: 0;
1390
- left: 0;
1391
- bottom: 0;
1392
- top: 0;
1393
- overflow: hidden;
1394
- display: flex;
1395
- flex-direction: column;
1396
- `;
1397
- export { Conversation as default };
1398
- //# sourceMappingURL=conversation.js.map