@telia-ace/widget-conversation 1.0.21 → 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.
- package/README.md +105 -22
- package/dist/components/conversation/ui/loader.d.ts +1 -1
- package/dist/conversation.edf14596.js +1191 -0
- package/dist/conversation.edf14596.js.map +1 -0
- package/dist/index.js +450 -760
- package/dist/index.js.map +1 -1
- package/dist/return-button.facf6a45.js +159 -0
- package/dist/return-button.facf6a45.js.map +1 -0
- package/package.json +13 -9
- package/dist/conversation.js +0 -1415
- package/dist/conversation.js.map +0 -1
- package/dist/return-button.js +0 -174
- package/dist/return-button.js.map +0 -1
package/dist/conversation.js
DELETED
|
@@ -1,1415 +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, Lightbox, ItemList, itemList, useComponent, list, headingElement, usePrevious, useTransitionEnd, WidgetOverlayOutlet } from "@telia-ace/widget-ui";
|
|
33
|
-
import { appendClassNames, uuid } from "@telia-ace/widget-utilities";
|
|
34
|
-
import React, { useState, useEffect, 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
|
-
> div {
|
|
338
|
-
height: 10px;
|
|
339
|
-
width: 10px;
|
|
340
|
-
border-radius: 50%;
|
|
341
|
-
margin: 5px;
|
|
342
|
-
background-color: ${(p) => {
|
|
343
|
-
var _a;
|
|
344
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
345
|
-
}};
|
|
346
|
-
animation: ${LoaderAnimation} 1s infinite;
|
|
347
|
-
}
|
|
348
|
-
> div:nth-child(2) {
|
|
349
|
-
animation-delay: 100ms;
|
|
350
|
-
}
|
|
351
|
-
> div:nth-child(3) {
|
|
352
|
-
animation-delay: 200ms;
|
|
353
|
-
}
|
|
354
|
-
`;
|
|
355
|
-
const ContentBundle = styled.div`
|
|
356
|
-
grid-area: content;
|
|
357
|
-
max-width: 100%;
|
|
358
|
-
`;
|
|
359
|
-
const MessageTitle = styled(Typography)`
|
|
360
|
-
font-size: ${(p) => {
|
|
361
|
-
var _a;
|
|
362
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
363
|
-
}};
|
|
364
|
-
font-weight: normal;
|
|
365
|
-
margin: 0;
|
|
366
|
-
`;
|
|
367
|
-
const MessageContainer = styled.div`
|
|
368
|
-
display: flex;
|
|
369
|
-
justify-content: ${(p) => p.user ? "end" : "start"};
|
|
370
|
-
`;
|
|
371
|
-
const MessageContent = styled.div`
|
|
372
|
-
${(p) => !p.user && p.stacked && nonUserMessageStyling(p.stacked, p.theme)}
|
|
373
|
-
${(p) => p.user && p.stacked && userMessageStyling(p.stacked, p.theme)}
|
|
374
|
-
|
|
375
|
-
display: inline-block;
|
|
376
|
-
margin-top: ${(p) => {
|
|
377
|
-
var _a;
|
|
378
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
379
|
-
}};
|
|
380
|
-
&& > * {
|
|
381
|
-
overflow-wrap: break-word;
|
|
382
|
-
word-wrap: break-word;
|
|
383
|
-
word-break: break-all;
|
|
384
|
-
word-break: break-word;
|
|
385
|
-
hyphens: auto;
|
|
386
|
-
}
|
|
387
|
-
max-width: 100%;
|
|
388
|
-
${(p) => p.fullWidth && "width: 100%;"}
|
|
389
|
-
`;
|
|
390
|
-
const nonUserMessageStyling = (stacked, theme) => {
|
|
391
|
-
var _a, _b;
|
|
392
|
-
const colors = css`
|
|
393
|
-
background-color: ${(_a = theme.colors) == null ? void 0 : _a.accent};
|
|
394
|
-
color: ${(_b = theme.colors) == null ? void 0 : _b.text};
|
|
395
|
-
${theme.border && `border: ${theme.border};`};
|
|
396
|
-
`;
|
|
397
|
-
if (!theme.borderRadius) {
|
|
398
|
-
return colors;
|
|
399
|
-
}
|
|
400
|
-
return css`
|
|
401
|
-
${colors}
|
|
402
|
-
|
|
403
|
-
border-top-right-radius: ${theme.borderRadius};
|
|
404
|
-
border-bottom-right-radius: ${theme.borderRadius};
|
|
405
|
-
|
|
406
|
-
${stacked === "first" && `
|
|
407
|
-
border-top-left-radius: ${theme.borderRadius};
|
|
408
|
-
`}
|
|
409
|
-
|
|
410
|
-
${stacked === "last" && `
|
|
411
|
-
border-bottom-left-radius: ${theme.borderRadius};
|
|
412
|
-
`}
|
|
413
|
-
`;
|
|
414
|
-
};
|
|
415
|
-
const userMessageStyling = (stacked, theme) => {
|
|
416
|
-
var _a, _b;
|
|
417
|
-
const colors = css`
|
|
418
|
-
background-color: ${(_a = theme.colors) == null ? void 0 : _a.primary};
|
|
419
|
-
color: ${(_b = theme.colors) == null ? void 0 : _b.accent};
|
|
420
|
-
`;
|
|
421
|
-
if (!theme.borderRadius) {
|
|
422
|
-
return colors;
|
|
423
|
-
}
|
|
424
|
-
return css`
|
|
425
|
-
${colors}
|
|
426
|
-
|
|
427
|
-
border-top-left-radius: ${theme.borderRadius};
|
|
428
|
-
border-bottom-left-radius: ${theme.borderRadius};
|
|
429
|
-
|
|
430
|
-
${stacked === "first" && `
|
|
431
|
-
border-top-right-radius: ${theme.borderRadius};
|
|
432
|
-
`}
|
|
433
|
-
|
|
434
|
-
${stacked === "last" && `
|
|
435
|
-
border-bottom-right-radius: ${theme.borderRadius};
|
|
436
|
-
`}
|
|
437
|
-
`;
|
|
438
|
-
};
|
|
439
|
-
const MessageContentPart = styled.div`
|
|
440
|
-
margin-bottom: ${(p) => {
|
|
441
|
-
var _a;
|
|
442
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
443
|
-
}};
|
|
444
|
-
&:last-child {
|
|
445
|
-
margin-bottom: 0;
|
|
446
|
-
}
|
|
447
|
-
`;
|
|
448
|
-
const messageContentPadding = css`
|
|
449
|
-
margin: ${(p) => {
|
|
450
|
-
var _a;
|
|
451
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
452
|
-
}} 0;
|
|
453
|
-
padding: 0 ${(p) => {
|
|
454
|
-
var _a;
|
|
455
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
456
|
-
}};
|
|
457
|
-
`;
|
|
458
|
-
const StyledForm = styled(FormComponent)`
|
|
459
|
-
margin: ${(p) => {
|
|
460
|
-
var _a;
|
|
461
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
462
|
-
}} 0;
|
|
463
|
-
padding: 0 ${(p) => {
|
|
464
|
-
var _a;
|
|
465
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
466
|
-
}};
|
|
467
|
-
& button.humany-form-component-button {
|
|
468
|
-
${(p) => {
|
|
469
|
-
var _a, _b;
|
|
470
|
-
return invertedHoverButton({
|
|
471
|
-
active: false,
|
|
472
|
-
primaryColor: (_a = p.theme.colors) == null ? void 0 : _a.primary,
|
|
473
|
-
secondaryColor: (_b = p.theme.colors) == null ? void 0 : _b.accent
|
|
474
|
-
});
|
|
475
|
-
}};
|
|
476
|
-
display: block;
|
|
477
|
-
width: 100%;
|
|
478
|
-
margin-bottom: ${(p) => {
|
|
479
|
-
var _a;
|
|
480
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
481
|
-
}};
|
|
482
|
-
}
|
|
483
|
-
& button.humany-form-component-submit {
|
|
484
|
-
width: 100%;
|
|
485
|
-
margin: 0;
|
|
486
|
-
:not(:last-child) {
|
|
487
|
-
margin-bottom: ${(p) => {
|
|
488
|
-
var _a;
|
|
489
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
490
|
-
}};
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
`;
|
|
494
|
-
const StyledActionList = styled(List)`
|
|
495
|
-
padding: 0;
|
|
496
|
-
list-style: none;
|
|
497
|
-
button {
|
|
498
|
-
font-size: inherit;
|
|
499
|
-
}
|
|
500
|
-
margin: ${(p) => {
|
|
501
|
-
var _a;
|
|
502
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
503
|
-
}} 0;
|
|
504
|
-
padding: 0 ${(p) => {
|
|
505
|
-
var _a;
|
|
506
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
507
|
-
}};
|
|
508
|
-
display: flex;
|
|
509
|
-
gap: ${(p) => {
|
|
510
|
-
var _a;
|
|
511
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
512
|
-
}};
|
|
513
|
-
`;
|
|
514
|
-
const StyledActionButton = styled.button`
|
|
515
|
-
${buttonCss};
|
|
516
|
-
display: block;
|
|
517
|
-
background-color: ${(p) => {
|
|
518
|
-
var _a;
|
|
519
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
520
|
-
}};
|
|
521
|
-
width: 100%;
|
|
522
|
-
color: #fff;
|
|
523
|
-
margin: ${(p) => {
|
|
524
|
-
var _a;
|
|
525
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
526
|
-
}} 0;
|
|
527
|
-
padding: 0 ${(p) => {
|
|
528
|
-
var _a;
|
|
529
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
530
|
-
}};
|
|
531
|
-
font-family: Lato;
|
|
532
|
-
font-size: ${(p) => {
|
|
533
|
-
var _a;
|
|
534
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.huge;
|
|
535
|
-
}};
|
|
536
|
-
font-weight: 300;
|
|
537
|
-
&:focus {
|
|
538
|
-
${(p) => {
|
|
539
|
-
var _a;
|
|
540
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
541
|
-
${borderTabStyle}
|
|
542
|
-
background-color: transparent;
|
|
543
|
-
`;
|
|
544
|
-
}}
|
|
545
|
-
}
|
|
546
|
-
`;
|
|
547
|
-
const ConversationLoader = ({ className, agentData }) => {
|
|
548
|
-
return /* @__PURE__ */ React.createElement(ContentBundle, null, /* @__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)))));
|
|
549
|
-
};
|
|
550
|
-
const imageLightboxRenderer = (attrs) => /* @__PURE__ */ React.createElement(Lightbox, {
|
|
551
|
-
attrs
|
|
552
|
-
});
|
|
553
|
-
const htmlParseInstructions = {
|
|
554
|
-
transform: {
|
|
555
|
-
img: imageLightboxRenderer
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
const Html = ({ body }) => {
|
|
559
|
-
return /* @__PURE__ */ React.createElement(StyledHtml, {
|
|
560
|
-
html: body,
|
|
561
|
-
htmlParseInstruction: htmlParseInstructions
|
|
562
|
-
});
|
|
563
|
-
};
|
|
564
|
-
const StyledHtml = styled(Html$1)`
|
|
565
|
-
${genericHtml}
|
|
566
|
-
color: inherit;
|
|
567
|
-
white-space: pre-wrap;
|
|
568
|
-
${messageContentPadding}
|
|
569
|
-
a {
|
|
570
|
-
color: ${(p) => p.theme.colors.link};
|
|
571
|
-
&:focus {
|
|
572
|
-
${(p) => {
|
|
573
|
-
var _a;
|
|
574
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
575
|
-
}};
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
`;
|
|
579
|
-
const StyledTimestamp = styled.p`
|
|
580
|
-
&& {
|
|
581
|
-
font-size: ${(p) => {
|
|
582
|
-
var _a;
|
|
583
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.small;
|
|
584
|
-
}};
|
|
585
|
-
font-weight: 300;
|
|
586
|
-
}
|
|
587
|
-
padding-top: ${(p) => {
|
|
588
|
-
var _a;
|
|
589
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
590
|
-
}};
|
|
591
|
-
margin: 0;
|
|
592
|
-
line-height: 1.5em;
|
|
593
|
-
grid-area: info;
|
|
594
|
-
color: ${(p) => {
|
|
595
|
-
var _a;
|
|
596
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
597
|
-
}};
|
|
598
|
-
`;
|
|
599
|
-
const getTimestamp = (raw) => {
|
|
600
|
-
return new Date(raw).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
601
|
-
};
|
|
602
|
-
const Timestamp = ({ className, name, timestamp }) => {
|
|
603
|
-
if (!name && !timestamp) {
|
|
604
|
-
return null;
|
|
605
|
-
}
|
|
606
|
-
let output = "";
|
|
607
|
-
if (name) {
|
|
608
|
-
if (timestamp) {
|
|
609
|
-
output = `${name}: ${getTimestamp(timestamp)}`;
|
|
610
|
-
} else {
|
|
611
|
-
output = name;
|
|
612
|
-
}
|
|
613
|
-
} else if (timestamp) {
|
|
614
|
-
output = getTimestamp(timestamp);
|
|
615
|
-
}
|
|
616
|
-
return /* @__PURE__ */ React.createElement(StyledTimestamp, null, output);
|
|
617
|
-
};
|
|
618
|
-
const AgentMessage = ({ className, children, sender, timestamp }) => {
|
|
619
|
-
const { avatar, name } = sender;
|
|
620
|
-
const { avatarSize } = useProperties();
|
|
621
|
-
return /* @__PURE__ */ React.createElement(StyledAgentMessage, {
|
|
622
|
-
hasAvatar: !!avatar,
|
|
623
|
-
className: appendClassNames(className, "humany-conversation-agent-message")
|
|
624
|
-
}, avatar && /* @__PURE__ */ React.createElement(Avatar, {
|
|
625
|
-
avatarSize
|
|
626
|
-
}, typeof avatar === "string" ? /* @__PURE__ */ React.createElement("img", {
|
|
627
|
-
src: avatar
|
|
628
|
-
}) : /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
629
|
-
symbol: avatar
|
|
630
|
-
})), children, /* @__PURE__ */ React.createElement(Timestamp, {
|
|
631
|
-
name,
|
|
632
|
-
timestamp
|
|
633
|
-
}));
|
|
634
|
-
};
|
|
635
|
-
const StyledAgentMessage = styled.div`
|
|
636
|
-
display: grid;
|
|
637
|
-
margin-right: 10%;
|
|
638
|
-
width: 90%;
|
|
639
|
-
${(p) => p.hasAvatar ? css`
|
|
640
|
-
grid-template-columns: auto 1fr;
|
|
641
|
-
grid-template-rows: 1fr auto;
|
|
642
|
-
grid-template-areas:
|
|
643
|
-
'avatar content'
|
|
644
|
-
'. info';
|
|
645
|
-
` : css`
|
|
646
|
-
grid-template-columns: 1fr;
|
|
647
|
-
grid-template-rows: 1fr auto;
|
|
648
|
-
grid-template-areas:
|
|
649
|
-
'content'
|
|
650
|
-
'info';
|
|
651
|
-
`};
|
|
652
|
-
`;
|
|
653
|
-
const SystemMessage = ({
|
|
654
|
-
className,
|
|
655
|
-
children,
|
|
656
|
-
timestamp,
|
|
657
|
-
discrete,
|
|
658
|
-
fullWidth
|
|
659
|
-
}) => {
|
|
660
|
-
return /* @__PURE__ */ React.createElement(StyledSystemMessage, {
|
|
661
|
-
className: appendClassNames(className, "humany-conversation-system-message"),
|
|
662
|
-
fullWidth
|
|
663
|
-
}, discrete ? /* @__PURE__ */ React.createElement(Discrete, {
|
|
664
|
-
className: "humany-conversation-discrete-message"
|
|
665
|
-
}, children, /* @__PURE__ */ React.createElement(Timestamp, {
|
|
666
|
-
timestamp
|
|
667
|
-
})) : /* @__PURE__ */ React.createElement(React.Fragment, null, children, /* @__PURE__ */ React.createElement(Timestamp, {
|
|
668
|
-
timestamp
|
|
669
|
-
})));
|
|
670
|
-
};
|
|
671
|
-
const StyledSystemMessage = styled.div`
|
|
672
|
-
${(p) => p.fullWidth && "width: 100%"};
|
|
673
|
-
padding: 0 ${(p) => {
|
|
674
|
-
var _a;
|
|
675
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
676
|
-
}};
|
|
677
|
-
overflow: auto;
|
|
678
|
-
`;
|
|
679
|
-
const Discrete = styled.div`
|
|
680
|
-
text-align: center;
|
|
681
|
-
word-wrap: break-word;
|
|
682
|
-
font-size: ${(p) => {
|
|
683
|
-
var _a;
|
|
684
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.normal;
|
|
685
|
-
}};
|
|
686
|
-
color: ${(p) => {
|
|
687
|
-
var _a;
|
|
688
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
689
|
-
}};
|
|
690
|
-
> p {
|
|
691
|
-
margin: 0;
|
|
692
|
-
}
|
|
693
|
-
`;
|
|
694
|
-
const UserMessage = ({ className, children, timestamp }) => {
|
|
695
|
-
const { userLabel = "" } = useProperties();
|
|
696
|
-
return /* @__PURE__ */ React.createElement(StyledUserMessage, {
|
|
697
|
-
className: appendClassNames(className, "humany-conversation-user-message")
|
|
698
|
-
}, children, /* @__PURE__ */ React.createElement(Timestamp, {
|
|
699
|
-
name: userLabel,
|
|
700
|
-
timestamp
|
|
701
|
-
}));
|
|
702
|
-
};
|
|
703
|
-
const StyledUserMessage = styled.div`
|
|
704
|
-
margin-left: 10%;
|
|
705
|
-
width: 90%;
|
|
706
|
-
display: flex;
|
|
707
|
-
flex-direction: column;
|
|
708
|
-
align-items: flex-end;
|
|
709
|
-
`;
|
|
710
|
-
const mapActions = (actions) => Array.isArray(actions) ? actions : Object.keys(actions).map((i) => {
|
|
711
|
-
return {
|
|
712
|
-
label: actions[i],
|
|
713
|
-
actionKey: i
|
|
714
|
-
};
|
|
715
|
-
});
|
|
716
|
-
const ButtonList = ({ header, actions, dispatch }) => {
|
|
717
|
-
return /* @__PURE__ */ React.createElement(StyledButtonList, {
|
|
718
|
-
header,
|
|
719
|
-
items: mapActions(actions),
|
|
720
|
-
renderItem: (item) => {
|
|
721
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
722
|
-
key: item.actionKey
|
|
723
|
-
}, /* @__PURE__ */ React.createElement(StyledButtonListButton, {
|
|
724
|
-
onClick: () => {
|
|
725
|
-
dispatch("action", item);
|
|
726
|
-
},
|
|
727
|
-
"aria-label": item.label,
|
|
728
|
-
title: item.label
|
|
729
|
-
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
730
|
-
symbol: item.symbol
|
|
731
|
-
}), item.label));
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
};
|
|
735
|
-
const StyledButtonList = styled(ItemList)`
|
|
736
|
-
${itemList}
|
|
737
|
-
> ul {
|
|
738
|
-
display: flex;
|
|
739
|
-
flex-wrap: wrap;
|
|
740
|
-
gap: ${(p) => {
|
|
741
|
-
var _a;
|
|
742
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
743
|
-
}};
|
|
744
|
-
> li {
|
|
745
|
-
margin: 0;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
${messageContentPadding}
|
|
749
|
-
`;
|
|
750
|
-
const StyledButtonListButton = styled(Button)`
|
|
751
|
-
${buttonCss};
|
|
752
|
-
|
|
753
|
-
display: block;
|
|
754
|
-
padding: ${(p) => {
|
|
755
|
-
var _a;
|
|
756
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
757
|
-
}};
|
|
758
|
-
background-color: ${(p) => {
|
|
759
|
-
var _a;
|
|
760
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
761
|
-
}};
|
|
762
|
-
width: 100%;
|
|
763
|
-
color: #ffffff;
|
|
764
|
-
&:focus {
|
|
765
|
-
${(p) => {
|
|
766
|
-
var _a;
|
|
767
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
768
|
-
${borderTabStyle}
|
|
769
|
-
background-color: transparent;
|
|
770
|
-
`;
|
|
771
|
-
}}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
i,
|
|
775
|
-
svg {
|
|
776
|
-
margin-right: ${(p) => {
|
|
777
|
-
var _a;
|
|
778
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
779
|
-
}};
|
|
780
|
-
}
|
|
781
|
-
`;
|
|
782
|
-
const Custom = ({ type, content = {} }) => {
|
|
783
|
-
const Component = useComponent(type);
|
|
784
|
-
if (!Component || !type) {
|
|
785
|
-
return null;
|
|
786
|
-
}
|
|
787
|
-
return /* @__PURE__ */ React.createElement(Suspense, {
|
|
788
|
-
fallback: null
|
|
789
|
-
}, /* @__PURE__ */ React.createElement(Component, __spreadValues({}, content)));
|
|
790
|
-
};
|
|
791
|
-
const LinkList = ({ header, actions, dispatch }) => {
|
|
792
|
-
return /* @__PURE__ */ React.createElement(StyledLinkList, {
|
|
793
|
-
header,
|
|
794
|
-
items: mapActions(actions),
|
|
795
|
-
renderItem: (item) => {
|
|
796
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
797
|
-
key: item.actionKey
|
|
798
|
-
}, /* @__PURE__ */ React.createElement(StyledLinkButton, {
|
|
799
|
-
help: item.actionKey === "help",
|
|
800
|
-
onClick: () => {
|
|
801
|
-
dispatch("action", item);
|
|
802
|
-
},
|
|
803
|
-
"aria-label": item.label,
|
|
804
|
-
title: item.label
|
|
805
|
-
}, item.label, item.actionKey === "help" && /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
806
|
-
size: 14,
|
|
807
|
-
symbol: {
|
|
808
|
-
type: "Svg",
|
|
809
|
-
content: "caret-down"
|
|
810
|
-
}
|
|
811
|
-
})));
|
|
812
|
-
}
|
|
813
|
-
});
|
|
814
|
-
};
|
|
815
|
-
const StyledLinkList = styled(ItemList)`
|
|
816
|
-
${itemList}
|
|
817
|
-
${messageContentPadding}
|
|
818
|
-
> ul {
|
|
819
|
-
display: flex;
|
|
820
|
-
flex-direction: column;
|
|
821
|
-
gap: ${(p) => {
|
|
822
|
-
var _a;
|
|
823
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
824
|
-
}};
|
|
825
|
-
> li {
|
|
826
|
-
margin: 0;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
`;
|
|
830
|
-
const StyledLinkButton = styled(Button)`
|
|
831
|
-
display: block;
|
|
832
|
-
text-align: left;
|
|
833
|
-
font-weight: 300;
|
|
834
|
-
color: ${(p) => {
|
|
835
|
-
var _a;
|
|
836
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.primary;
|
|
837
|
-
}};
|
|
838
|
-
|
|
839
|
-
${(p) => {
|
|
840
|
-
var _a, _b;
|
|
841
|
-
return p.help && css`
|
|
842
|
-
color: ${(_a = p.theme.colors) == null ? void 0 : _a.text};
|
|
843
|
-
text-decoration: underline;
|
|
844
|
-
|
|
845
|
-
i,
|
|
846
|
-
svg {
|
|
847
|
-
margin-left: ${(_b = p.theme.sizes) == null ? void 0 : _b.small};
|
|
848
|
-
}
|
|
849
|
-
`;
|
|
850
|
-
}}
|
|
851
|
-
|
|
852
|
-
&:focus {
|
|
853
|
-
${(p) => {
|
|
854
|
-
var _a, _b;
|
|
855
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
856
|
-
${borderTabStyle}
|
|
857
|
-
span {
|
|
858
|
-
color: ${(_b = p.theme.colors) == null ? void 0 : _b.primary};
|
|
859
|
-
text-decoration: underline;
|
|
860
|
-
}
|
|
861
|
-
`;
|
|
862
|
-
}};
|
|
863
|
-
}
|
|
864
|
-
`;
|
|
865
|
-
const Separator = () => {
|
|
866
|
-
return /* @__PURE__ */ React.createElement(StyledSeparator, null);
|
|
867
|
-
};
|
|
868
|
-
const StyledSeparator = styled.div`
|
|
869
|
-
${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}
|
|
870
|
-
width: 100%;
|
|
871
|
-
`;
|
|
872
|
-
const Text = ({ text }) => {
|
|
873
|
-
return /* @__PURE__ */ React.createElement(StyledTypography, {
|
|
874
|
-
variant: "span"
|
|
875
|
-
}, text);
|
|
876
|
-
};
|
|
877
|
-
const StyledTypography = styled(Typography)`
|
|
878
|
-
${messageContentPadding}
|
|
879
|
-
`;
|
|
880
|
-
const VideoRequest = ({
|
|
881
|
-
header = "Video call",
|
|
882
|
-
acceptLabel = "Accept",
|
|
883
|
-
declineLabel = "Decline",
|
|
884
|
-
dispatch
|
|
885
|
-
}) => {
|
|
886
|
-
const actions = useMemo(() => {
|
|
887
|
-
return [
|
|
888
|
-
{
|
|
889
|
-
label: acceptLabel,
|
|
890
|
-
actionKey: "accept-video-call",
|
|
891
|
-
symbol: {
|
|
892
|
-
type: "Svg",
|
|
893
|
-
content: "video"
|
|
894
|
-
}
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
label: declineLabel,
|
|
898
|
-
actionKey: "decline-video-call",
|
|
899
|
-
symbol: {
|
|
900
|
-
type: "Svg",
|
|
901
|
-
content: "close"
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
];
|
|
905
|
-
}, [acceptLabel, declineLabel]);
|
|
906
|
-
return /* @__PURE__ */ React.createElement(StyledItemList, {
|
|
907
|
-
header,
|
|
908
|
-
items: actions,
|
|
909
|
-
renderItem: (item) => {
|
|
910
|
-
const bgColor = item.actionKey === "accept-video-call" ? "#70c48e" : "#da5c85";
|
|
911
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
912
|
-
key: item.actionKey
|
|
913
|
-
}, /* @__PURE__ */ React.createElement(StyledButton, {
|
|
914
|
-
onClick: () => {
|
|
915
|
-
dispatch("action", item);
|
|
916
|
-
},
|
|
917
|
-
"aria-label": item.label,
|
|
918
|
-
title: item.label,
|
|
919
|
-
bgColor
|
|
920
|
-
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
921
|
-
symbol: item.symbol,
|
|
922
|
-
size: 25
|
|
923
|
-
})));
|
|
924
|
-
}
|
|
925
|
-
});
|
|
926
|
-
};
|
|
927
|
-
const StyledItemList = styled(ItemList)`
|
|
928
|
-
${itemList}
|
|
929
|
-
> ul {
|
|
930
|
-
display: flex;
|
|
931
|
-
flex-wrap: wrap;
|
|
932
|
-
gap: ${(p) => {
|
|
933
|
-
var _a;
|
|
934
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
935
|
-
}};
|
|
936
|
-
> li {
|
|
937
|
-
margin: 0;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
${messageContentPadding}
|
|
941
|
-
`;
|
|
942
|
-
const StyledButton = styled(Button)`
|
|
943
|
-
${buttonCss};
|
|
944
|
-
|
|
945
|
-
background-color: ${(p) => p.bgColor};
|
|
946
|
-
display: flex;
|
|
947
|
-
justify-content: center;
|
|
948
|
-
align-items: center;
|
|
949
|
-
color: #ffffff;
|
|
950
|
-
width: 46px;
|
|
951
|
-
height: 46px;
|
|
952
|
-
border-radius: 100%;
|
|
953
|
-
|
|
954
|
-
&:focus {
|
|
955
|
-
${(p) => {
|
|
956
|
-
var _a;
|
|
957
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && css`
|
|
958
|
-
${borderTabStyle}
|
|
959
|
-
background-color: transparent;
|
|
960
|
-
|
|
961
|
-
i,
|
|
962
|
-
svg {
|
|
963
|
-
color: ${(p2) => {
|
|
964
|
-
var _a2;
|
|
965
|
-
return (_a2 = p2.theme.colors) == null ? void 0 : _a2.primary;
|
|
966
|
-
}};
|
|
967
|
-
|
|
968
|
-
path {
|
|
969
|
-
stroke: ${(p2) => {
|
|
970
|
-
var _a2;
|
|
971
|
-
return (_a2 = p2.theme.colors) == null ? void 0 : _a2.primary;
|
|
972
|
-
}};
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
`;
|
|
976
|
-
}}
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
i,
|
|
980
|
-
svg {
|
|
981
|
-
color: #fff;
|
|
982
|
-
|
|
983
|
-
path {
|
|
984
|
-
stroke: #fff;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
`;
|
|
988
|
-
const mapItem = ([type, content]) => {
|
|
989
|
-
return { type, content, id: uuid() };
|
|
990
|
-
};
|
|
991
|
-
const MessageList = ({ items, dispatch }) => {
|
|
992
|
-
return /* @__PURE__ */ React.createElement(StyledList, {
|
|
993
|
-
items: items.map(mapItem),
|
|
994
|
-
renderLi: true,
|
|
995
|
-
renderItem: (item) => {
|
|
996
|
-
switch (item.type) {
|
|
997
|
-
case ConversationMessageListItemType.Text: {
|
|
998
|
-
return /* @__PURE__ */ React.createElement(Text, {
|
|
999
|
-
text: item.content
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
case ConversationMessageListItemType.HTML: {
|
|
1003
|
-
return /* @__PURE__ */ React.createElement(Html, __spreadValues({}, item.content));
|
|
1004
|
-
}
|
|
1005
|
-
case ConversationMessageListItemType.Separator: {
|
|
1006
|
-
return /* @__PURE__ */ React.createElement(Separator, __spreadValues({}, item.content));
|
|
1007
|
-
}
|
|
1008
|
-
case ConversationMessageListItemType.LinkList: {
|
|
1009
|
-
return /* @__PURE__ */ React.createElement(LinkList, __spreadProps(__spreadValues({}, item.content), {
|
|
1010
|
-
dispatch
|
|
1011
|
-
}));
|
|
1012
|
-
}
|
|
1013
|
-
case ConversationMessageListItemType.ButtonList: {
|
|
1014
|
-
return /* @__PURE__ */ React.createElement(ButtonList, __spreadProps(__spreadValues({}, item.content), {
|
|
1015
|
-
dispatch
|
|
1016
|
-
}));
|
|
1017
|
-
}
|
|
1018
|
-
case ConversationMessageListItemType.VideoRequest: {
|
|
1019
|
-
return /* @__PURE__ */ React.createElement(VideoRequest, __spreadProps(__spreadValues({}, item.content), {
|
|
1020
|
-
dispatch
|
|
1021
|
-
}));
|
|
1022
|
-
}
|
|
1023
|
-
default: {
|
|
1024
|
-
return /* @__PURE__ */ React.createElement(Custom, {
|
|
1025
|
-
type: item.type,
|
|
1026
|
-
content: item.content
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
};
|
|
1033
|
-
const StyledList = styled(List)`
|
|
1034
|
-
${list}
|
|
1035
|
-
|
|
1036
|
-
> li {
|
|
1037
|
-
margin: 0;
|
|
1038
|
-
}
|
|
1039
|
-
`;
|
|
1040
|
-
const ConversationMessage = ({
|
|
1041
|
-
className,
|
|
1042
|
-
timestamp,
|
|
1043
|
-
sender,
|
|
1044
|
-
type,
|
|
1045
|
-
content
|
|
1046
|
-
}) => {
|
|
1047
|
-
const getMessageStackPosition = useCallback((index) => {
|
|
1048
|
-
let messageOrder = "first";
|
|
1049
|
-
if (content.length > 1) {
|
|
1050
|
-
messageOrder = index === 0 ? "first" : index + 1 === content.length ? "last" : "middle";
|
|
1051
|
-
}
|
|
1052
|
-
return messageOrder;
|
|
1053
|
-
}, [content]);
|
|
1054
|
-
const createSystemMessage = () => {
|
|
1055
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, content.map((item) => {
|
|
1056
|
-
const { key, body, title, form, actions } = item;
|
|
1057
|
-
const discrete = !!body && !title && !form && !actions;
|
|
1058
|
-
return /* @__PURE__ */ React.createElement(SystemMessage, {
|
|
1059
|
-
className,
|
|
1060
|
-
key,
|
|
1061
|
-
discrete,
|
|
1062
|
-
timestamp,
|
|
1063
|
-
fullWidth: !!form || !!actions
|
|
1064
|
-
}, discrete && body ? /* @__PURE__ */ React.createElement(Html, {
|
|
1065
|
-
body
|
|
1066
|
-
}) : /* @__PURE__ */ React.createElement(Message, {
|
|
1067
|
-
content: item,
|
|
1068
|
-
isUser: false
|
|
1069
|
-
}));
|
|
1070
|
-
}));
|
|
1071
|
-
};
|
|
1072
|
-
const createAgentMessage = () => {
|
|
1073
|
-
return /* @__PURE__ */ React.createElement(AgentMessage, {
|
|
1074
|
-
sender,
|
|
1075
|
-
timestamp,
|
|
1076
|
-
className
|
|
1077
|
-
}, /* @__PURE__ */ React.createElement(ContentBundle, null, content.map((item, index) => {
|
|
1078
|
-
return /* @__PURE__ */ React.createElement(MessageContainer, {
|
|
1079
|
-
key: item.key
|
|
1080
|
-
}, /* @__PURE__ */ React.createElement(Message, {
|
|
1081
|
-
content: item,
|
|
1082
|
-
isUser: false,
|
|
1083
|
-
stacked: getMessageStackPosition(index)
|
|
1084
|
-
}));
|
|
1085
|
-
})));
|
|
1086
|
-
};
|
|
1087
|
-
const createUserMessage = () => {
|
|
1088
|
-
return /* @__PURE__ */ React.createElement(UserMessage, {
|
|
1089
|
-
timestamp,
|
|
1090
|
-
className
|
|
1091
|
-
}, /* @__PURE__ */ React.createElement(ContentBundle, null, content.map((item, index) => {
|
|
1092
|
-
return /* @__PURE__ */ React.createElement(MessageContainer, {
|
|
1093
|
-
user: true,
|
|
1094
|
-
key: item.key
|
|
1095
|
-
}, /* @__PURE__ */ React.createElement(Message, {
|
|
1096
|
-
content: item,
|
|
1097
|
-
isUser: true,
|
|
1098
|
-
stacked: getMessageStackPosition(index)
|
|
1099
|
-
}));
|
|
1100
|
-
})));
|
|
1101
|
-
};
|
|
1102
|
-
switch (type) {
|
|
1103
|
-
case ConversationMessageType.System:
|
|
1104
|
-
return createSystemMessage();
|
|
1105
|
-
case ConversationMessageType.Agent:
|
|
1106
|
-
return createAgentMessage();
|
|
1107
|
-
case ConversationMessageType.User:
|
|
1108
|
-
return createUserMessage();
|
|
1109
|
-
default:
|
|
1110
|
-
return null;
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
const Message = ({ content, isUser, stacked }) => {
|
|
1114
|
-
const dispatch = useDispatch();
|
|
1115
|
-
const { title, body, actions, form, items } = content;
|
|
1116
|
-
return /* @__PURE__ */ React.createElement(MessageContent, {
|
|
1117
|
-
user: isUser,
|
|
1118
|
-
stacked,
|
|
1119
|
-
fullWidth: !!form || !!actions
|
|
1120
|
-
}, title && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(MessageTitle, {
|
|
1121
|
-
variant: "h2"
|
|
1122
|
-
}, title)), body && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(Html, {
|
|
1123
|
-
body
|
|
1124
|
-
})), form && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(StyledForm, __spreadProps(__spreadValues({}, form), {
|
|
1125
|
-
onChange: (key, data) => {
|
|
1126
|
-
dispatch("form", {
|
|
1127
|
-
data,
|
|
1128
|
-
formKey: form.schema.id,
|
|
1129
|
-
actionKey: key
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
}))), actions && /* @__PURE__ */ React.createElement(MessageContentPart, null, /* @__PURE__ */ React.createElement(StyledActionList, {
|
|
1133
|
-
items: Object.keys(actions).map((i) => {
|
|
1134
|
-
return { label: actions[i], actionKey: i };
|
|
1135
|
-
}),
|
|
1136
|
-
renderItem: (item) => {
|
|
1137
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
1138
|
-
key: item.actionKey
|
|
1139
|
-
}, /* @__PURE__ */ React.createElement(StyledActionButton, {
|
|
1140
|
-
onClick: () => {
|
|
1141
|
-
dispatch("action", item.actionKey);
|
|
1142
|
-
}
|
|
1143
|
-
}, item.label));
|
|
1144
|
-
}
|
|
1145
|
-
})), items && /* @__PURE__ */ React.createElement(MessageList, {
|
|
1146
|
-
key: uuid(),
|
|
1147
|
-
items,
|
|
1148
|
-
dispatch
|
|
1149
|
-
}));
|
|
1150
|
-
};
|
|
1151
|
-
const ConversationContent = () => {
|
|
1152
|
-
const lastEntry = useRef(document.createElement("div"));
|
|
1153
|
-
const [scrollableCss, viewElem] = useScroll(true);
|
|
1154
|
-
const { messages, loading, typingActors } = useProperties();
|
|
1155
|
-
const [canSmooth, setCanSmooth] = useState(false);
|
|
1156
|
-
const previousMessages = usePrevious(messages);
|
|
1157
|
-
const previousTypingActors = usePrevious(typingActors);
|
|
1158
|
-
const scrollView = useCallback((lastEntry2, smooth = true) => {
|
|
1159
|
-
if (lastEntry2 !== null && lastEntry2.current !== null) {
|
|
1160
|
-
if (messages && messages.length === 1) {
|
|
1161
|
-
lastEntry2.current.focus();
|
|
1162
|
-
}
|
|
1163
|
-
if (lastEntry2.current.id.indexOf("typing_") !== -1 && viewElem.current.scrollTopMax - viewElem.current.scrollTop > lastEntry2.current.clientHeight + 100) {
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
setTimeout(() => {
|
|
1167
|
-
if (lastEntry2.current) {
|
|
1168
|
-
lastEntry2.current.scrollIntoView({
|
|
1169
|
-
block: "end",
|
|
1170
|
-
behavior: smooth ? "smooth" : "auto"
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
}, 150);
|
|
1174
|
-
}
|
|
1175
|
-
}, [lastEntry]);
|
|
1176
|
-
useEffect(() => {
|
|
1177
|
-
if (canSmooth) {
|
|
1178
|
-
const messageCountChanged = messages.length !== (previousMessages == null ? void 0 : previousMessages.length);
|
|
1179
|
-
const typingActorCountChanged = typingActors.length !== (previousTypingActors == null ? void 0 : previousTypingActors.length);
|
|
1180
|
-
const messageContentCountChanged = messages.reduce((changed, message, index) => {
|
|
1181
|
-
var _a;
|
|
1182
|
-
if (((_a = previousMessages == null ? void 0 : previousMessages[index]) == null ? void 0 : _a.content.length) !== message.content.length) {
|
|
1183
|
-
return true;
|
|
1184
|
-
}
|
|
1185
|
-
return changed;
|
|
1186
|
-
}, false);
|
|
1187
|
-
if (messageCountChanged || messageContentCountChanged || typingActorCountChanged) {
|
|
1188
|
-
scrollView(lastEntry);
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
}, [messages, typingActors]);
|
|
1192
|
-
useTransitionEnd(() => {
|
|
1193
|
-
setCanSmooth(true);
|
|
1194
|
-
scrollView(lastEntry, false);
|
|
1195
|
-
});
|
|
1196
|
-
const renderTypingActors = () => {
|
|
1197
|
-
if (typingActors && typingActors.length) {
|
|
1198
|
-
return typingActors.map((actor, index) => {
|
|
1199
|
-
return /* @__PURE__ */ React.createElement(MessageEntry, {
|
|
1200
|
-
id: `typing_${actor.name}`,
|
|
1201
|
-
ref: typingActors.length ? lastEntry : null,
|
|
1202
|
-
key: `typing_${actor.name}`
|
|
1203
|
-
}, /* @__PURE__ */ React.createElement(AgentMessage, {
|
|
1204
|
-
timestamp: Date.now(),
|
|
1205
|
-
sender: actor
|
|
1206
|
-
}, /* @__PURE__ */ React.createElement(ConversationLoader, null)));
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
return null;
|
|
1210
|
-
};
|
|
1211
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Scrollable, {
|
|
1212
|
-
tabIndex: 0,
|
|
1213
|
-
scrollableCss,
|
|
1214
|
-
ref: viewElem
|
|
1215
|
-
}, messages && messages.length ? messages.map((message, index) => {
|
|
1216
|
-
const { type, timestamp, sender, content } = message;
|
|
1217
|
-
return /* @__PURE__ */ React.createElement(MessageEntry, {
|
|
1218
|
-
className: "humany-conversation-entry",
|
|
1219
|
-
tabIndex: -1,
|
|
1220
|
-
key: `${type}_${sender == null ? void 0 : sender.name}_${timestamp}_${content[0].key}`,
|
|
1221
|
-
ref: index + 1 < messages.length ? null : typingActors.length ? null : lastEntry
|
|
1222
|
-
}, /* @__PURE__ */ React.createElement(ConversationMessage, __spreadValues({}, message)));
|
|
1223
|
-
}) : null, renderTypingActors(), loading && /* @__PURE__ */ React.createElement(MessageEntry, null, /* @__PURE__ */ React.createElement(ConversationLoader, null))), /* @__PURE__ */ React.createElement(ConversationInput, null));
|
|
1224
|
-
};
|
|
1225
|
-
const Scrollable = styled.div`
|
|
1226
|
-
display: flex;
|
|
1227
|
-
flex-direction: column;
|
|
1228
|
-
align-items: stretch;
|
|
1229
|
-
flex: 0 1 100%;
|
|
1230
|
-
padding: 0 ${(p) => {
|
|
1231
|
-
var _a;
|
|
1232
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1233
|
-
}};
|
|
1234
|
-
${(p) => !!p.scrollableCss && p.scrollableCss};
|
|
1235
|
-
&:focus {
|
|
1236
|
-
${(p) => {
|
|
1237
|
-
var _a;
|
|
1238
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
1239
|
-
}};
|
|
1240
|
-
}
|
|
1241
|
-
`;
|
|
1242
|
-
const MessageEntry = styled.div`
|
|
1243
|
-
margin: 0;
|
|
1244
|
-
margin-bottom: ${(p) => {
|
|
1245
|
-
var _a;
|
|
1246
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
1247
|
-
}};
|
|
1248
|
-
|
|
1249
|
-
&:first-of-type {
|
|
1250
|
-
margin-top: ${(p) => {
|
|
1251
|
-
var _a;
|
|
1252
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
1253
|
-
}};
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
&:last-of-type {
|
|
1257
|
-
padding-bottom: ${(p) => {
|
|
1258
|
-
var _a;
|
|
1259
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
1260
|
-
}};
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
& span,
|
|
1264
|
-
p,
|
|
1265
|
-
a,
|
|
1266
|
-
div {
|
|
1267
|
-
font-weight: 300;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
& b,
|
|
1271
|
-
h1 {
|
|
1272
|
-
font-weight: normal;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
${headingElement("h1", css`
|
|
1276
|
-
font-weight: normal;
|
|
1277
|
-
`)}
|
|
1278
|
-
`;
|
|
1279
|
-
const OverlayOutlet = ({ dispatch }) => {
|
|
1280
|
-
const wrapperRef = useRef(null);
|
|
1281
|
-
useEffect(() => {
|
|
1282
|
-
if (wrapperRef.current && wrapperRef.current.parentNode) {
|
|
1283
|
-
dispatch("overlay-mounted", wrapperRef.current);
|
|
1284
|
-
}
|
|
1285
|
-
}, [wrapperRef]);
|
|
1286
|
-
return /* @__PURE__ */ React.createElement(WidgetOverlayOutlet, {
|
|
1287
|
-
portalId: "humany-conversation-overlay-portal",
|
|
1288
|
-
className: "humany-conversation-overlay-outlet",
|
|
1289
|
-
ref: wrapperRef
|
|
1290
|
-
});
|
|
1291
|
-
};
|
|
1292
|
-
const ConversationOverlayOutlet = ({
|
|
1293
|
-
dispatch,
|
|
1294
|
-
header,
|
|
1295
|
-
buttonLabel
|
|
1296
|
-
}) => {
|
|
1297
|
-
return /* @__PURE__ */ React.createElement(StyledWidgetOverlayOutlet, {
|
|
1298
|
-
portalId: "humany-conversation-portal",
|
|
1299
|
-
className: "humany-conversation-outlet"
|
|
1300
|
-
}, /* @__PURE__ */ React.createElement(ConversationOverlayHead, {
|
|
1301
|
-
className: "humany-conversation-outlet-head"
|
|
1302
|
-
}, /* @__PURE__ */ React.createElement(ConversationOverlayHeadButton, {
|
|
1303
|
-
className: "humany-conversation-outlet-head-button",
|
|
1304
|
-
"aria-label": buttonLabel,
|
|
1305
|
-
title: buttonLabel,
|
|
1306
|
-
onClick: () => dispatch("hide-overlay-conversation")
|
|
1307
|
-
}, /* @__PURE__ */ React.createElement(SymbolBadge, {
|
|
1308
|
-
symbol: {
|
|
1309
|
-
type: "Svg",
|
|
1310
|
-
content: "caret-down"
|
|
1311
|
-
},
|
|
1312
|
-
size: 20
|
|
1313
|
-
})), header && /* @__PURE__ */ React.createElement(ConversationOverlayHeader, {
|
|
1314
|
-
className: "humany-conversation-outlet-header",
|
|
1315
|
-
variant: "h1"
|
|
1316
|
-
}, header)), /* @__PURE__ */ React.createElement(ConversationContent, null));
|
|
1317
|
-
};
|
|
1318
|
-
const StyledWidgetOverlayOutlet = styled(WidgetOverlayOutlet)`
|
|
1319
|
-
z-index: 11;
|
|
1320
|
-
top: auto;
|
|
1321
|
-
height: 65%;
|
|
1322
|
-
background-color: #ffffff;
|
|
1323
|
-
display: flex;
|
|
1324
|
-
flex-direction: column;
|
|
1325
|
-
border-top-right-radius: ${(p) => {
|
|
1326
|
-
var _a;
|
|
1327
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
1328
|
-
}};
|
|
1329
|
-
border-top-left-radius: ${(p) => {
|
|
1330
|
-
var _a;
|
|
1331
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.large;
|
|
1332
|
-
}};
|
|
1333
|
-
`;
|
|
1334
|
-
const ConversationOverlayHead = styled.div`
|
|
1335
|
-
display: flex;
|
|
1336
|
-
flex-direction: column;
|
|
1337
|
-
justify-content: center;
|
|
1338
|
-
align-items: center;
|
|
1339
|
-
gap: ${(p) => {
|
|
1340
|
-
var _a;
|
|
1341
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1342
|
-
}};
|
|
1343
|
-
padding: ${(p) => {
|
|
1344
|
-
var _a;
|
|
1345
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.normal;
|
|
1346
|
-
}};
|
|
1347
|
-
${(p) => p.theme.border && `border-bottom: ${p.theme.border};`}
|
|
1348
|
-
`;
|
|
1349
|
-
const ConversationOverlayHeader = styled(Typography)`
|
|
1350
|
-
font-size: ${(p) => {
|
|
1351
|
-
var _a;
|
|
1352
|
-
return (_a = p.theme.fonts) == null ? void 0 : _a.medium;
|
|
1353
|
-
}};
|
|
1354
|
-
color: ${(p) => {
|
|
1355
|
-
var _a;
|
|
1356
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1357
|
-
}};
|
|
1358
|
-
margin: 0;
|
|
1359
|
-
`;
|
|
1360
|
-
const ConversationOverlayHeadButton = styled(Button)`
|
|
1361
|
-
display: flex;
|
|
1362
|
-
align-items: center;
|
|
1363
|
-
justify-content: center;
|
|
1364
|
-
padding: ${(p) => {
|
|
1365
|
-
var _a;
|
|
1366
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.small;
|
|
1367
|
-
}} ${(p) => {
|
|
1368
|
-
var _a;
|
|
1369
|
-
return (_a = p.theme.sizes) == null ? void 0 : _a.medium;
|
|
1370
|
-
}};
|
|
1371
|
-
${(p) => p.theme.borderRadius && `border-radius: ${p.theme.borderRadius};`}
|
|
1372
|
-
|
|
1373
|
-
&:focus {
|
|
1374
|
-
${(p) => {
|
|
1375
|
-
var _a;
|
|
1376
|
-
return ((_a = p.theme.accessibility) == null ? void 0 : _a.isTabbing) && borderTabStyle;
|
|
1377
|
-
}};
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
svg line {
|
|
1381
|
-
stroke: ${(p) => {
|
|
1382
|
-
var _a;
|
|
1383
|
-
return (_a = p.theme.colors) == null ? void 0 : _a.text;
|
|
1384
|
-
}};
|
|
1385
|
-
}
|
|
1386
|
-
`;
|
|
1387
|
-
const Conversation = ({ className }) => {
|
|
1388
|
-
const {
|
|
1389
|
-
overlay,
|
|
1390
|
-
overlayConversationHeader,
|
|
1391
|
-
overlayConversationCloseLabel
|
|
1392
|
-
} = useProperties();
|
|
1393
|
-
const dispatch = useDispatch();
|
|
1394
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Wrapper, {
|
|
1395
|
-
className: appendClassNames(className, "humany-conversation-component")
|
|
1396
|
-
}, /* @__PURE__ */ React.createElement(ConversationContent, null)), overlay && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(OverlayOutlet, {
|
|
1397
|
-
dispatch
|
|
1398
|
-
}), overlay.conversation && /* @__PURE__ */ React.createElement(ConversationOverlayOutlet, {
|
|
1399
|
-
dispatch,
|
|
1400
|
-
header: overlayConversationHeader,
|
|
1401
|
-
buttonLabel: overlayConversationCloseLabel
|
|
1402
|
-
})));
|
|
1403
|
-
};
|
|
1404
|
-
const Wrapper = styled.div`
|
|
1405
|
-
position: absolute;
|
|
1406
|
-
right: 0;
|
|
1407
|
-
left: 0;
|
|
1408
|
-
bottom: 0;
|
|
1409
|
-
top: 0;
|
|
1410
|
-
overflow: hidden;
|
|
1411
|
-
display: flex;
|
|
1412
|
-
flex-direction: column;
|
|
1413
|
-
`;
|
|
1414
|
-
export { Conversation as default };
|
|
1415
|
-
//# sourceMappingURL=conversation.js.map
|