@telia-ace/widget-conversation 1.0.3 → 1.0.7
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/lib/agent.d.ts +2 -2
- package/lib/conversation-controller.d.ts +4 -3
- package/lib/conversation-controller.js +43 -23
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/types.d.ts +75 -0
- package/lib/types.js +17 -0
- package/lib/ui/conversation/conversation-content.js +145 -9
- package/lib/ui/conversation/conversation-input.js +6 -0
- package/lib/ui/conversation/conversation-styles.d.ts +3 -1
- package/lib/ui/conversation/conversation-styles.js +7 -5
- package/lib/ui/conversation/conversation.js +1 -1
- package/lib/ui/conversation/message-types/agent.js +1 -1
- package/lib/ui/conversation/message-types/custom.js +2 -2
- package/lib/ui/conversation/message-types/timestamp.js +1 -1
- package/lib/ui/conversation/message-types/user.js +1 -1
- package/lib-esm/agent.d.ts +2 -2
- package/lib-esm/conversation-controller.d.ts +4 -3
- package/lib-esm/conversation-controller.js +43 -23
- package/lib-esm/index.d.ts +2 -1
- package/lib-esm/index.js +1 -0
- package/lib-esm/types.d.ts +75 -0
- package/lib-esm/types.js +16 -1
- package/lib-esm/ui/conversation/conversation-content.js +147 -8
- package/lib-esm/ui/conversation/conversation-input.js +6 -0
- package/lib-esm/ui/conversation/conversation-styles.d.ts +3 -1
- package/lib-esm/ui/conversation/conversation-styles.js +7 -5
- package/lib-esm/ui/conversation/conversation.js +1 -1
- package/lib-esm/ui/conversation/message-types/agent.js +1 -1
- package/lib-esm/ui/conversation/message-types/custom.js +2 -2
- package/lib-esm/ui/conversation/message-types/timestamp.js +1 -1
- package/lib-esm/ui/conversation/message-types/user.js +1 -1
- package/package.json +11 -9
|
@@ -39,12 +39,12 @@ var react_1 = __importStar(require("react"));
|
|
|
39
39
|
var conversation_styles_1 = require("../conversation-styles");
|
|
40
40
|
var CustomMessage = function (props) {
|
|
41
41
|
var CustomComponent = (0, widget_ui_1.useComponent)(props.type);
|
|
42
|
-
if (
|
|
42
|
+
if (!CustomComponent) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
return (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
46
46
|
react_1.default.createElement(conversation_styles_1.MessageContent, { user: props.isUser, stacked: !!props.stacked && props.stacked, fullWidth: !!props.content.form || !!props.content.actions },
|
|
47
|
-
react_1.default.createElement(conversation_styles_1.MessageContentPart,
|
|
47
|
+
react_1.default.createElement(conversation_styles_1.MessageContentPart, { noPadding: !!props.content.noPadding && props.content.noPadding },
|
|
48
48
|
react_1.default.createElement(CustomComponent, __assign({}, props.content))))));
|
|
49
49
|
};
|
|
50
50
|
exports.default = CustomMessage;
|
|
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
var react_1 = __importDefault(require("react"));
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var StyledTimestamp = styled_components_1.default.p(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n && {\n font-size: ", ";\n font-weight: 300;\n }\n margin: 0;\n line-height: 1.5em;\n grid-area: info;\n color: ", ";\n"], ["\n && {\n font-size: ", ";\n font-weight: 300;\n }\n margin: 0;\n line-height: 1.5em;\n grid-area: info;\n color: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; });
|
|
12
|
+
var StyledTimestamp = styled_components_1.default.p(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n && {\n font-size: ", ";\n font-weight: 300;\n }\n padding-top: ", ";\n margin: 0;\n line-height: 1.5em;\n grid-area: info;\n color: ", ";\n"], ["\n && {\n font-size: ", ";\n font-weight: 300;\n }\n padding-top: ", ";\n margin: 0;\n line-height: 1.5em;\n grid-area: info;\n color: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; });
|
|
13
13
|
var getTimestamp = function (raw) {
|
|
14
14
|
return new Date(raw).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
15
15
|
};
|
|
@@ -19,6 +19,6 @@ var UserMessage = function (_a) {
|
|
|
19
19
|
children,
|
|
20
20
|
react_1.default.createElement(timestamp_1.default, { name: userLabel, timestamp: timestamp })));
|
|
21
21
|
};
|
|
22
|
-
var StyledUserMessage = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left:
|
|
22
|
+
var StyledUserMessage = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left: 10%;\n width: 90%;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n"], ["\n margin-left: 10%;\n width: 90%;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n"])));
|
|
23
23
|
exports.default = UserMessage;
|
|
24
24
|
var templateObject_1;
|
package/lib-esm/agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Symbol } from '@telia-ace/widget-ui';
|
|
2
2
|
import { ConversationEntry } from './conversation-controller';
|
|
3
3
|
import { ConversationProvider } from './conversation-provider';
|
|
4
|
-
import { ConversationMessageSettings } from './types';
|
|
4
|
+
import { ConversationMessageSettings, ConverstationMessageItem } from './types';
|
|
5
5
|
export declare type AgentSettings = {
|
|
6
6
|
name?: string;
|
|
7
7
|
avatar?: string | Symbol;
|
|
@@ -11,7 +11,7 @@ export declare class Agent {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
avatar?: string | Symbol;
|
|
13
13
|
constructor(provider: ConversationProvider, settings: AgentSettings);
|
|
14
|
-
print: (settings: string | ConversationMessageSettings) => ConversationEntry | undefined;
|
|
14
|
+
print: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]) => ConversationEntry | undefined;
|
|
15
15
|
typing: () => (() => void) | undefined;
|
|
16
16
|
update(settings: AgentSettings): void;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Container, EventListener, EventManager } from '@webprovisions/platform';
|
|
2
2
|
import { ConversationProvider } from './conversation-provider';
|
|
3
|
-
import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings, ConversationMessageUpdateSettings, NormalizedMessageSettings } from './types';
|
|
3
|
+
import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings, ConversationMessageUpdateSettings, ConverstationMessageItem, NormalizedMessageSettings } from './types';
|
|
4
4
|
import { User } from './user';
|
|
5
5
|
export declare type ValidateHandler = (formValues: {
|
|
6
6
|
[key: string]: any;
|
|
@@ -20,8 +20,9 @@ export declare type CancelLoaderDelegate = () => void;
|
|
|
20
20
|
export declare class ConversationEntry {
|
|
21
21
|
private writer;
|
|
22
22
|
constructor(writer: EntryWriter);
|
|
23
|
-
update(content: string | ConversationMessageUpdateSettings): void;
|
|
23
|
+
update(content: string | ConversationMessageUpdateSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]): void;
|
|
24
24
|
remove(): void;
|
|
25
|
+
private getNormalizedSettings;
|
|
25
26
|
}
|
|
26
27
|
export declare enum ConversationMessageType {
|
|
27
28
|
User = "user",
|
|
@@ -36,7 +37,7 @@ export declare type ConversationMessage = {
|
|
|
36
37
|
type: ConversationMessageType;
|
|
37
38
|
};
|
|
38
39
|
export declare type EntryWriter = (content: ConversationMessageUpdateSettings | null) => void;
|
|
39
|
-
export declare const getNormalizedMessageSettings: (settings: string | ConversationMessageSettings) => NormalizedMessageSettings;
|
|
40
|
+
export declare const getNormalizedMessageSettings: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]) => NormalizedMessageSettings;
|
|
40
41
|
/**
|
|
41
42
|
* Manages the stream of messages inside a `ConversationComponent` and provides external read-write
|
|
42
43
|
* access to it as well as exposing emitted actions.
|
|
@@ -29,12 +29,21 @@ var ConversationEntry = /** @class */ (function () {
|
|
|
29
29
|
this.writer = writer;
|
|
30
30
|
}
|
|
31
31
|
ConversationEntry.prototype.update = function (content) {
|
|
32
|
-
var normalized =
|
|
32
|
+
var normalized = this.getNormalizedSettings(content);
|
|
33
|
+
// const normalized = typeof content === 'string' ? { body: content } : content;
|
|
33
34
|
this.writer(normalized);
|
|
34
35
|
};
|
|
35
36
|
ConversationEntry.prototype.remove = function () {
|
|
36
37
|
this.writer(null);
|
|
37
38
|
};
|
|
39
|
+
ConversationEntry.prototype.getNormalizedSettings = function (content) {
|
|
40
|
+
if (typeof content === 'string')
|
|
41
|
+
return { body: content };
|
|
42
|
+
else if (content.length > -1 && typeof content === 'object')
|
|
43
|
+
return { items: content };
|
|
44
|
+
else
|
|
45
|
+
return content;
|
|
46
|
+
};
|
|
38
47
|
return ConversationEntry;
|
|
39
48
|
}());
|
|
40
49
|
export { ConversationEntry };
|
|
@@ -48,32 +57,43 @@ export var getNormalizedMessageSettings = function (settings) {
|
|
|
48
57
|
var content;
|
|
49
58
|
var key = uuid();
|
|
50
59
|
var timestamp = Date.now();
|
|
51
|
-
if (
|
|
52
|
-
|
|
60
|
+
if (Array.isArray(settings) && settings.length > -1) {
|
|
61
|
+
if (typeof settings[0] === 'string') {
|
|
62
|
+
content = { items: [settings] };
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
content = { items: settings };
|
|
66
|
+
}
|
|
53
67
|
}
|
|
54
|
-
else if (settings
|
|
55
|
-
content =
|
|
68
|
+
else if (typeof settings === 'string') {
|
|
69
|
+
content = { body: settings };
|
|
56
70
|
}
|
|
57
71
|
else {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
title: settings.title,
|
|
62
|
-
};
|
|
63
|
-
if (settings.key) {
|
|
64
|
-
key = settings.key;
|
|
72
|
+
settings = settings || {};
|
|
73
|
+
if (settings.type) {
|
|
74
|
+
content = __assign({}, settings);
|
|
65
75
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
else {
|
|
77
|
+
content = {
|
|
78
|
+
body: settings.body,
|
|
79
|
+
actions: settings.actions,
|
|
80
|
+
title: settings.title,
|
|
81
|
+
};
|
|
82
|
+
if (settings.key) {
|
|
83
|
+
key = settings.key;
|
|
84
|
+
}
|
|
85
|
+
if (settings.timestamp) {
|
|
86
|
+
timestamp = settings.timestamp;
|
|
87
|
+
}
|
|
88
|
+
if (settings.form) {
|
|
89
|
+
var builder = FormBuilder.create(key);
|
|
90
|
+
settings.form(builder);
|
|
91
|
+
var builtForm = builder.get();
|
|
92
|
+
content.form = builtForm;
|
|
93
|
+
}
|
|
94
|
+
if (settings.timestamp === null) {
|
|
95
|
+
timestamp = null;
|
|
96
|
+
}
|
|
77
97
|
}
|
|
78
98
|
}
|
|
79
99
|
return { content: content, key: key, timestamp: timestamp };
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ConversationEndedBehavior, ConversationPlatform, UnregisterControllerDelegate } from './conversation-platform';
|
|
2
2
|
export { ConversationController, ConversationEntry, ConversationMessageType, } from './conversation-controller';
|
|
3
3
|
export type { ConversationMessage } from './conversation-controller';
|
|
4
|
-
export
|
|
4
|
+
export { ConversationMessageListItemType } from './types';
|
|
5
|
+
export type { ConversationMessageContent, ConversationMessageSender, ConverstationMessageItem, } from './types';
|
|
5
6
|
export { ConversationComponent, ConversationReturnButtonComponent } from './ui';
|
|
6
7
|
export { registerCustomMessageComponent } from './utils/custom-message';
|
|
7
8
|
export { ConversationPlatform, ConversationEndedBehavior };
|
package/lib-esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConversationEndedBehavior, ConversationPlatform, } from './conversation-platform';
|
|
2
2
|
export { ConversationController, ConversationEntry, ConversationMessageType, } from './conversation-controller';
|
|
3
|
+
export { ConversationMessageListItemType } from './types';
|
|
3
4
|
export { ConversationComponent, ConversationReturnButtonComponent } from './ui';
|
|
4
5
|
export { registerCustomMessageComponent } from './utils/custom-message';
|
|
5
6
|
export { ConversationPlatform, ConversationEndedBehavior };
|
package/lib-esm/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare type ConversationMessageSettings = {
|
|
|
10
10
|
};
|
|
11
11
|
form?: (builder: FormBuilder) => void;
|
|
12
12
|
type?: string;
|
|
13
|
+
items?: ConversationMessageList[];
|
|
13
14
|
[key: string]: any;
|
|
14
15
|
};
|
|
15
16
|
export declare type NormalizedMessageSettings = {
|
|
@@ -17,15 +18,34 @@ export declare type NormalizedMessageSettings = {
|
|
|
17
18
|
key: string;
|
|
18
19
|
timestamp: number | null;
|
|
19
20
|
};
|
|
21
|
+
export declare type ConversationMessageList = {
|
|
22
|
+
header?: string;
|
|
23
|
+
itemKey: string;
|
|
24
|
+
type?: ConversationMessageListType;
|
|
25
|
+
items: ConversationMessageListItem[];
|
|
26
|
+
};
|
|
27
|
+
export declare type ConversationMessageListItem = {
|
|
28
|
+
icon?: string;
|
|
29
|
+
type?: ConversationMessageListItemType;
|
|
30
|
+
actions?: {
|
|
31
|
+
[actionKey: string]: any;
|
|
32
|
+
};
|
|
33
|
+
form?: Form;
|
|
34
|
+
body?: string;
|
|
35
|
+
key: string;
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
20
38
|
export declare type ConversationMessageContent = {
|
|
21
39
|
title?: string;
|
|
22
40
|
body?: string;
|
|
23
41
|
actions?: {
|
|
24
42
|
[actionKey: string]: any;
|
|
25
43
|
};
|
|
44
|
+
items?: ConverstationMessageItem<any>[];
|
|
26
45
|
form?: Form;
|
|
27
46
|
[key: string]: any;
|
|
28
47
|
};
|
|
48
|
+
export declare type ConverstationMessageItem<T, R = ItemPayload> = R extends [T, any] ? R : never;
|
|
29
49
|
export declare type ConversationMessageUpdateSettings = ConversationMessageContent & {
|
|
30
50
|
timestamp?: number;
|
|
31
51
|
};
|
|
@@ -33,3 +53,58 @@ export declare type ConversationMessageSender = {
|
|
|
33
53
|
name?: string;
|
|
34
54
|
avatar?: string | Symbol;
|
|
35
55
|
};
|
|
56
|
+
export declare enum ConversationMessageListType {
|
|
57
|
+
Ordinary = "ordinary",
|
|
58
|
+
Seperator = "seperator"
|
|
59
|
+
}
|
|
60
|
+
export declare enum ConversationMessageListItemType {
|
|
61
|
+
Header = "header",
|
|
62
|
+
LinkList = "link-list",
|
|
63
|
+
Separator = "separator",
|
|
64
|
+
NoGoodAlternative = "no-good-alternative",
|
|
65
|
+
ButtonList = "button-list",
|
|
66
|
+
Text = "text",
|
|
67
|
+
HTML = "html",
|
|
68
|
+
FeedbackList = "feedback-list"
|
|
69
|
+
}
|
|
70
|
+
declare type LinkListItem = [
|
|
71
|
+
ConversationMessageListItemType.LinkList,
|
|
72
|
+
{
|
|
73
|
+
actions: {
|
|
74
|
+
[key: string]: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
declare type HeaderItem = [ConversationMessageListItemType.Header, string];
|
|
79
|
+
declare type TextItem = [ConversationMessageListItemType.Text, string];
|
|
80
|
+
declare type SeparatorItem = [ConversationMessageListItemType.Separator, undefined];
|
|
81
|
+
declare type NoGoodAlternativeItem = [
|
|
82
|
+
ConversationMessageListItemType.NoGoodAlternative,
|
|
83
|
+
{
|
|
84
|
+
body: string;
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
declare type ButtonListItem = [
|
|
88
|
+
ConversationMessageListItemType.ButtonList,
|
|
89
|
+
{
|
|
90
|
+
actions: {
|
|
91
|
+
[key: string]: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
declare type FeedbackListItem = [
|
|
96
|
+
ConversationMessageListItemType.FeedbackList,
|
|
97
|
+
{
|
|
98
|
+
actions: {
|
|
99
|
+
[key: string]: string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
declare type HTMLItem = [
|
|
104
|
+
ConversationMessageListItemType.HTML,
|
|
105
|
+
{
|
|
106
|
+
body: string;
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
declare type ItemPayload = LinkListItem | HeaderItem | TextItem | SeparatorItem | NoGoodAlternativeItem | ButtonListItem | HTMLItem | FeedbackListItem;
|
|
110
|
+
export {};
|
package/lib-esm/types.js
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var ConversationMessageListType;
|
|
2
|
+
(function (ConversationMessageListType) {
|
|
3
|
+
ConversationMessageListType["Ordinary"] = "ordinary";
|
|
4
|
+
ConversationMessageListType["Seperator"] = "seperator";
|
|
5
|
+
})(ConversationMessageListType || (ConversationMessageListType = {}));
|
|
6
|
+
export var ConversationMessageListItemType;
|
|
7
|
+
(function (ConversationMessageListItemType) {
|
|
8
|
+
ConversationMessageListItemType["Header"] = "header";
|
|
9
|
+
ConversationMessageListItemType["LinkList"] = "link-list";
|
|
10
|
+
ConversationMessageListItemType["Separator"] = "separator";
|
|
11
|
+
ConversationMessageListItemType["NoGoodAlternative"] = "no-good-alternative";
|
|
12
|
+
ConversationMessageListItemType["ButtonList"] = "button-list";
|
|
13
|
+
ConversationMessageListItemType["Text"] = "text";
|
|
14
|
+
ConversationMessageListItemType["HTML"] = "html";
|
|
15
|
+
ConversationMessageListItemType["FeedbackList"] = "feedback-list";
|
|
16
|
+
})(ConversationMessageListItemType || (ConversationMessageListItemType = {}));
|
|
@@ -13,10 +13,28 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
+
if (!m) return o;
|
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
}
|
|
23
|
+
catch (error) { e = { error: error }; }
|
|
24
|
+
finally {
|
|
25
|
+
try {
|
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
+
}
|
|
28
|
+
finally { if (e) throw e.error; }
|
|
29
|
+
}
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
16
32
|
import { FormComponent } from '@telia-ace/widget-forms';
|
|
17
|
-
import { borderTabStyle, buttonCss, Html, invertedHoverButton, Lightbox, List, useDispatch, } from '@telia-ace/widget-ui';
|
|
18
|
-
import
|
|
33
|
+
import { borderTabStyle, buttonCss, Html, Icon, invertedHoverButton, Lightbox, List, SymbolBadge, useDispatch, } from '@telia-ace/widget-ui';
|
|
34
|
+
import { uuid } from '@telia-ace/widget-utilities';
|
|
35
|
+
import React, { Fragment } from 'react';
|
|
19
36
|
import styled, { css } from 'styled-components';
|
|
37
|
+
import { ConversationMessageListItemType, } from '../../types';
|
|
20
38
|
import { MessageContent, MessageContentPart as Part, MessageTitle } from './conversation-styles';
|
|
21
39
|
import { CustomMessage } from './message-types';
|
|
22
40
|
var imageLightboxRenderer = function (attrs) { return React.createElement(Lightbox, { attrs: attrs }); };
|
|
@@ -28,10 +46,10 @@ var htmlParseInstructions = {
|
|
|
28
46
|
var ConversationContent = function (_a) {
|
|
29
47
|
var content = _a.content, isUser = _a.isUser, stacked = _a.stacked;
|
|
30
48
|
var dispatch = useDispatch();
|
|
31
|
-
var title = content.title, body = content.body, actions = content.actions, form = content.form, type = content.type;
|
|
49
|
+
var title = content.title, body = content.body, actions = content.actions, form = content.form, type = content.type, items = content.items;
|
|
32
50
|
if (type)
|
|
33
51
|
return React.createElement(CustomMessage, { type: type, content: content, isUser: isUser, stacked: stacked });
|
|
34
|
-
return (React.createElement(MessageContent, { user: isUser, stacked: !!stacked && stacked, fullWidth: !!form || !!actions },
|
|
52
|
+
return (React.createElement(MessageContent, { noPadding: true, user: isUser, stacked: !!stacked && stacked, fullWidth: !!form || !!actions },
|
|
35
53
|
title && (React.createElement(Part, null,
|
|
36
54
|
React.createElement(MessageTitle, { variant: "h2" }, title))),
|
|
37
55
|
body && (React.createElement(Part, null,
|
|
@@ -52,7 +70,100 @@ var ConversationContent = function (_a) {
|
|
|
52
70
|
React.createElement(StyledActionButton, { onClick: function () {
|
|
53
71
|
dispatch('action', item.actionKey);
|
|
54
72
|
} }, item.label)));
|
|
55
|
-
} })))
|
|
73
|
+
} }))),
|
|
74
|
+
items && (React.createElement(Fragment, null,
|
|
75
|
+
React.createElement(Part, { key: uuid(), noPadding: true },
|
|
76
|
+
React.createElement(StyledActionList, { items: items.map(function (_a) {
|
|
77
|
+
var _b = __read(_a, 2), type = _b[0], content = _b[1];
|
|
78
|
+
return { type: type, content: content };
|
|
79
|
+
}), renderItem: function (item) {
|
|
80
|
+
var itemKey = uuid();
|
|
81
|
+
switch (item.type) {
|
|
82
|
+
case ConversationMessageListItemType.Header: {
|
|
83
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
84
|
+
React.createElement(HeaderText, null, item.content)));
|
|
85
|
+
}
|
|
86
|
+
case ConversationMessageListItemType.Text: {
|
|
87
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
88
|
+
React.createElement("span", null, item.content)));
|
|
89
|
+
}
|
|
90
|
+
case ConversationMessageListItemType.HTML: {
|
|
91
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
92
|
+
React.createElement(StyledHtml, { html: item.content.body, htmlParseInstruction: htmlParseInstructions })));
|
|
93
|
+
}
|
|
94
|
+
case ConversationMessageListItemType.Separator: {
|
|
95
|
+
return (React.createElement(ConversationListItem, { key: itemKey, noPadding: true },
|
|
96
|
+
React.createElement(SeparatorPadding, null,
|
|
97
|
+
React.createElement(Separator, null))));
|
|
98
|
+
}
|
|
99
|
+
case ConversationMessageListItemType.LinkList: {
|
|
100
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
101
|
+
React.createElement(StyledLinkList, { items: Object.keys(item.content.actions).map(function (i) {
|
|
102
|
+
return {
|
|
103
|
+
label: item.content.actions[i],
|
|
104
|
+
actionKey: i,
|
|
105
|
+
};
|
|
106
|
+
}), renderItem: function (item) {
|
|
107
|
+
return (React.createElement("li", { key: item.actionKey },
|
|
108
|
+
React.createElement(StyledLinkButton, { help: item.actionKey === 'help', onClick: function () {
|
|
109
|
+
dispatch('action', item.actionKey);
|
|
110
|
+
} },
|
|
111
|
+
item.label,
|
|
112
|
+
item.actionKey === 'help' && (React.createElement(SymbolBadge, { size: 14, symbol: {
|
|
113
|
+
type: 'Svg',
|
|
114
|
+
content: 'caret-down',
|
|
115
|
+
} })))));
|
|
116
|
+
} })));
|
|
117
|
+
}
|
|
118
|
+
case ConversationMessageListItemType.ButtonList: {
|
|
119
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
120
|
+
React.createElement(StyledButtonList, { items: Object.keys(item.content.actions).map(function (i) {
|
|
121
|
+
return {
|
|
122
|
+
label: item.content.actions[i],
|
|
123
|
+
actionKey: i,
|
|
124
|
+
};
|
|
125
|
+
}), renderItem: function (item) {
|
|
126
|
+
return (React.createElement("li", { key: item.actionKey },
|
|
127
|
+
React.createElement(StyledButtonListButton, { onClick: function () {
|
|
128
|
+
dispatch('action', item.actionKey);
|
|
129
|
+
} }, item.label)));
|
|
130
|
+
} })));
|
|
131
|
+
}
|
|
132
|
+
case ConversationMessageListItemType.NoGoodAlternative: {
|
|
133
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
134
|
+
React.createElement(NoGoodAlternativeWrapper, { onClick: function () {
|
|
135
|
+
dispatch('action', 'help');
|
|
136
|
+
} },
|
|
137
|
+
React.createElement(SymbolBadge, { size: 14, symbol: {
|
|
138
|
+
type: 'FontAwesome',
|
|
139
|
+
content: 'meh-o',
|
|
140
|
+
} }),
|
|
141
|
+
React.createElement("span", null, item.content.body))));
|
|
142
|
+
}
|
|
143
|
+
case ConversationMessageListItemType.FeedbackList: {
|
|
144
|
+
return (React.createElement(ConversationListItem, { key: itemKey },
|
|
145
|
+
React.createElement(StyledButtonList, { items: Object.keys(item.content.actions).map(function (i) {
|
|
146
|
+
return {
|
|
147
|
+
label: item.content.actions[i],
|
|
148
|
+
actionKey: i,
|
|
149
|
+
};
|
|
150
|
+
}), renderItem: function (item) {
|
|
151
|
+
return (React.createElement(FeedbackItem, { key: item.actionKey },
|
|
152
|
+
React.createElement(FeedbackButton, { className: "humany-feedback-button", disabled: false, "aria-pressed": true, "data-selected": true, "data-direction": 'vertical', onClick: function () {
|
|
153
|
+
dispatch('action', item.actionKey);
|
|
154
|
+
} },
|
|
155
|
+
React.createElement(Icon, { faIcon: item.actionKey == 'yes'
|
|
156
|
+
? 'smile-o'
|
|
157
|
+
: 'frown-o' }),
|
|
158
|
+
React.createElement("span", null, item.label))));
|
|
159
|
+
} })));
|
|
160
|
+
}
|
|
161
|
+
default: {
|
|
162
|
+
return (React.createElement(Fragment, null,
|
|
163
|
+
React.createElement("p", null, "Unknown message type")));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} }))))));
|
|
56
167
|
};
|
|
57
168
|
var StyledForm = styled(FormComponent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n & button.humany-form-component-button {\n ", ";\n display: block;\n width: 100%;\n margin-bottom: ", ";\n }\n & button.humany-form-component-submit {\n width: 100%;\n margin: 0;\n :not(:last-child) {\n margin-bottom: ", ";\n }\n }\n"], ["\n & button.humany-form-component-button {\n ", ";\n display: block;\n width: 100%;\n margin-bottom: ", ";\n }\n & button.humany-form-component-submit {\n width: 100%;\n margin: 0;\n :not(:last-child) {\n margin-bottom: ", ";\n }\n }\n"])), function (p) {
|
|
58
169
|
var _a, _b;
|
|
@@ -64,9 +175,37 @@ var StyledForm = styled(FormComponent)(templateObject_1 || (templateObject_1 = _
|
|
|
64
175
|
}, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
65
176
|
var StyledHtml = styled(Html)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n white-space: pre-wrap;\n a {\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"], ["\n white-space: pre-wrap;\n a {\n color: ", ";\n &:focus {\n ", ";\n }\n }\n"])), function (p) { return p.theme.colors.link; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
66
177
|
var StyledActionList = styled(List)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 0;\n list-style: none;\n margin: 0 -", ";\n > li {\n margin: ", ";\n }\n"], ["\n padding: 0;\n list-style: none;\n margin: 0 -", ";\n > li {\n margin: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
67
|
-
var
|
|
178
|
+
var StyledButtonList = styled(List)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 0;\n list-style: none;\n > li {\n margin: ", " ", ";\n margin-left: 0;\n display: inline-block;\n }\n"], ["\n padding: 0;\n list-style: none;\n > li {\n margin: ", " ", ";\n margin-left: 0;\n display: inline-block;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
179
|
+
var StyledButtonListButton = styled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n display: block;\n background-color: ", ";\n width: 100%;\n color: #fff;\n &:focus {\n ", "\n }\n"], ["\n ", ";\n display: block;\n background-color: ", ";\n width: 100%;\n color: #fff;\n &:focus {\n ", "\n }\n"])), buttonCss, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) {
|
|
180
|
+
var _a;
|
|
181
|
+
return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n background-color: transparent;\n "], ["\n ", "\n background-color: transparent;\n "])), borderTabStyle);
|
|
182
|
+
});
|
|
183
|
+
var StyledLinkList = styled(List)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding: 0;\n list-style: none;\n > li {\n margin-bottom: ", ";\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n"], ["\n padding: 0;\n list-style: none;\n > li {\n margin-bottom: ", ";\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
184
|
+
var HeaderText = styled.strong(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-size: ", ";\n"], ["\n font-size: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; });
|
|
185
|
+
var StyledLinkButton = styled.button(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: block;\n background-color: transparent;\n text-align: left;\n border: none;\n padding: 0;\n font-weight: 300;\n font-family: inherit;\n cursor: pointer;\n color: ", ";\n\n ", "\n"], ["\n display: block;\n background-color: transparent;\n text-align: left;\n border: none;\n padding: 0;\n font-weight: 300;\n font-family: inherit;\n cursor: pointer;\n color: ", ";\n\n ", "\n"])), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
return p.help && css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n color: ", ";\n text-decoration: underline;\n\n i,\n svg {\n margin-left: ", ";\n }\n "], ["\n color: ", ";\n text-decoration: underline;\n\n i,\n svg {\n margin-left: ", ";\n }\n "])), (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text, (_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small);
|
|
188
|
+
});
|
|
189
|
+
var StyledActionButton = styled.button(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n ", ";\n display: block;\n background-color: ", ";\n width: 100%;\n color: #fff;\n font-family: Lato;\n font-size: ", ";\n font-weight: 300;\n &:focus {\n ", "\n }\n"], ["\n ", ";\n display: block;\n background-color: ", ";\n width: 100%;\n color: #fff;\n font-family: Lato;\n font-size: ", ";\n font-weight: 300;\n &:focus {\n ", "\n }\n"])), buttonCss, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.huge; }, function (p) {
|
|
68
190
|
var _a;
|
|
69
|
-
return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(
|
|
191
|
+
return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", "\n background-color: transparent;\n "], ["\n ", "\n background-color: transparent;\n "])), borderTabStyle);
|
|
70
192
|
});
|
|
193
|
+
var SeparatorPadding = styled.div(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n padding-top: calc(", " - ", ");\n padding-bottom: calc(", " - ", ");\n"], ["\n padding-top: calc(", " - ", ");\n padding-bottom: calc(", " - ", ");\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
194
|
+
var Separator = styled.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: #efefef;\n height: 1px;\n width: 100%;\n"], ["\n background-color: #efefef;\n height: 1px;\n width: 100%;\n"])));
|
|
195
|
+
var NoGoodAlternativeWrapper = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n > i,\n svg {\n margin-right: ", ";\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n\n > i,\n svg {\n margin-right: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
196
|
+
var ConversationListItem = styled.li(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n"], ["\n padding-left: ", ";\n padding-right: ", ";\n"])), function (p) { var _a; return (p.noPadding ? 0 : (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium); }, function (p) { var _a; return (p.noPadding ? 0 : (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium); });
|
|
197
|
+
var FeedbackItem = styled.li(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n @media (min-width: 768px) {\n display: list-item !important;\n margin-right: 0 !important;\n margin-top: ", " !important;\n }\n"], ["\n @media (min-width: 768px) {\n display: list-item !important;\n margin-right: 0 !important;\n margin-top: ", " !important;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
198
|
+
var FeedbackButton = styled.button(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n @media (min-width: 768px) {\n min-width: 100%;\n margin-right: 0;\n }\n display: inline-block;\n font-size: ", ";\n border-color: ", " !important;\n font-weight: 300;\n && {\n margin-right: ", ";\n }\n ", "\n ", "\n ", "\n i {\n margin: 0 ", " 0 0;\n }\n span {\n }\n"], ["\n @media (min-width: 768px) {\n min-width: 100%;\n margin-right: 0;\n }\n display: inline-block;\n font-size: ", ";\n border-color: ", " !important;\n font-weight: 300;\n && {\n margin-right: ", ";\n }\n ", "\n ", "\n ", "\n i {\n margin: 0 ", " 0 0;\n }\n span {\n }\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
return p['data-direction'] === 'horizontal' && css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n width: 225px;\n max-width: calc(50% - ", " - ", ");\n "], ["\n width: 225px;\n max-width: calc(50% - ", " - ", ");\n "])), (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large, (_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.small);
|
|
201
|
+
}, function (p) {
|
|
202
|
+
return p['data-direction'] === 'vertical' && css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n min-width: 150px;\n "], ["\n min-width: 150px;\n "])));
|
|
203
|
+
}, function (p) {
|
|
204
|
+
var _a;
|
|
205
|
+
return invertedHoverButton({
|
|
206
|
+
primaryColor: "".concat((_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary),
|
|
207
|
+
secondaryColor: '#FFFFFF',
|
|
208
|
+
});
|
|
209
|
+
}, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
|
|
71
210
|
export default ConversationContent;
|
|
72
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
211
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20;
|
|
@@ -78,6 +78,10 @@ var ConversationInput = function (_a) {
|
|
|
78
78
|
e.preventDefault();
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
var getCategories = function (e) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
dispatch('action', 'burger-clicked');
|
|
84
|
+
};
|
|
81
85
|
var calculateHeight = function (value) {
|
|
82
86
|
if (multiline && inputRef.current) {
|
|
83
87
|
var scrollHeight = inputRef.current.scrollHeight;
|
|
@@ -108,6 +112,8 @@ var ConversationInput = function (_a) {
|
|
|
108
112
|
return null;
|
|
109
113
|
}
|
|
110
114
|
return (React.createElement(Wrapper, { grow: multiline, className: appendClassNames('humany-conversation-input', className), "data-has-focus": inputFocus, scrollableCss: scrollableCss },
|
|
115
|
+
React.createElement(StyledButton, { disabled: inputDisabled, onClick: getCategories, title: sendButtonLabel, "aria-label": sendButtonLabel },
|
|
116
|
+
React.createElement(SymbolBadge, { size: 22, symbol: { type: 'Svg', content: 'options' } })),
|
|
111
117
|
multiline ? (React.createElement(StyledTextArea, { value: inputText, onChange: onChange, onEnter: submit, disabled: inputDisabled, "aria-label": inputPlaceholder, placeholder: inputPlaceholder, onFocusChange: setInputFocus, type: 'textarea', rows: 1, ref: inputRef })) : (React.createElement(StyledInput, { value: inputText, onChange: onChange, onEnter: submit, disabled: inputDisabled, "aria-label": inputPlaceholder, placeholder: inputPlaceholder, onFocusChange: setInputFocus })),
|
|
112
118
|
React.createElement(StyledButton, { disabled: inputDisabled, onClick: submit, title: sendButtonLabel, "aria-label": sendButtonLabel },
|
|
113
119
|
React.createElement(SendSymbol, { size: 22, symbol: { type: 'Svg', content: 'send' }, hasContent: inputText && inputText.length }))));
|
|
@@ -6,4 +6,6 @@ export declare const ContentBundle: import("styled-components").StyledComponent<
|
|
|
6
6
|
export declare const MessageTitle: import("styled-components").StyledComponent<import("react").FC<import("@telia-ace/widget-ui").TypographyProps>, any, {}, never>;
|
|
7
7
|
export declare const MessageContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const MessageContent: import("styled-components").StyledComponent<"div", any, any, never>;
|
|
9
|
-
export declare const MessageContentPart: import("styled-components").StyledComponent<"div", any, {
|
|
9
|
+
export declare const MessageContentPart: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
noPadding?: boolean | undefined;
|
|
11
|
+
}, never>;
|
|
@@ -4,13 +4,13 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import { Typography } from '@telia-ace/widget-ui';
|
|
6
6
|
import styled, { css, keyframes } from 'styled-components';
|
|
7
|
-
export var Avatar = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border-radius: 50%;\n background-color: ", ";\n border: ", ";\n grid-area: avatar;\n align-self: flex-end;\n justify-self: center;\n overflow: hidden;\n margin-right:
|
|
7
|
+
export var Avatar = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border-radius: 50%;\n background-color: ", ";\n border: ", ";\n grid-area: avatar;\n align-self: flex-end;\n justify-self: center;\n overflow: hidden;\n margin-right: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n color: ", ";\n\n > img {\n height: 100%;\n width: 100%;\n object-fit: cover;\n }\n\n > svg {\n width: 90%;\n height: 90%;\n padding: 10%;\n color: ", ";\n\n line,\n path,\n circle,\n fill {\n stroke: ", ";\n }\n }\n"], ["\n width: ", ";\n height: ", ";\n border-radius: 50%;\n background-color: ", ";\n border: ", ";\n grid-area: avatar;\n align-self: flex-end;\n justify-self: center;\n overflow: hidden;\n margin-right: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n color: ", ";\n\n > img {\n height: 100%;\n width: 100%;\n object-fit: cover;\n }\n\n > svg {\n width: 90%;\n height: 90%;\n padding: 10%;\n color: ", ";\n\n line,\n path,\n circle,\n fill {\n stroke: ", ";\n }\n }\n"])), function (p) { return p.avatarSize || '32px'; }, function (p) { return p.avatarSize || '32px'; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.accent; }, function (p) { return p.theme.border; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; });
|
|
8
8
|
export var LoaderAnimation = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {\n opacity: 0;\n }\n 75% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n }\n 75% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n"])));
|
|
9
9
|
export var Loader = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n > div {\n height: 10px;\n width: 10px;\n border-radius: 50%;\n margin: 5px;\n background-color: ", ";\n animation: ", " 1s infinite;\n }\n > div:nth-child(2) {\n animation-delay: 100ms;\n }\n > div:nth-child(3) {\n animation-delay: 200ms;\n }\n"], ["\n display: flex;\n justify-content: center;\n > div {\n height: 10px;\n width: 10px;\n border-radius: 50%;\n margin: 5px;\n background-color: ", ";\n animation: ", " 1s infinite;\n }\n > div:nth-child(2) {\n animation-delay: 100ms;\n }\n > div:nth-child(3) {\n animation-delay: 200ms;\n }\n"])), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, LoaderAnimation);
|
|
10
|
-
export var ContentBundle = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n grid-area: content;\n max-width: 100%;\n overflow:
|
|
10
|
+
export var ContentBundle = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n grid-area: content;\n max-width: 100%;\n overflow: hidden;\n"], ["\n grid-area: content;\n max-width: 100%;\n overflow: hidden;\n"])));
|
|
11
11
|
export var MessageTitle = styled(Typography)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: normal;\n margin: 0;\n"], ["\n font-size: ", ";\n font-weight: normal;\n margin: 0;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
12
12
|
export var MessageContainer = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
13
|
-
export var MessageContent = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n
|
|
13
|
+
export var MessageContent = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n border-radius: 5px; // TODO: prop?\n border: 1px solid rgb(231, 231, 231);\n padding-top: calc(", " - ", ");\n padding-bottom: calc(", " - ", ");\n margin-top: ", ";\n display: inline-block;\n && > * {\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-all;\n word-break: break-word;\n hyphens: auto;\n }\n max-width: 100%;\n ", "\n\n ", "\n ", ";\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\n ", ";\n\n transition: border-radius 500ms linear;\n"], ["\n background-color: ", ";\n color: ", ";\n border-radius: 5px; // TODO: prop?\n border: 1px solid rgb(231, 231, 231);\n padding-top: calc(", " - ", ");\n padding-bottom: calc(", " - ", ");\n margin-top: ", ";\n display: inline-block;\n && > * {\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-all;\n word-break: break-word;\n hyphens: auto;\n }\n max-width: 100%;\n ", "\n\n ", "\n ", ";\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n\n ", ";\n\n transition: border-radius 500ms linear;\n"])), function (p) { var _a, _b; return (p.user ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.accent); }, function (p) { var _a, _b; return (p.user ? (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.accent : (_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.text); }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { return p.fullWidth && 'width: 100%;'; }, function (p) {
|
|
14
14
|
return !p.user && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border: ", ";\n "], ["\n border: ", ";\n "])), p.theme.border);
|
|
15
15
|
}, function (p) { return p.user && 'margin-left: auto'; }, function (p) {
|
|
16
16
|
return p.stacked === 'first' &&
|
|
@@ -33,5 +33,7 @@ export var MessageContent = styled.div(templateObject_15 || (templateObject_15 =
|
|
|
33
33
|
}, function (p) {
|
|
34
34
|
return !p.stacked && css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), p.user ? 'border-bottom-right-radius: 1px;' : 'border-bottom-left-radius: 1px;');
|
|
35
35
|
});
|
|
36
|
-
export var MessageContentPart = styled.div(
|
|
37
|
-
|
|
36
|
+
export var MessageContentPart = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n padding: ", " ", ";\n\n ", "\n\n margin-bottom: ", ";\n &:last-child {\n margin-bottom: 0;\n }\n"], ["\n padding: ", " ", ";\n\n ", "\n\n margin-bottom: ", ";\n &:last-child {\n margin-bottom: 0;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) {
|
|
37
|
+
return p.noPadding && css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n padding: 0;\n "], ["\n padding: 0;\n "])));
|
|
38
|
+
}, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
|
|
39
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
|
|
@@ -105,7 +105,7 @@ var Conversation = function (_a) {
|
|
|
105
105
|
React.createElement(ConversationInput, null)));
|
|
106
106
|
};
|
|
107
107
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n right: 0;\n left: 0;\n bottom: 0;\n top: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n"], ["\n position: absolute;\n right: 0;\n left: 0;\n bottom: 0;\n top: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n"])));
|
|
108
|
-
var Scrollable = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: stretch;\n flex: 0 1 100%;\n padding: 0 ", ";\n ", ";\n &:focus {\n ", ";\n }\n"], ["\n display: flex;\n flex-direction: column;\n align-items: stretch;\n flex: 0 1 100%;\n padding: 0 ", ";\n ", ";\n &:focus {\n ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.
|
|
108
|
+
var Scrollable = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: stretch;\n flex: 0 1 100%;\n padding: 0 ", ";\n ", ";\n &:focus {\n ", ";\n }\n"], ["\n display: flex;\n flex-direction: column;\n align-items: stretch;\n flex: 0 1 100%;\n padding: 0 ", ";\n ", ";\n &:focus {\n ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { return !!p.scrollableCss && p.scrollableCss; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
109
109
|
var MessageEntry = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0;\n margin-bottom: ", ";\n\n &:first-of-type {\n margin-top: ", ";\n }\n\n &:last-of-type {\n padding-bottom: ", ";\n }\n\n * {\n font-size: ", ";\n }\n\n & span,\n p,\n a,\n div {\n font-weight: 300;\n }\n\n & b,\n h1 {\n font-weight: normal;\n }\n\n ", "\n"], ["\n margin: 0;\n margin-bottom: ", ";\n\n &:first-of-type {\n margin-top: ", ";\n }\n\n &:last-of-type {\n padding-bottom: ", ";\n }\n\n * {\n font-size: ", ";\n }\n\n & span,\n p,\n a,\n div {\n font-weight: 300;\n }\n\n & b,\n h1 {\n font-weight: normal;\n }\n\n ", "\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, headingElement('h1', css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-weight: normal;\n "], ["\n font-weight: normal;\n "])))));
|
|
110
110
|
export default Conversation;
|
|
111
111
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|