@pega/cosmos-react-social 5.0.0-dev.4.7 → 5.0.0-dev.4.8
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/package.json +4 -4
- package/lib/components/Autopilot/Autopilot.d.ts +0 -15
- package/lib/components/Autopilot/Autopilot.d.ts.map +0 -1
- package/lib/components/Autopilot/Autopilot.js +0 -50
- package/lib/components/Autopilot/Autopilot.js.map +0 -1
- package/lib/components/Autopilot/AutopilotAvatar.d.ts +0 -8
- package/lib/components/Autopilot/AutopilotAvatar.d.ts.map +0 -1
- package/lib/components/Autopilot/AutopilotAvatar.js +0 -11
- package/lib/components/Autopilot/AutopilotAvatar.js.map +0 -1
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts +0 -9
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts.map +0 -1
- package/lib/components/Autopilot/AutopilotGlimpse.js +0 -24
- package/lib/components/Autopilot/AutopilotGlimpse.js.map +0 -1
- package/lib/components/Autopilot/index.d.ts +0 -4
- package/lib/components/Autopilot/index.d.ts.map +0 -1
- package/lib/components/Autopilot/index.js +0 -3
- package/lib/components/Autopilot/index.js.map +0 -1
- package/lib/components/Chat/Chat.d.ts +0 -29
- package/lib/components/Chat/Chat.d.ts.map +0 -1
- package/lib/components/Chat/Chat.js +0 -64
- package/lib/components/Chat/Chat.js.map +0 -1
- package/lib/components/Chat/Chat.types.d.ts +0 -136
- package/lib/components/Chat/Chat.types.d.ts.map +0 -1
- package/lib/components/Chat/Chat.types.js +0 -10
- package/lib/components/Chat/Chat.types.js.map +0 -1
- package/lib/components/Chat/ChatBody.d.ts +0 -7
- package/lib/components/Chat/ChatBody.d.ts.map +0 -1
- package/lib/components/Chat/ChatBody.js +0 -292
- package/lib/components/Chat/ChatBody.js.map +0 -1
- package/lib/components/Chat/ChatComposer.d.ts +0 -50
- package/lib/components/Chat/ChatComposer.d.ts.map +0 -1
- package/lib/components/Chat/ChatComposer.js +0 -221
- package/lib/components/Chat/ChatComposer.js.map +0 -1
- package/lib/components/Chat/ChatHeader.d.ts +0 -29
- package/lib/components/Chat/ChatHeader.d.ts.map +0 -1
- package/lib/components/Chat/ChatHeader.js +0 -44
- package/lib/components/Chat/ChatHeader.js.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.d.ts +0 -7
- package/lib/components/Chat/ChatSettingsPanel.d.ts.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.js +0 -15
- package/lib/components/Chat/ChatSettingsPanel.js.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +0 -16
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.js +0 -47
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +0 -1
- package/lib/components/Chat/Message.d.ts +0 -6
- package/lib/components/Chat/Message.d.ts.map +0 -1
- package/lib/components/Chat/Message.js +0 -98
- package/lib/components/Chat/Message.js.map +0 -1
- package/lib/components/Chat/Message.styles.d.ts +0 -43
- package/lib/components/Chat/Message.styles.d.ts.map +0 -1
- package/lib/components/Chat/Message.styles.js +0 -270
- package/lib/components/Chat/Message.styles.js.map +0 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +0 -42
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +0 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +0 -143
- package/lib/components/Chat/SuggestedReplyPicker.js.map +0 -1
- package/lib/components/Chat/SystemMessage.d.ts +0 -8
- package/lib/components/Chat/SystemMessage.d.ts.map +0 -1
- package/lib/components/Chat/SystemMessage.js +0 -50
- package/lib/components/Chat/SystemMessage.js.map +0 -1
- package/lib/components/Chat/TypeIndicator.d.ts +0 -6
- package/lib/components/Chat/TypeIndicator.d.ts.map +0 -1
- package/lib/components/Chat/TypeIndicator.js +0 -12
- package/lib/components/Chat/TypeIndicator.js.map +0 -1
- package/lib/components/Chat/index.d.ts +0 -15
- package/lib/components/Chat/index.d.ts.map +0 -1
- package/lib/components/Chat/index.js +0 -10
- package/lib/components/Chat/index.js.map +0 -1
- package/lib/components/Email/ContextMenuPopover.d.ts +0 -5
- package/lib/components/Email/ContextMenuPopover.d.ts.map +0 -1
- package/lib/components/Email/ContextMenuPopover.js +0 -53
- package/lib/components/Email/ContextMenuPopover.js.map +0 -1
- package/lib/components/Email/Email.d.ts +0 -7
- package/lib/components/Email/Email.d.ts.map +0 -1
- package/lib/components/Email/Email.js +0 -244
- package/lib/components/Email/Email.js.map +0 -1
- package/lib/components/Email/Email.styles.d.ts +0 -67
- package/lib/components/Email/Email.styles.d.ts.map +0 -1
- package/lib/components/Email/Email.styles.js +0 -392
- package/lib/components/Email/Email.styles.js.map +0 -1
- package/lib/components/Email/Email.types.d.ts +0 -394
- package/lib/components/Email/Email.types.d.ts.map +0 -1
- package/lib/components/Email/Email.types.js +0 -2
- package/lib/components/Email/Email.types.js.map +0 -1
- package/lib/components/Email/EmailCaseView.d.ts +0 -6
- package/lib/components/Email/EmailCaseView.d.ts.map +0 -1
- package/lib/components/Email/EmailCaseView.js +0 -36
- package/lib/components/Email/EmailCaseView.js.map +0 -1
- package/lib/components/Email/EmailComposer.d.ts +0 -10
- package/lib/components/Email/EmailComposer.d.ts.map +0 -1
- package/lib/components/Email/EmailComposer.js +0 -255
- package/lib/components/Email/EmailComposer.js.map +0 -1
- package/lib/components/Email/EmailConversation.d.ts +0 -17
- package/lib/components/Email/EmailConversation.d.ts.map +0 -1
- package/lib/components/Email/EmailConversation.js +0 -174
- package/lib/components/Email/EmailConversation.js.map +0 -1
- package/lib/components/Email/EmailEntity.d.ts +0 -11
- package/lib/components/Email/EmailEntity.d.ts.map +0 -1
- package/lib/components/Email/EmailEntity.js +0 -51
- package/lib/components/Email/EmailEntity.js.map +0 -1
- package/lib/components/Email/EmailManager.d.ts +0 -6
- package/lib/components/Email/EmailManager.d.ts.map +0 -1
- package/lib/components/Email/EmailManager.js +0 -21
- package/lib/components/Email/EmailManager.js.map +0 -1
- package/lib/components/Email/EmailNotificationPanel.d.ts +0 -7
- package/lib/components/Email/EmailNotificationPanel.d.ts.map +0 -1
- package/lib/components/Email/EmailNotificationPanel.js +0 -15
- package/lib/components/Email/EmailNotificationPanel.js.map +0 -1
- package/lib/components/Email/EmailSelector.d.ts +0 -22
- package/lib/components/Email/EmailSelector.d.ts.map +0 -1
- package/lib/components/Email/EmailSelector.js +0 -121
- package/lib/components/Email/EmailSelector.js.map +0 -1
- package/lib/components/Email/EmailShell.d.ts +0 -6
- package/lib/components/Email/EmailShell.d.ts.map +0 -1
- package/lib/components/Email/EmailShell.js +0 -46
- package/lib/components/Email/EmailShell.js.map +0 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +0 -11
- package/lib/components/Email/EmailSummaryItem.d.ts.map +0 -1
- package/lib/components/Email/EmailSummaryItem.js +0 -118
- package/lib/components/Email/EmailSummaryItem.js.map +0 -1
- package/lib/components/Email/EmailSummaryList.d.ts +0 -6
- package/lib/components/Email/EmailSummaryList.d.ts.map +0 -1
- package/lib/components/Email/EmailSummaryList.js +0 -95
- package/lib/components/Email/EmailSummaryList.js.map +0 -1
- package/lib/components/Email/EntityList.d.ts +0 -6
- package/lib/components/Email/EntityList.d.ts.map +0 -1
- package/lib/components/Email/EntityList.js +0 -74
- package/lib/components/Email/EntityList.js.map +0 -1
- package/lib/components/Email/index.d.ts +0 -13
- package/lib/components/Email/index.d.ts.map +0 -1
- package/lib/components/Email/index.js +0 -12
- package/lib/components/Email/index.js.map +0 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts +0 -10
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +0 -1
- package/lib/components/Email/utils/EntityHighlighter.js +0 -260
- package/lib/components/Email/utils/EntityHighlighter.js.map +0 -1
- package/lib/components/Feed/Feed.context.d.ts +0 -51
- package/lib/components/Feed/Feed.context.d.ts.map +0 -1
- package/lib/components/Feed/Feed.context.js +0 -10
- package/lib/components/Feed/Feed.context.js.map +0 -1
- package/lib/components/Feed/Feed.d.ts +0 -6
- package/lib/components/Feed/Feed.d.ts.map +0 -1
- package/lib/components/Feed/Feed.js +0 -149
- package/lib/components/Feed/Feed.js.map +0 -1
- package/lib/components/Feed/Feed.types.d.ts +0 -334
- package/lib/components/Feed/Feed.types.d.ts.map +0 -1
- package/lib/components/Feed/Feed.types.js +0 -2
- package/lib/components/Feed/Feed.types.js.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.d.ts +0 -6
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.js +0 -11
- package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
- package/lib/components/Feed/FeedAttachments.d.ts +0 -8
- package/lib/components/Feed/FeedAttachments.d.ts.map +0 -1
- package/lib/components/Feed/FeedAttachments.js +0 -97
- package/lib/components/Feed/FeedAttachments.js.map +0 -1
- package/lib/components/Feed/FeedButton.d.ts +0 -5
- package/lib/components/Feed/FeedButton.d.ts.map +0 -1
- package/lib/components/Feed/FeedButton.js +0 -15
- package/lib/components/Feed/FeedButton.js.map +0 -1
- package/lib/components/Feed/FeedContent.d.ts +0 -6
- package/lib/components/Feed/FeedContent.d.ts.map +0 -1
- package/lib/components/Feed/FeedContent.js +0 -46
- package/lib/components/Feed/FeedContent.js.map +0 -1
- package/lib/components/Feed/FeedContentFooter.d.ts +0 -5
- package/lib/components/Feed/FeedContentFooter.d.ts.map +0 -1
- package/lib/components/Feed/FeedContentFooter.js +0 -34
- package/lib/components/Feed/FeedContentFooter.js.map +0 -1
- package/lib/components/Feed/FeedContentHeader.d.ts +0 -5
- package/lib/components/Feed/FeedContentHeader.d.ts.map +0 -1
- package/lib/components/Feed/FeedContentHeader.js +0 -107
- package/lib/components/Feed/FeedContentHeader.js.map +0 -1
- package/lib/components/Feed/FeedEditRegion.d.ts +0 -6
- package/lib/components/Feed/FeedEditRegion.d.ts.map +0 -1
- package/lib/components/Feed/FeedEditRegion.js +0 -57
- package/lib/components/Feed/FeedEditRegion.js.map +0 -1
- package/lib/components/Feed/FeedInputRegion.d.ts +0 -8
- package/lib/components/Feed/FeedInputRegion.d.ts.map +0 -1
- package/lib/components/Feed/FeedInputRegion.js +0 -86
- package/lib/components/Feed/FeedInputRegion.js.map +0 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +0 -7
- package/lib/components/Feed/FeedLikeButton.d.ts.map +0 -1
- package/lib/components/Feed/FeedLikeButton.js +0 -102
- package/lib/components/Feed/FeedLikeButton.js.map +0 -1
- package/lib/components/Feed/FeedModalList.d.ts +0 -5
- package/lib/components/Feed/FeedModalList.d.ts.map +0 -1
- package/lib/components/Feed/FeedModalList.js +0 -39
- package/lib/components/Feed/FeedModalList.js.map +0 -1
- package/lib/components/Feed/FeedNewPost.d.ts +0 -7
- package/lib/components/Feed/FeedNewPost.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPost.js +0 -30
- package/lib/components/Feed/FeedNewPost.js.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -6
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -375
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
- package/lib/components/Feed/FeedPost.d.ts +0 -8
- package/lib/components/Feed/FeedPost.d.ts.map +0 -1
- package/lib/components/Feed/FeedPost.js +0 -85
- package/lib/components/Feed/FeedPost.js.map +0 -1
- package/lib/components/Feed/FeedReply.d.ts +0 -7
- package/lib/components/Feed/FeedReply.d.ts.map +0 -1
- package/lib/components/Feed/FeedReply.js +0 -36
- package/lib/components/Feed/FeedReply.js.map +0 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +0 -7
- package/lib/components/Feed/FeedReplyInput.d.ts.map +0 -1
- package/lib/components/Feed/FeedReplyInput.js +0 -21
- package/lib/components/Feed/FeedReplyInput.js.map +0 -1
- package/lib/components/Feed/FeedRichText.d.ts +0 -6
- package/lib/components/Feed/FeedRichText.d.ts.map +0 -1
- package/lib/components/Feed/FeedRichText.js +0 -163
- package/lib/components/Feed/FeedRichText.js.map +0 -1
- package/lib/components/Feed/index.d.ts +0 -7
- package/lib/components/Feed/index.d.ts.map +0 -1
- package/lib/components/Feed/index.js +0 -6
- package/lib/components/Feed/index.js.map +0 -1
- package/lib/components/HashtagButton/HashtagButton.d.ts +0 -23
- package/lib/components/HashtagButton/HashtagButton.d.ts.map +0 -1
- package/lib/components/HashtagButton/HashtagButton.js +0 -44
- package/lib/components/HashtagButton/HashtagButton.js.map +0 -1
- package/lib/components/HashtagButton/index.d.ts +0 -3
- package/lib/components/HashtagButton/index.d.ts.map +0 -1
- package/lib/components/HashtagButton/index.js +0 -3
- package/lib/components/HashtagButton/index.js.map +0 -1
- package/lib/components/MentionButton/MentionButton.d.ts +0 -35
- package/lib/components/MentionButton/MentionButton.d.ts.map +0 -1
- package/lib/components/MentionButton/MentionButton.js +0 -94
- package/lib/components/MentionButton/MentionButton.js.map +0 -1
- package/lib/components/MentionButton/index.d.ts +0 -3
- package/lib/components/MentionButton/index.d.ts.map +0 -1
- package/lib/components/MentionButton/index.js +0 -3
- package/lib/components/MentionButton/index.js.map +0 -1
- package/lib/index.d.ts +0 -12
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/index.js.map +0 -1
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { readableColor, rgba, transparentize } from 'polished';
|
|
3
|
-
import { defaultThemeProp, tryCatch, Icon, StyledIcon, StyledText, calculateFontSize } from '@pega/cosmos-react-core';
|
|
4
|
-
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
5
|
-
export const StyledMessageBubbleContent = styled.div ``;
|
|
6
|
-
export const StyledMediaList = styled.ul ``;
|
|
7
|
-
export const StyledMediaListItem = styled.li ``;
|
|
8
|
-
export const StyledSummaryItem = styled.div ``;
|
|
9
|
-
export const StyledMediaThumbNail = styled.img ``;
|
|
10
|
-
export const StyledMediaLink = styled.a ``;
|
|
11
|
-
export const StyledMediaButton = styled(BareButton) ``;
|
|
12
|
-
export const StyledMessageMain = styled.div ``;
|
|
13
|
-
export const StyledMessageBubble = styled.div ``;
|
|
14
|
-
export const StyledMetaInfoContainer = styled.div ``;
|
|
15
|
-
export const StyledMetaInfo = styled.span ``;
|
|
16
|
-
export const StyledStatusInfo = styled.span ``;
|
|
17
|
-
export const StyledTypingIndicator = styled.div ``;
|
|
18
|
-
export const StyledMessageHeader = styled.header ``;
|
|
19
|
-
export const StyledMessageHeaderContent = styled.div ``;
|
|
20
|
-
export const StyledMessageHeaderMeta = styled.div ``;
|
|
21
|
-
export const StyledHeadsetIconBackground = styled.div ``;
|
|
22
|
-
export const StyledHeadset = styled.div(({ theme }) => {
|
|
23
|
-
return css `
|
|
24
|
-
position: relative;
|
|
25
|
-
|
|
26
|
-
${StyledHeadsetIconBackground} {
|
|
27
|
-
position: relative;
|
|
28
|
-
inset-block-start: calc(-5.25 * ${theme.base.spacing});
|
|
29
|
-
inset-inline-start: calc(2 * ${theme.base.spacing});
|
|
30
|
-
height: 1.375rem;
|
|
31
|
-
width: 1.375rem;
|
|
32
|
-
background: ${theme.base.palette['primary-background']};
|
|
33
|
-
border-radius: calc(
|
|
34
|
-
(${theme.base['border-radius']}) * (${theme.components.button['border-radius']})
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
${StyledIcon} {
|
|
38
|
-
position: absolute;
|
|
39
|
-
width: 2.875rem;
|
|
40
|
-
height: 0.875rem;
|
|
41
|
-
inset-inline-start: calc(-1.5 * ${theme.base.spacing});
|
|
42
|
-
inset-block-start: calc(0.5 * ${theme.base.spacing});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
});
|
|
47
|
-
StyledHeadset.defaultProps = defaultThemeProp;
|
|
48
|
-
export const getMessageColors = (theme, direction, senderType, agentVariant = 0) => {
|
|
49
|
-
const { slate, blue, purple, orange, green, black } = theme.base.colors;
|
|
50
|
-
const agentMessageColors = [
|
|
51
|
-
purple['extra-light'],
|
|
52
|
-
orange['extra-light'],
|
|
53
|
-
'#C5D1DD',
|
|
54
|
-
green['extra-light'],
|
|
55
|
-
'#BBEAEA'
|
|
56
|
-
];
|
|
57
|
-
const outMessageColor = blue.medium;
|
|
58
|
-
const customerMessageColor = '#E6EEFA';
|
|
59
|
-
const botMessageColor = slate['extra-dark'];
|
|
60
|
-
if (direction === 'in') {
|
|
61
|
-
const messageColors = {
|
|
62
|
-
header: orange.medium,
|
|
63
|
-
content: ''
|
|
64
|
-
};
|
|
65
|
-
if (senderType === 'agent') {
|
|
66
|
-
messageColors.content = agentMessageColors[agentVariant % agentMessageColors.length];
|
|
67
|
-
}
|
|
68
|
-
else if (senderType === 'bot') {
|
|
69
|
-
messageColors.content = botMessageColor;
|
|
70
|
-
}
|
|
71
|
-
else if (senderType === 'customer') {
|
|
72
|
-
messageColors.content = customerMessageColor;
|
|
73
|
-
}
|
|
74
|
-
return messageColors;
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
header: black,
|
|
78
|
-
content: outMessageColor
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
export const StyledMessageContainer = styled.li(({ direction, senderType, hasMessage, typing, status, agentVariant, theme, theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, 'border-radius': borderRadius, spacing, palette: { 'foreground-color': foregroundColor, 'secondary-background': secondaryBackground, urgent }, transparency: { 'transparent-2': foregroundAlpha } } } }) => {
|
|
82
|
-
const { header, content } = getMessageColors(theme, direction, senderType, agentVariant);
|
|
83
|
-
const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
84
|
-
const statusForegroundColor = status === 'undeliverable' ? urgent : metaForegroundColor;
|
|
85
|
-
const fontSizes = calculateFontSize(fontSize, fontScale);
|
|
86
|
-
const contrastContentColor = readableColor(content);
|
|
87
|
-
const contrastHeaderColor = readableColor(header);
|
|
88
|
-
return css `
|
|
89
|
-
${direction === 'out'
|
|
90
|
-
? css `
|
|
91
|
-
padding-inline-start: calc(4 * ${spacing});
|
|
92
|
-
`
|
|
93
|
-
: css `
|
|
94
|
-
padding-inline-end: calc(4 * ${spacing});
|
|
95
|
-
`}
|
|
96
|
-
margin-block-end: ${typing ? spacing : '0'};
|
|
97
|
-
|
|
98
|
-
:first-child {
|
|
99
|
-
margin-block-start: ${spacing};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
${StyledMessageMain} {
|
|
103
|
-
max-width: 90%;
|
|
104
|
-
}
|
|
105
|
-
${StyledMessageBubble} {
|
|
106
|
-
background: ${content};
|
|
107
|
-
border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})
|
|
108
|
-
calc(3 * ${borderRadius});
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
color: ${contrastContentColor};
|
|
111
|
-
display: inline-block;
|
|
112
|
-
width: auto;
|
|
113
|
-
margin-block-end: calc(0.5 * ${spacing});
|
|
114
|
-
|
|
115
|
-
label {
|
|
116
|
-
color: inherit;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
${direction === 'in' &&
|
|
120
|
-
css `
|
|
121
|
-
border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});
|
|
122
|
-
`}
|
|
123
|
-
|
|
124
|
-
> ${StyledMessageBubbleContent} {
|
|
125
|
-
padding: ${spacing} calc(2 * ${spacing});
|
|
126
|
-
word-break: break-word;
|
|
127
|
-
white-space: pre-wrap;
|
|
128
|
-
position: relative;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
> ${StyledMediaList} {
|
|
132
|
-
color: ${contrastContentColor};
|
|
133
|
-
max-width: 100%;
|
|
134
|
-
|
|
135
|
-
> ${StyledMediaListItem} {
|
|
136
|
-
position: relative;
|
|
137
|
-
${StyledMediaThumbNail} {
|
|
138
|
-
max-height: 12rem;
|
|
139
|
-
width: 100%;
|
|
140
|
-
object-fit: contain;
|
|
141
|
-
background-color: ${secondaryBackground};
|
|
142
|
-
}
|
|
143
|
-
${StyledSummaryItem} {
|
|
144
|
-
padding: ${spacing} calc(3 * ${spacing});
|
|
145
|
-
font-size: ${fontSizes.xxs};
|
|
146
|
-
margin-block-start: calc(0.5 * ${spacing});
|
|
147
|
-
}
|
|
148
|
-
${StyledSummaryItem}::before {
|
|
149
|
-
content: '';
|
|
150
|
-
padding: ${spacing} 0;
|
|
151
|
-
border-top: 0.0625rem solid ${contrastContentColor};
|
|
152
|
-
position: absolute;
|
|
153
|
-
width: calc(100% - 2rem);
|
|
154
|
-
left: 1rem;
|
|
155
|
-
top: 0;
|
|
156
|
-
}
|
|
157
|
-
${StyledMediaThumbNail} + ${StyledSummaryItem}::before {
|
|
158
|
-
content: none;
|
|
159
|
-
}
|
|
160
|
-
svg {
|
|
161
|
-
font-size: 1.6rem;
|
|
162
|
-
}
|
|
163
|
-
${StyledText} {
|
|
164
|
-
color: ${foregroundColor};
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
${!hasMessage &&
|
|
169
|
-
css `
|
|
170
|
-
> ${StyledMediaListItem}:first-child {
|
|
171
|
-
> ${StyledSummaryItem}::before {
|
|
172
|
-
border-top: none;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
`}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
${StyledMessageHeader} {
|
|
179
|
-
padding: ${spacing} calc(2 * ${spacing});
|
|
180
|
-
color: ${contrastHeaderColor};
|
|
181
|
-
border-block-end: 0.0625rem solid ${transparentize(0.5, theme.base.colors.white)};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
${StyledMessageHeaderContent} {
|
|
185
|
-
color: ${contrastHeaderColor};
|
|
186
|
-
margin-inline-end: ${spacing};
|
|
187
|
-
}
|
|
188
|
-
${StyledMessageHeaderMeta} {
|
|
189
|
-
> a {
|
|
190
|
-
color: ${contrastHeaderColor};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
${StyledMediaLink}, ${StyledMediaButton} {
|
|
195
|
-
color: ${contrastContentColor};
|
|
196
|
-
font-size: inherit;
|
|
197
|
-
text-decoration: none;
|
|
198
|
-
font-weight: 700;
|
|
199
|
-
overflow-x: hidden;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
overflow: hidden;
|
|
202
|
-
text-overflow: ellipsis;
|
|
203
|
-
display: inline-block;
|
|
204
|
-
max-width: 100%;
|
|
205
|
-
&:hover {
|
|
206
|
-
color: ${contrastContentColor};
|
|
207
|
-
text-decoration: underline;
|
|
208
|
-
}
|
|
209
|
-
&:visited {
|
|
210
|
-
color: ${contrastContentColor};
|
|
211
|
-
}
|
|
212
|
-
&:focus {
|
|
213
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
${StyledMetaInfoContainer} {
|
|
219
|
-
width: 100%;
|
|
220
|
-
padding: 0 ${spacing};
|
|
221
|
-
${StyledMetaInfo}, ${StyledStatusInfo} {
|
|
222
|
-
margin-block-end: ${spacing};
|
|
223
|
-
font-size: 0.7rem;
|
|
224
|
-
color: ${metaForegroundColor};
|
|
225
|
-
}
|
|
226
|
-
${StyledStatusInfo} {
|
|
227
|
-
color: ${statusForegroundColor};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
${StyledTypingIndicator} {
|
|
231
|
-
width: 4.5rem;
|
|
232
|
-
position: relative;
|
|
233
|
-
height: 2rem;
|
|
234
|
-
}
|
|
235
|
-
`;
|
|
236
|
-
});
|
|
237
|
-
StyledMessageContainer.defaultProps = defaultThemeProp;
|
|
238
|
-
export const StyledBlinkingDot = styled.div(({ delay = 0, theme }) => {
|
|
239
|
-
return css `
|
|
240
|
-
@keyframes Blinking {
|
|
241
|
-
0% {
|
|
242
|
-
background: ${theme.base.colors.gray.medium};
|
|
243
|
-
}
|
|
244
|
-
100% {
|
|
245
|
-
background: ${theme.base.colors.gray['extra-light']};
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;
|
|
249
|
-
background: ${theme.base.colors.gray['extra-light']};
|
|
250
|
-
border-radius: 50%;
|
|
251
|
-
animation-delay: ${delay}s;
|
|
252
|
-
height: 0.4rem;
|
|
253
|
-
width: 0.4rem;
|
|
254
|
-
`;
|
|
255
|
-
});
|
|
256
|
-
StyledBlinkingDot.defaultProps = defaultThemeProp;
|
|
257
|
-
export const StyledUndeliveredIcon = styled(Icon)(({ theme: { base: { palette: { urgent } } } }) => {
|
|
258
|
-
return css `
|
|
259
|
-
color: ${urgent};
|
|
260
|
-
`;
|
|
261
|
-
});
|
|
262
|
-
StyledUndeliveredIcon.defaultProps = defaultThemeProp;
|
|
263
|
-
export const StyledFlagIcon = styled(Icon)(({ theme }) => {
|
|
264
|
-
return css `
|
|
265
|
-
position: relative;
|
|
266
|
-
inset-block-start: calc(0.5 * ${theme.base.spacing});
|
|
267
|
-
`;
|
|
268
|
-
});
|
|
269
|
-
StyledFlagIcon.defaultProps = defaultThemeProp;
|
|
270
|
-
//# sourceMappingURL=Message.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Message.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAIlF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEvD,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CAAC,IAAI,CAAC,OAAO;GACnD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, DefaultTheme } from 'styled-components';\nimport { readableColor, rgba, transparentize } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledIcon,\n StyledText,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { MessageProps } from './Chat.types';\n\nexport const StyledMessageBubbleContent = styled.div``;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledSummaryItem = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img``;\n\nexport const StyledMediaLink = styled.a``;\n\nexport const StyledMediaButton = styled(BareButton)``;\n\nexport const StyledMessageMain = styled.div``;\n\nexport const StyledMessageBubble = styled.div``;\n\nexport const StyledMetaInfoContainer = styled.div``;\n\nexport const StyledMetaInfo = styled.span``;\n\nexport const StyledStatusInfo = styled.span``;\n\nexport const StyledTypingIndicator = styled.div``;\n\nexport const StyledMessageHeader = styled.header``;\nexport const StyledMessageHeaderContent = styled.div``;\nexport const StyledMessageHeaderMeta = styled.div``;\n\nexport const StyledHeadsetIconBackground = styled.div``;\ninterface StyledMessageContainerProps {\n senderType: 'customer' | 'agent' | 'bot';\n direction: 'in' | 'out';\n typing: boolean;\n hasMessage: boolean;\n status: string;\n agentVariant: number;\n}\n\nexport const StyledHeadset = styled.div(({ theme }) => {\n return css`\n position: relative;\n\n ${StyledHeadsetIconBackground} {\n position: relative;\n inset-block-start: calc(-5.25 * ${theme.base.spacing});\n inset-inline-start: calc(2 * ${theme.base.spacing});\n height: 1.375rem;\n width: 1.375rem;\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(\n (${theme.base['border-radius']}) * (${theme.components.button['border-radius']})\n );\n\n ${StyledIcon} {\n position: absolute;\n width: 2.875rem;\n height: 0.875rem;\n inset-inline-start: calc(-1.5 * ${theme.base.spacing});\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledHeadset.defaultProps = defaultThemeProp;\n\nexport interface MessageBubbleColor {\n header: string;\n content: string;\n}\n\nexport const getMessageColors: (\n theme: DefaultTheme,\n direction: MessageProps['direction'],\n senderType: MessageProps['senderType'],\n agentVariant: MessageProps['agentVariant']\n) => MessageBubbleColor = (theme, direction, senderType, agentVariant = 0) => {\n const { slate, blue, purple, orange, green, black } = theme.base.colors;\n const agentMessageColors = [\n purple['extra-light'],\n orange['extra-light'],\n '#C5D1DD',\n green['extra-light'],\n '#BBEAEA'\n ];\n const outMessageColor = blue.medium;\n const customerMessageColor = '#E6EEFA';\n const botMessageColor = slate['extra-dark'];\n\n if (direction === 'in') {\n const messageColors: MessageBubbleColor = {\n header: orange.medium,\n content: ''\n };\n if (senderType === 'agent') {\n messageColors.content = agentMessageColors[agentVariant % agentMessageColors.length];\n } else if (senderType === 'bot') {\n messageColors.content = botMessageColor;\n } else if (senderType === 'customer') {\n messageColors.content = customerMessageColor;\n }\n return messageColors;\n }\n return {\n header: black,\n content: outMessageColor\n };\n};\n\nexport const StyledMessageContainer = styled.li<StyledMessageContainerProps>(\n ({\n direction,\n senderType,\n hasMessage,\n typing,\n status,\n agentVariant,\n theme,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': borderRadius,\n spacing,\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground,\n urgent\n },\n transparency: { 'transparent-2': foregroundAlpha }\n }\n }\n }) => {\n const { header, content } = getMessageColors(theme, direction, senderType, agentVariant);\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n const statusForegroundColor = status === 'undeliverable' ? urgent : metaForegroundColor;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const contrastContentColor = readableColor(content);\n const contrastHeaderColor = readableColor(header);\n return css`\n ${direction === 'out'\n ? css`\n padding-inline-start: calc(4 * ${spacing});\n `\n : css`\n padding-inline-end: calc(4 * ${spacing});\n `}\n margin-block-end: ${typing ? spacing : '0'};\n\n :first-child {\n margin-block-start: ${spacing};\n }\n\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n background: ${content};\n border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})\n calc(3 * ${borderRadius});\n overflow: hidden;\n color: ${contrastContentColor};\n display: inline-block;\n width: auto;\n margin-block-end: calc(0.5 * ${spacing});\n\n label {\n color: inherit;\n }\n\n ${direction === 'in' &&\n css`\n border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: ${spacing} calc(2 * ${spacing});\n word-break: break-word;\n white-space: pre-wrap;\n position: relative;\n }\n\n > ${StyledMediaList} {\n color: ${contrastContentColor};\n max-width: 100%;\n\n > ${StyledMediaListItem} {\n position: relative;\n ${StyledMediaThumbNail} {\n max-height: 12rem;\n width: 100%;\n object-fit: contain;\n background-color: ${secondaryBackground};\n }\n ${StyledSummaryItem} {\n padding: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledSummaryItem}::before {\n content: '';\n padding: ${spacing} 0;\n border-top: 0.0625rem solid ${contrastContentColor};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledSummaryItem}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n ${StyledText} {\n color: ${foregroundColor};\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledSummaryItem}::before {\n border-top: none;\n }\n }\n `}\n }\n\n ${StyledMessageHeader} {\n padding: ${spacing} calc(2 * ${spacing});\n color: ${contrastHeaderColor};\n border-block-end: 0.0625rem solid ${transparentize(0.5, theme.base.colors.white)};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${contrastHeaderColor};\n margin-inline-end: ${spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${contrastHeaderColor};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${contrastContentColor};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n overflow-x: hidden;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n &:hover {\n color: ${contrastContentColor};\n text-decoration: underline;\n }\n &:visited {\n color: ${contrastContentColor};\n }\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n ${StyledMetaInfoContainer} {\n width: 100%;\n padding: 0 ${spacing};\n ${StyledMetaInfo}, ${StyledStatusInfo} {\n margin-block-end: ${spacing};\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n ${StyledStatusInfo} {\n color: ${statusForegroundColor};\n }\n }\n ${StyledTypingIndicator} {\n width: 4.5rem;\n position: relative;\n height: 2rem;\n }\n `;\n }\n);\nStyledMessageContainer.defaultProps = defaultThemeProp;\ninterface StyledBlinkingDotProps {\n delay?: number;\n}\n\nexport const StyledBlinkingDot = styled.div<StyledBlinkingDotProps>(({ delay = 0, theme }) => {\n return css`\n @keyframes Blinking {\n 0% {\n background: ${theme.base.colors.gray.medium};\n }\n 100% {\n background: ${theme.base.colors.gray['extra-light']};\n }\n }\n animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;\n background: ${theme.base.colors.gray['extra-light']};\n border-radius: 50%;\n animation-delay: ${delay}s;\n height: 0.4rem;\n width: 0.4rem;\n `;\n});\nStyledBlinkingDot.defaultProps = defaultThemeProp;\n\nexport const StyledUndeliveredIcon = styled(Icon)(\n ({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n }) => {\n return css`\n color: ${urgent};\n `;\n }\n);\n\nStyledUndeliveredIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFlagIcon = styled(Icon)(({ theme }) => {\n return css`\n position: relative;\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledFlagIcon.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, Ref } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { ChatComposerProps } from './ChatComposer';
|
|
4
|
-
export declare const StyledSuggestedReplyHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledSuggestedReplyContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
-
export declare const StyledReply: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
-
export declare const StyledRepliesAction: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
-
export declare const StyledNotification: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
-
export declare const StyledSuggestedReplyIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@pega/cosmos-react-core").IconProps>, import("styled-components").DefaultTheme, {
|
|
10
|
-
suggestedReplyCollapsed?: boolean | undefined;
|
|
11
|
-
}, never>;
|
|
12
|
-
export interface SuggestedReply {
|
|
13
|
-
/** Id for this suggested reply */
|
|
14
|
-
id: string;
|
|
15
|
-
/** Suggested reply message */
|
|
16
|
-
message: string;
|
|
17
|
-
/** Confidence of this suggested reply */
|
|
18
|
-
confidence: number;
|
|
19
|
-
}
|
|
20
|
-
export interface SuggestedReplyPickerProps extends Pick<ChatComposerProps, 'onSend' | 'maxLength' | 'disabled'> {
|
|
21
|
-
/** ref to the element */
|
|
22
|
-
ref?: Ref<HTMLDivElement>;
|
|
23
|
-
/** Suggested replies */
|
|
24
|
-
replies?: SuggestedReply[];
|
|
25
|
-
/** Id of the current reply */
|
|
26
|
-
currentReplyId?: SuggestedReply['id'];
|
|
27
|
-
/** Fired when user clicks on left or right buttons
|
|
28
|
-
* @param id Id of the new reply
|
|
29
|
-
*/
|
|
30
|
-
onReplyChange: (id: SuggestedReply['id']) => void;
|
|
31
|
-
/** Current state of the panel */
|
|
32
|
-
collapsed: boolean;
|
|
33
|
-
/** Callback for expand or collapse click */
|
|
34
|
-
onExpandCollapse: () => void;
|
|
35
|
-
/** Callback for the event when a suggested reply is selected */
|
|
36
|
-
onSelect: (suggestedReply: SuggestedReply) => void;
|
|
37
|
-
/** Show notification on picker header */
|
|
38
|
-
showNotification?: boolean;
|
|
39
|
-
}
|
|
40
|
-
declare const SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps>;
|
|
41
|
-
export default SuggestedReplyPicker;
|
|
42
|
-
//# sourceMappingURL=SuggestedReplyPicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAa,MAAM,OAAO,CAAC;AAGvF,OAAO,EAQL,YAAY,EAMb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAInD,eAAO,MAAM,0BAA0B,yGAAe,CAAC;AACvD,eAAO,MAAM,2BAA2B,yGAAe,CAAC;AACxD,eAAO,MAAM,WAAW,yGAAe,CAAC;AACxC,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAI/C,eAAO,MAAM,wBAAwB;;SAqBpC,CAAC;AAoCF,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;IACpE,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,8BAA8B;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACtC;;OAEG;IACH,aAAa,EAAE,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAClD,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAiNlF,CAAC;AAEL,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useEffect } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Icon, registerIcon, Button, Text, useI18n, defaultThemeProp, useLiveLog, ExpandCollapse, Alert, useDirection, EmptyState } from '@pega/cosmos-react-core';
|
|
5
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
6
|
-
import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
|
|
7
|
-
import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
|
|
8
|
-
import { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';
|
|
9
|
-
registerIcon(timesIcon, caretLeftIcon, caretRightIcon);
|
|
10
|
-
export const StyledSuggestedReplyHeader = styled.div ``;
|
|
11
|
-
export const StyledSuggestedReplyContent = styled.div ``;
|
|
12
|
-
export const StyledReply = styled.div ``;
|
|
13
|
-
export const StyledRepliesAction = styled.div ``;
|
|
14
|
-
export const StyledNotification = styled.div ``;
|
|
15
|
-
const maxNumOfLines = 5;
|
|
16
|
-
const minNumOfLines = 2;
|
|
17
|
-
export const StyledSuggestedReplyIcon = styled(Icon)(({ suggestedReplyCollapsed, theme }) => {
|
|
18
|
-
const { rtl } = useDirection();
|
|
19
|
-
const { base: { animation: { speed, timing: { ease } } } } = theme;
|
|
20
|
-
return css `
|
|
21
|
-
transition-property: transform;
|
|
22
|
-
transition-duration: ${speed};
|
|
23
|
-
transition-timing-function: ${ease};
|
|
24
|
-
${suggestedReplyCollapsed &&
|
|
25
|
-
css `
|
|
26
|
-
transform: rotateZ(${rtl ? '0deg' : '-90deg'});
|
|
27
|
-
`}
|
|
28
|
-
`;
|
|
29
|
-
});
|
|
30
|
-
StyledSuggestedReplyIcon.defaultProps = defaultThemeProp;
|
|
31
|
-
const StyledSuggestedReplyContainer = styled.div(props => {
|
|
32
|
-
const { theme } = props;
|
|
33
|
-
return css `
|
|
34
|
-
border-top: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
35
|
-
background-color: ${theme.base.palette['primary-background']};
|
|
36
|
-
|
|
37
|
-
> ${StyledSuggestedReplyHeader} {
|
|
38
|
-
padding: ${theme.base.spacing};
|
|
39
|
-
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
${StyledAlert} {
|
|
43
|
-
position: relative;
|
|
44
|
-
inset-block-start: calc(-0.25 * ${theme.base.spacing});
|
|
45
|
-
inset-inline-start: calc(-0.5 * ${theme.base.spacing});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
${StyledSuggestedReplyContent} {
|
|
49
|
-
padding: calc(2 * ${theme.base.spacing});
|
|
50
|
-
position: relative;
|
|
51
|
-
|
|
52
|
-
> ${StyledReply} {
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});
|
|
55
|
-
min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
});
|
|
60
|
-
StyledSuggestedReplyContainer.defaultProps = defaultThemeProp;
|
|
61
|
-
const SuggestedReplyPicker = forwardRef(function SuggestedReplyPicker(props, ref) {
|
|
62
|
-
const { replies = [], collapsed, onExpandCollapse, showNotification, onSelect, currentReplyId, onReplyChange, onSend, maxLength = 256, disabled = false, ...restProps } = props;
|
|
63
|
-
const { announcePolite } = useLiveLog();
|
|
64
|
-
const t = useI18n();
|
|
65
|
-
const { rtl, ltr } = useDirection();
|
|
66
|
-
// Allows suggested replies to cycle
|
|
67
|
-
const onSuggestedReplyChange = (mode) => {
|
|
68
|
-
const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
|
|
69
|
-
let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;
|
|
70
|
-
newReplyIndex = (newReplyIndex + replies.length) % replies.length;
|
|
71
|
-
onReplyChange(replies[newReplyIndex].id);
|
|
72
|
-
};
|
|
73
|
-
// SR announcement when current reply changes
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (!replies || replies.length === 0 || !currentReplyId) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
|
|
79
|
-
announcePolite({
|
|
80
|
-
message: `${t('suggested_replies_current_of_total', [
|
|
81
|
-
currentReplyIndex + 1,
|
|
82
|
-
replies.length
|
|
83
|
-
])},
|
|
84
|
-
${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${replies[currentReplyIndex]?.message}`,
|
|
85
|
-
type: 'acknowledgement'
|
|
86
|
-
});
|
|
87
|
-
}, [currentReplyId]);
|
|
88
|
-
const onEditAnnouncement = () => {
|
|
89
|
-
announcePolite({
|
|
90
|
-
message: t('suggested_reply_copied_to_input_field'),
|
|
91
|
-
type: 'acknowledgement'
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
return (_jsxs(StyledSuggestedReplyContainer, { ref: ref, ...restProps, children: [_jsx(Flex, { as: StyledSuggestedReplyHeader, container: {
|
|
95
|
-
justify: 'between',
|
|
96
|
-
alignContent: 'center'
|
|
97
|
-
}, children: _jsxs(Flex, { container: {
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
gap: 1
|
|
100
|
-
}, children: [ltr && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(StyledSuggestedReplyIcon, { name: 'caret-down', suggestedReplyCollapsed: collapsed }) })), _jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(Text, { variant: 'h3', children: t('suggested_replies') }), collapsed && showNotification && _jsx(Alert, { variant: 'urgent' })] }), rtl && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(StyledSuggestedReplyIcon, { name: 'caret-down', suggestedReplyCollapsed: collapsed }) }))] }) }), _jsx(ExpandCollapse, { dimension: 'height', collapsed: collapsed, nullWhenCollapsed: true, children: _jsxs(Flex, { container: {
|
|
101
|
-
direction: 'column',
|
|
102
|
-
gap: 1
|
|
103
|
-
}, as: StyledSuggestedReplyContent, children: [currentReplyId && replies.length ? (_jsx(Flex, { container: true, as: StyledReply, children: replies.find(reply => reply.id === currentReplyId)?.message })) : (_jsx(EmptyState, { message: t('no_suggestion') })), _jsxs(Flex, { container: {
|
|
104
|
-
justify: 'center'
|
|
105
|
-
}, as: StyledRepliesAction, children: [replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('prev_suggested_reply'), variant: 'simple', disabled: currentReplyId === undefined || replies.length <= 1, onClick: () => {
|
|
106
|
-
onSuggestedReplyChange('prev');
|
|
107
|
-
}, children: _jsx(Icon, { name: 'caret-left' }) })), _jsx(Button, { disabled: disabled || currentReplyId === undefined || !replies || replies.length === 0, onClick: () => {
|
|
108
|
-
const selectedReply = replies.find(reply => reply.id === currentReplyId);
|
|
109
|
-
if (selectedReply) {
|
|
110
|
-
onSelect(selectedReply);
|
|
111
|
-
onExpandCollapse();
|
|
112
|
-
onEditAnnouncement();
|
|
113
|
-
}
|
|
114
|
-
}, "aria-label": replies.length > 0 && currentReplyId
|
|
115
|
-
? t('edit_current_template', [
|
|
116
|
-
replies.length > 0 && currentReplyId
|
|
117
|
-
? replies.findIndex(reply => reply.id === currentReplyId) + 1
|
|
118
|
-
: 0,
|
|
119
|
-
replies.length
|
|
120
|
-
])
|
|
121
|
-
: undefined, children: t('edit') }), _jsx(Button, { disabled: disabled ||
|
|
122
|
-
currentReplyId === undefined ||
|
|
123
|
-
!replies ||
|
|
124
|
-
replies.length === 0 ||
|
|
125
|
-
(!!maxLength && replies.length > maxLength), onClick: () => {
|
|
126
|
-
const selectedReply = replies.find(reply => reply.id === currentReplyId);
|
|
127
|
-
if (selectedReply) {
|
|
128
|
-
onSend(selectedReply.message);
|
|
129
|
-
onExpandCollapse();
|
|
130
|
-
}
|
|
131
|
-
}, "aria-label": replies.length > 0 && currentReplyId
|
|
132
|
-
? t('send_current_template', [
|
|
133
|
-
replies.length > 0 && currentReplyId
|
|
134
|
-
? replies.findIndex(reply => reply.id === currentReplyId) + 1
|
|
135
|
-
: 0,
|
|
136
|
-
replies.length
|
|
137
|
-
])
|
|
138
|
-
: undefined, children: t('send') }), replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('next_suggested_reply'), variant: 'simple', onClick: () => {
|
|
139
|
-
onSuggestedReplyChange('next');
|
|
140
|
-
}, disabled: currentReplyId === undefined || replies.length <= 1, children: _jsx(Icon, { name: 'caret-right' }) }))] })] }) })] }));
|
|
141
|
-
});
|
|
142
|
-
export default SuggestedReplyPicker;
|
|
143
|
-
//# sourceMappingURL=SuggestedReplyPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAIlF,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,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useEffect } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Icon,\n registerIcon,\n Button,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\n\nimport { ChatComposerProps } from './ChatComposer';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledReply = styled.div``;\nexport const StyledRepliesAction = styled.div``;\nexport const StyledNotification = styled.div``;\nconst maxNumOfLines = 5;\nconst minNumOfLines = 2;\n\nexport const StyledSuggestedReplyIcon = styled(Icon)<{ suggestedReplyCollapsed?: boolean }>(\n ({ suggestedReplyCollapsed, theme }) => {\n const { rtl } = useDirection();\n const {\n base: {\n animation: {\n speed,\n timing: { ease }\n }\n }\n } = theme;\n return css`\n transition-property: transform;\n transition-duration: ${speed};\n transition-timing-function: ${ease};\n ${suggestedReplyCollapsed &&\n css`\n transform: rotateZ(${rtl ? '0deg' : '-90deg'});\n `}\n `;\n }\n);\n\nStyledSuggestedReplyIcon.defaultProps = defaultThemeProp;\n\nconst StyledSuggestedReplyContainer = styled.div(props => {\n const { theme } = props;\n return css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n\n > ${StyledSuggestedReplyHeader} {\n padding: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n ${StyledAlert} {\n position: relative;\n inset-block-start: calc(-0.25 * ${theme.base.spacing});\n inset-inline-start: calc(-0.5 * ${theme.base.spacing});\n }\n\n ${StyledSuggestedReplyContent} {\n padding: calc(2 * ${theme.base.spacing});\n position: relative;\n\n > ${StyledReply} {\n overflow-y: auto;\n max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});\n min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});\n }\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReply {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** Confidence of this suggested reply */\n confidence: number;\n}\n\nexport interface SuggestedReplyPickerProps\n extends Pick<ChatComposerProps, 'onSend' | 'maxLength' | 'disabled'> {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Id of the current reply */\n currentReplyId?: SuggestedReply['id'];\n /** Fired when user clicks on left or right buttons\n * @param id Id of the new reply\n */\n onReplyChange: (id: SuggestedReply['id']) => void;\n /** Current state of the panel */\n collapsed: boolean;\n /** Callback for expand or collapse click */\n onExpandCollapse: () => void;\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Show notification on picker header */\n showNotification?: boolean;\n}\n\nconst SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(function SuggestedReplyPicker(\n props: PropsWithoutRef<SuggestedReplyPickerProps>,\n ref: SuggestedReplyPickerProps['ref']\n ) {\n const {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n currentReplyId,\n onReplyChange,\n onSend,\n maxLength = 256,\n disabled = false,\n ...restProps\n } = props;\n const { announcePolite } = useLiveLog();\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n // Allows suggested replies to cycle\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;\n newReplyIndex = (newReplyIndex + replies.length) % replies.length;\n onReplyChange(replies[newReplyIndex].id);\n };\n\n // SR announcement when current reply changes\n useEffect(() => {\n if (!replies || replies.length === 0 || !currentReplyId) {\n return;\n }\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n currentReplyIndex + 1,\n replies.length\n ])},\n ${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${\n replies[currentReplyIndex]?.message\n }`,\n type: 'acknowledgement'\n });\n }, [currentReplyId]);\n\n const onEditAnnouncement = () => {\n announcePolite({\n message: t('suggested_reply_copied_to_input_field'),\n type: 'acknowledgement'\n });\n };\n\n return (\n <StyledSuggestedReplyContainer ref={ref} {...restProps}>\n <Flex\n as={StyledSuggestedReplyHeader}\n container={{\n justify: 'between',\n alignContent: 'center'\n }}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n >\n {ltr && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n\n <Flex container={{ gap: 0.5 }}>\n <Text variant='h3'>{t('suggested_replies')}</Text>\n {collapsed && showNotification && <Alert variant='urgent' />}\n </Flex>\n\n {rtl && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n </Flex>\n </Flex>\n <ExpandCollapse dimension='height' collapsed={collapsed} nullWhenCollapsed>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReplyId && replies.length ? (\n <Flex container as={StyledReply}>\n {replies.find(reply => reply.id === currentReplyId)?.message}\n </Flex>\n ) : (\n <EmptyState message={t('no_suggestion')} />\n )}\n <Flex\n container={{\n justify: 'center'\n }}\n as={StyledRepliesAction}\n >\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReplyId === undefined || replies.length <= 1}\n onClick={() => {\n onSuggestedReplyChange('prev');\n }}\n >\n <Icon name='caret-left' />\n </Button>\n )}\n <Button\n disabled={\n disabled || currentReplyId === undefined || !replies || replies.length === 0\n }\n onClick={() => {\n const selectedReply = replies.find(reply => reply.id === currentReplyId);\n if (selectedReply) {\n onSelect(selectedReply);\n onExpandCollapse();\n onEditAnnouncement();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('edit_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('edit')}\n </Button>\n <Button\n disabled={\n disabled ||\n currentReplyId === undefined ||\n !replies ||\n replies.length === 0 ||\n (!!maxLength && replies.length > maxLength)\n }\n onClick={() => {\n const selectedReply = replies.find(reply => reply.id === currentReplyId);\n if (selectedReply) {\n onSend(selectedReply.message);\n onExpandCollapse();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('send_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('send')}\n </Button>\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n onClick={() => {\n onSuggestedReplyChange('next');\n }}\n disabled={currentReplyId === undefined || replies.length <= 1}\n >\n <Icon name='caret-right' />\n </Button>\n )}\n </Flex>\n </Flex>\n </ExpandCollapse>\n </StyledSuggestedReplyContainer>\n );\n });\n\nexport default SuggestedReplyPicker;\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps, PropsWithDefaults } from '@pega/cosmos-react-core';
|
|
3
|
-
import { SystemMessageProps } from './Chat.types';
|
|
4
|
-
type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
|
|
5
|
-
export declare const StyledSystemMessage: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, Pick<SystemMessagePropsWithDefaults, "variant">, never>;
|
|
6
|
-
declare const SystemMessage: FunctionComponent<SystemMessageProps & ForwardProps>;
|
|
7
|
-
export default SystemMessage;
|
|
8
|
-
//# sourceMappingURL=SystemMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAIvE,OAAO,EAIL,YAAY,EACZ,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,KAAK,8BAA8B,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAEvF,eAAO,MAAM,mBAAmB,qJA6C/B,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA8BvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { rgba } from 'polished';
|
|
5
|
-
import { Flex, tryCatch, defaultThemeProp, useI18n } from '@pega/cosmos-react-core';
|
|
6
|
-
export const StyledSystemMessage = styled.li(({ theme: { base: { palette: { 'foreground-color': foregroundColor }, transparency: { 'transparent-3': foregroundAlpha }, colors: { blue: { medium } }, spacing } }, variant }) => {
|
|
7
|
-
const systemMessageForeGroundColor = variant === 'primary' ? medium : tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
8
|
-
return css `
|
|
9
|
-
color: ${systemMessageForeGroundColor};
|
|
10
|
-
font-size: 0.75rem;
|
|
11
|
-
padding: 0 0 calc(2 * ${spacing});
|
|
12
|
-
|
|
13
|
-
:last-child {
|
|
14
|
-
padding: 0;
|
|
15
|
-
}
|
|
16
|
-
${variant === 'primary' &&
|
|
17
|
-
css `
|
|
18
|
-
text-transform: uppercase;
|
|
19
|
-
font-weight: bold;
|
|
20
|
-
::before,
|
|
21
|
-
::after {
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
content: '';
|
|
24
|
-
border-top: 0.0625rem solid ${systemMessageForeGroundColor};
|
|
25
|
-
flex-grow: 1;
|
|
26
|
-
min-width: 1.5rem;
|
|
27
|
-
}
|
|
28
|
-
::before {
|
|
29
|
-
margin-inline-end: ${spacing};
|
|
30
|
-
}
|
|
31
|
-
::after {
|
|
32
|
-
margin-inline-start: ${spacing};
|
|
33
|
-
}
|
|
34
|
-
`}
|
|
35
|
-
`;
|
|
36
|
-
});
|
|
37
|
-
StyledSystemMessage.defaultProps = defaultThemeProp;
|
|
38
|
-
const SystemMessage = forwardRef(function SystemMessage(props, ref) {
|
|
39
|
-
const { message, timestamp, variant = 'secondary', ...restProps } = props;
|
|
40
|
-
const t = useI18n();
|
|
41
|
-
const ariaLabel = timestamp === undefined ? `${message}` : t('chat_message_at_timestamp', [message, timestamp]);
|
|
42
|
-
return (_jsxs(Flex, { ref: ref, as: StyledSystemMessage, container: {
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
justify: 'center'
|
|
45
|
-
}, item: {
|
|
46
|
-
shrink: 0
|
|
47
|
-
}, variant: variant, "aria-label": ariaLabel, ...restProps, children: [timestamp && `${timestamp}: `, " ", message] }));
|
|
48
|
-
});
|
|
49
|
-
export default SystemMessage;
|
|
50
|
-
//# sourceMappingURL=SystemMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAGhB,OAAO,EACR,MAAM,yBAAyB,CAAC;AAMjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAC1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAChD,YAAY,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,EAClD,MAAM,EAAE,EACN,IAAI,EAAE,EAAE,MAAM,EAAE,EACjB,EACD,OAAO,EACR,EACF,EACD,OAAO,EACR,EAAE,EAAE;IACH,MAAM,4BAA4B,GAChC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAC1F,OAAO,GAAG,CAAA;eACC,4BAA4B;;8BAEb,OAAO;;;;;QAK7B,OAAO,KAAK,SAAS;QACvB,GAAG,CAAA;;;;;;;wCAO+B,4BAA4B;;;;;+BAKrC,OAAO;;;iCAGL,OAAO;;OAEjC;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,aAAa,GAAyD,UAAU,CACpF,SAAS,aAAa,CACpB,KAA0C,EAC1C,GAA8B;IAE9B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAC1E,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GACb,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAEhG,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,QAAQ;SAClB,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC;SACV,EACD,OAAO,EAAE,OAAO,gBACJ,SAAS,KACjB,SAAS,aAEZ,SAAS,IAAI,GAAG,SAAS,IAAI,OAAG,OAAO,IACnC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport {\n Flex,\n tryCatch,\n defaultThemeProp,\n ForwardProps,\n PropsWithDefaults,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport { SystemMessageProps } from './Chat.types';\n\ntype SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;\n\nexport const StyledSystemMessage = styled.li<Pick<SystemMessagePropsWithDefaults, 'variant'>>(\n ({\n theme: {\n base: {\n palette: { 'foreground-color': foregroundColor },\n transparency: { 'transparent-3': foregroundAlpha },\n colors: {\n blue: { medium }\n },\n spacing\n }\n },\n variant\n }) => {\n const systemMessageForeGroundColor =\n variant === 'primary' ? medium : tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n return css`\n color: ${systemMessageForeGroundColor};\n font-size: 0.75rem;\n padding: 0 0 calc(2 * ${spacing});\n\n :last-child {\n padding: 0;\n }\n ${variant === 'primary' &&\n css`\n text-transform: uppercase;\n font-weight: bold;\n ::before,\n ::after {\n display: inline-flex;\n content: '';\n border-top: 0.0625rem solid ${systemMessageForeGroundColor};\n flex-grow: 1;\n min-width: 1.5rem;\n }\n ::before {\n margin-inline-end: ${spacing};\n }\n ::after {\n margin-inline-start: ${spacing};\n }\n `}\n `;\n }\n);\n\nStyledSystemMessage.defaultProps = defaultThemeProp;\n\nconst SystemMessage: FunctionComponent<SystemMessageProps & ForwardProps> = forwardRef(\n function SystemMessage(\n props: PropsWithoutRef<SystemMessageProps>,\n ref: SystemMessageProps['ref']\n ) {\n const { message, timestamp, variant = 'secondary', ...restProps } = props;\n const t = useI18n();\n\n const ariaLabel =\n timestamp === undefined ? `${message}` : t('chat_message_at_timestamp', [message, timestamp]);\n\n return (\n <Flex\n ref={ref}\n as={StyledSystemMessage}\n container={{\n alignItems: 'center',\n justify: 'center'\n }}\n item={{\n shrink: 0\n }}\n variant={variant}\n aria-label={ariaLabel}\n {...restProps}\n >\n {timestamp && `${timestamp}: `} {message}\n </Flex>\n );\n }\n);\n\nexport default SystemMessage;\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { TypeIndicatorProps } from './Chat.types';
|
|
4
|
-
declare const TypeIndicator: FunctionComponent<TypeIndicatorProps & ForwardProps>;
|
|
5
|
-
export default TypeIndicator;
|
|
6
|
-
//# sourceMappingURL=TypeIndicator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAW,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAwBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import { useI18n } from '@pega/cosmos-react-core';
|
|
4
|
-
import Message from './Message';
|
|
5
|
-
const TypeIndicator = forwardRef(function TypeIndicator(props, ref) {
|
|
6
|
-
const { avatarInfo, message, senderId, senderType, agentVariant, ...restProps } = props;
|
|
7
|
-
const t = useI18n();
|
|
8
|
-
const ariaLabel = t('is_typing', [avatarInfo.name, message || '']);
|
|
9
|
-
return (_jsx(Message, { ...restProps, senderType: senderType, senderId: senderId, direction: 'in', avatarInfo: avatarInfo, agentVariant: agentVariant, typing: true, ref: ref, message: message, "aria-label": ariaLabel }));
|
|
10
|
-
});
|
|
11
|
-
export default TypeIndicator;
|
|
12
|
-
//# sourceMappingURL=TypeIndicator.js.map
|