@pega/cosmos-react-social 5.0.0-dev.4.7 → 5.0.0-dev.4.9
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,255 +0,0 @@
|
|
|
1
|
-
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useState, useMemo, useRef, useImperativeHandle, useEffect } from 'react';
|
|
4
|
-
import styled, { css } from 'styled-components';
|
|
5
|
-
import { stripUnit } from 'polished';
|
|
6
|
-
import { Button, Flex, Icon, registerIcon, useI18n, defaultThemeProp, FileUploadItem, MenuButton, Input, Modal, useModalManager, useModalContext, Grid, ComboBox, menuHelpers, createStringMatcher } from '@pega/cosmos-react-core';
|
|
7
|
-
import { Editor } from '@pega/cosmos-react-rte';
|
|
8
|
-
import * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
|
|
9
|
-
import * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';
|
|
10
|
-
import * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';
|
|
11
|
-
import * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';
|
|
12
|
-
import EmailSelector from './EmailSelector';
|
|
13
|
-
registerIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);
|
|
14
|
-
export const StyledEmailComposer = styled.div(({ progress }) => {
|
|
15
|
-
return css `
|
|
16
|
-
${progress
|
|
17
|
-
? css `
|
|
18
|
-
visibility: hidden;
|
|
19
|
-
`
|
|
20
|
-
: css `
|
|
21
|
-
visibility: visible;
|
|
22
|
-
`}
|
|
23
|
-
`;
|
|
24
|
-
});
|
|
25
|
-
export const StyledResponseTypeIcon = styled(Icon)(({ theme }) => {
|
|
26
|
-
return css `
|
|
27
|
-
color: ${theme.base.palette.interactive};
|
|
28
|
-
`;
|
|
29
|
-
});
|
|
30
|
-
StyledResponseTypeIcon.defaultProps = defaultThemeProp;
|
|
31
|
-
export const StyledToggleButton = styled(Button)(({ theme }) => {
|
|
32
|
-
return css `
|
|
33
|
-
margin-block-start: calc(2 * ${theme.base.spacing});
|
|
34
|
-
color: ${theme.base.palette.interactive};
|
|
35
|
-
`;
|
|
36
|
-
});
|
|
37
|
-
StyledToggleButton.defaultProps = defaultThemeProp;
|
|
38
|
-
const StyledResponseType = styled(MenuButton) `
|
|
39
|
-
align-self: flex-start;
|
|
40
|
-
`;
|
|
41
|
-
StyledResponseType.defaultProps = defaultThemeProp;
|
|
42
|
-
export const StyledModal = styled(Modal)(({ state, theme }) => {
|
|
43
|
-
if (state !== 'docked')
|
|
44
|
-
return;
|
|
45
|
-
return css `
|
|
46
|
-
max-height: calc(100vh - ${theme.base.spacing} * 4);
|
|
47
|
-
`;
|
|
48
|
-
});
|
|
49
|
-
StyledModal.defaultProps = defaultThemeProp;
|
|
50
|
-
const responseTypeIcons = {
|
|
51
|
-
reply: 'reply',
|
|
52
|
-
replyAll: 'reply-all',
|
|
53
|
-
forward: 'forward'
|
|
54
|
-
};
|
|
55
|
-
const editorToolbar = [
|
|
56
|
-
'inline-styling',
|
|
57
|
-
'lists',
|
|
58
|
-
'indentation',
|
|
59
|
-
'images',
|
|
60
|
-
'links'
|
|
61
|
-
];
|
|
62
|
-
const ComposerModal = ({ modalContent, actions: modalActions, progress: modalProgress, subject, onCancel, compose }) => {
|
|
63
|
-
const { state } = useModalContext();
|
|
64
|
-
const t = useI18n();
|
|
65
|
-
return (_jsx(StyledModal, { heading: compose ? t('compose_label') : subject.value, onRequestDismiss: () => {
|
|
66
|
-
onCancel();
|
|
67
|
-
return false;
|
|
68
|
-
}, actions: !modalProgress ? modalActions : undefined, progress: modalProgress, state: state, children: modalContent }));
|
|
69
|
-
};
|
|
70
|
-
const createEmailTemplates = (selectedTemplateId, templates = []) => {
|
|
71
|
-
return templates.map(template => {
|
|
72
|
-
return {
|
|
73
|
-
id: template.id,
|
|
74
|
-
primary: template.title,
|
|
75
|
-
items: template.templates
|
|
76
|
-
? createEmailTemplates(selectedTemplateId, template.templates)
|
|
77
|
-
: undefined,
|
|
78
|
-
selected: template.id === selectedTemplateId
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
const EmailComposer = forwardRef(function EmailComposer({ participants, senderAccounts, onCancel, onSend, onSave, onImageAdded, externalValidator, onChange, footerMoreActions, progress = false, templates, data: { to, cc, bcc, responseType, subject, bodyContent, selectedTemplateId, attachments, emailAccount }, handle, onEditorInit, ...restProps }, ref) {
|
|
83
|
-
const t = useI18n();
|
|
84
|
-
const { create: createModal } = useModalManager();
|
|
85
|
-
const [userCCToggleState, setUserCCToggleState] = useState(false);
|
|
86
|
-
const [userBCCToggleState, setUserBCCToggleState] = useState(false);
|
|
87
|
-
const [editorContent, setEditorContent] = useState('');
|
|
88
|
-
const [filterValue, setFilterValue] = useState('');
|
|
89
|
-
const filterRegex = createStringMatcher(filterValue, 'contains');
|
|
90
|
-
const compose = useMemo(() => {
|
|
91
|
-
return !!(senderAccounts && senderAccounts.length > 0);
|
|
92
|
-
}, [senderAccounts]);
|
|
93
|
-
const emailTemplatesToRender = useMemo(() => {
|
|
94
|
-
const emailTemplates = createEmailTemplates(selectedTemplateId, templates);
|
|
95
|
-
const newItems = filterValue
|
|
96
|
-
? menuHelpers.flatten(emailTemplates).filter(({ primary }) => {
|
|
97
|
-
return filterRegex.test(primary);
|
|
98
|
-
})
|
|
99
|
-
: emailTemplates;
|
|
100
|
-
return menuHelpers.mapTree(newItems, item => ({
|
|
101
|
-
...item,
|
|
102
|
-
selected: item.items ? undefined : item.selected
|
|
103
|
-
}));
|
|
104
|
-
}, [filterValue, selectedTemplateId, templates]);
|
|
105
|
-
const selectedEmailTemplate = useMemo(() => {
|
|
106
|
-
return menuHelpers.getSelected(emailTemplatesToRender)[0];
|
|
107
|
-
}, [emailTemplatesToRender]);
|
|
108
|
-
const editorRef = useRef(null);
|
|
109
|
-
const fileUploadInputRef = useRef(null);
|
|
110
|
-
const modalMethods = useRef();
|
|
111
|
-
const responseTypeMenuData = useMemo(() => {
|
|
112
|
-
const menuItems = [
|
|
113
|
-
{
|
|
114
|
-
id: 'reply',
|
|
115
|
-
primary: t('reply'),
|
|
116
|
-
visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.reply }),
|
|
117
|
-
selected: responseType === 'reply',
|
|
118
|
-
onClick: () => {
|
|
119
|
-
onChange('responseType', 'reply');
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 'replyAll',
|
|
124
|
-
primary: t('reply_all'),
|
|
125
|
-
visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.replyAll }),
|
|
126
|
-
selected: responseType === 'replyAll',
|
|
127
|
-
onClick: () => {
|
|
128
|
-
onChange('responseType', 'replyAll');
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
id: 'forward',
|
|
133
|
-
primary: t('forward'),
|
|
134
|
-
visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.forward }),
|
|
135
|
-
selected: responseType === 'forward',
|
|
136
|
-
onClick: () => {
|
|
137
|
-
onChange('responseType', 'forward');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
];
|
|
141
|
-
return {
|
|
142
|
-
menuItems,
|
|
143
|
-
selectedResponseType: menuItems.find(item => item.selected)?.primary || menuItems[0].primary,
|
|
144
|
-
selectedResponseTypeIcon: (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply
|
|
145
|
-
};
|
|
146
|
-
}, [responseType]);
|
|
147
|
-
const onAttachmentDelete = (name) => {
|
|
148
|
-
onChange('attachments', attachments?.filter(item => item.name !== name) || []);
|
|
149
|
-
};
|
|
150
|
-
const onFileChange = (e) => {
|
|
151
|
-
if (e.target.files) {
|
|
152
|
-
const newFiles = Array.from(e.target.files).map(file => ({ name: file.name, file }));
|
|
153
|
-
onChange('attachments', attachments ? [...attachments, ...newFiles] : newFiles);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
useImperativeHandle(handle, () => ({
|
|
157
|
-
replaceBodyContent: (contentToReplace) => {
|
|
158
|
-
editorRef.current?.insertHtml(contentToReplace, true);
|
|
159
|
-
// Triggering onChange manually with new content as onChange on RTE is not triggered automatically for insertHTML
|
|
160
|
-
onChange('bodyContent', editorRef.current?.getHtml() || '', true);
|
|
161
|
-
},
|
|
162
|
-
updateImage: (imageData, id) => {
|
|
163
|
-
editorRef.current?.appendImage(imageData, id);
|
|
164
|
-
// Triggering onChange manually as onChange on RTE is not triggered automatically for appendImage
|
|
165
|
-
onChange('bodyContent', editorRef.current?.getHtml() || '', true);
|
|
166
|
-
},
|
|
167
|
-
activate: () => {
|
|
168
|
-
modalMethods.current?.activate();
|
|
169
|
-
},
|
|
170
|
-
setCursorLocationToStart: () => {
|
|
171
|
-
editorRef.current?.setCursorLocationToStart?.();
|
|
172
|
-
}
|
|
173
|
-
}));
|
|
174
|
-
const hasCC = useMemo(() => !!cc?.value?.length, [cc]);
|
|
175
|
-
const hasBCC = useMemo(() => !!bcc?.value?.length, [bcc]);
|
|
176
|
-
const content = (_jsxs(Flex, { as: StyledEmailComposer, ...restProps, container: {
|
|
177
|
-
gap: 2,
|
|
178
|
-
direction: 'column'
|
|
179
|
-
}, progress: !!progress, ref: ref, children: [senderAccounts && senderAccounts.length > 0 && (_jsx(EmailSelector, { participants: senderAccounts, selectedItems: emailAccount ? [emailAccount.value] : [], label: t('email_account'), mode: 'single-select', required: true, onSelectedItemChange: (selectedItems) => {
|
|
180
|
-
onChange('emailAccount', selectedItems[0]);
|
|
181
|
-
}, status: emailAccount?.error ? 'error' : undefined, info: emailAccount?.error, compose: true })), responseType && (_jsx(StyledResponseType, { text: responseTypeMenuData.selectedResponseType, variant: 'link', icon: responseTypeMenuData.selectedResponseTypeIcon, menu: {
|
|
182
|
-
mode: 'single-select',
|
|
183
|
-
items: responseTypeMenuData.menuItems
|
|
184
|
-
} })), _jsxs(Flex, { container: {
|
|
185
|
-
alignItems: 'start',
|
|
186
|
-
gap: 0.5
|
|
187
|
-
}, children: [_jsx(Flex, { container: {
|
|
188
|
-
gap: 1,
|
|
189
|
-
direction: 'column'
|
|
190
|
-
}, item: {
|
|
191
|
-
grow: 1
|
|
192
|
-
}, children: _jsx(EmailSelector, { participants: participants, selectedItems: to?.value || [], label: t('to'), mode: 'multi-select', required: true, onSelectedItemChange: (selectedItems) => {
|
|
193
|
-
onChange('to', selectedItems);
|
|
194
|
-
}, externalValidator: externalValidator, status: to?.error ? 'error' : undefined, info: to?.error }) }), !(userCCToggleState || hasCC) && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setUserCCToggleState(true), icon: true, children: t('cc') })), !(userBCCToggleState || hasBCC) && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setUserBCCToggleState(true), icon: true, children: t('bcc') }))] }), (userCCToggleState || hasCC) && (_jsx(EmailSelector, { participants: participants, selectedItems: cc?.value || [], label: t('cc'), mode: 'multi-select', onSelectedItemChange: (selectedItems) => onChange('cc', selectedItems), externalValidator: externalValidator, status: cc?.error ? 'error' : undefined, info: cc?.error })), (userBCCToggleState || hasBCC) && (_jsx(EmailSelector, { participants: participants, selectedItems: bcc?.value || [], label: t('bcc'), mode: 'multi-select', onSelectedItemChange: (selectedItems) => onChange('bcc', selectedItems), externalValidator: externalValidator, status: bcc?.error ? 'error' : undefined, info: bcc?.error })), _jsx(Input, { value: subject.value, onChange: (e) => onChange('subject', e.target.value), label: t('subject'), status: subject.error ? 'error' : undefined, info: subject.error }), _jsx(ComboBox, { label: t('response_templates'), value: filterValue, mode: 'single-select', menu: {
|
|
195
|
-
items: emailTemplatesToRender,
|
|
196
|
-
onItemClick: (id) => {
|
|
197
|
-
setFilterValue('');
|
|
198
|
-
onChange('selectedTemplateId', id);
|
|
199
|
-
},
|
|
200
|
-
accent: filterRegex
|
|
201
|
-
}, selected: selectedEmailTemplate
|
|
202
|
-
? {
|
|
203
|
-
items: {
|
|
204
|
-
id: selectedEmailTemplate.id,
|
|
205
|
-
text: selectedEmailTemplate.primary
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
: undefined, onChange: (e) => {
|
|
209
|
-
if (!e.target.value)
|
|
210
|
-
onChange('selectedTemplateId', '');
|
|
211
|
-
setFilterValue(e.target.value);
|
|
212
|
-
} }), _jsx(Editor, { autoFocus: true, ref: editorRef, toolbar: editorToolbar, onImageAdded: onImageAdded, labelHidden: true, label: t('email_message'), defaultValue: editorContent || bodyContent.defaultValue,
|
|
213
|
-
// Below rem values are derived from min 150px, max 300px minus the approx height of toolbar
|
|
214
|
-
height: {
|
|
215
|
-
min: stripUnit('7rem') * 16,
|
|
216
|
-
max: stripUnit('16.5rem') * 16
|
|
217
|
-
}, status: bodyContent.error ? 'error' : undefined, info: bodyContent.error, onChange: () => {
|
|
218
|
-
const currentHtml = editorRef?.current?.getHtml() || '';
|
|
219
|
-
setEditorContent(currentHtml);
|
|
220
|
-
onChange('bodyContent', currentHtml);
|
|
221
|
-
}, onInit: onEditorInit }), !!attachments?.length && (_jsx(Grid, { ref: ref, container: {
|
|
222
|
-
cols: 'repeat(auto-fill, minmax(15rem, 1fr))',
|
|
223
|
-
gap: 1
|
|
224
|
-
}, children: attachments?.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name, onDelete: onAttachmentDelete }))) }))] }));
|
|
225
|
-
const footerContent = (_jsx(Flex, { container: {
|
|
226
|
-
gap: 1,
|
|
227
|
-
direction: 'column'
|
|
228
|
-
}, item: { grow: 1 }, children: _jsxs(Flex, { container: {
|
|
229
|
-
gap: 1
|
|
230
|
-
}, children: [_jsxs(Flex, { container: true, item: { grow: 1 }, children: [_jsx(Button, { variant: 'secondary', onClick: () => {
|
|
231
|
-
onCancel();
|
|
232
|
-
}, children: t('cancel') }), footerMoreActions] }), _jsxs(Flex, { container: true, children: [_jsx(Button, { icon: true, onClick: () => fileUploadInputRef.current?.click(), variant: 'simple', label: t('file_upload_text_multiple'), children: _jsx(Icon, { name: 'paper-clip' }) }), onSave && _jsx(Button, { onClick: onSave, children: t('save_as_draft') }), _jsx(Button, { variant: 'primary', onClick: onSend, children: t('send') })] }), _jsx("input", { type: 'file', style: { display: 'none' }, ref: fileUploadInputRef, onChange: onFileChange, multiple: true })] }) }));
|
|
233
|
-
// Create modal on mount
|
|
234
|
-
useEffect(() => {
|
|
235
|
-
modalMethods.current = createModal(ComposerModal, { modalContent: content, actions: footerContent, progress, subject, onCancel, compose }, { minimizable: true, maximizable: true, dockable: true });
|
|
236
|
-
return () => {
|
|
237
|
-
// Will close the modal on unmount
|
|
238
|
-
modalMethods.current?.dismiss();
|
|
239
|
-
modalMethods.current?.unmount();
|
|
240
|
-
};
|
|
241
|
-
}, []);
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
modalMethods.current?.update({
|
|
244
|
-
modalContent: content,
|
|
245
|
-
actions: footerContent,
|
|
246
|
-
progress,
|
|
247
|
-
subject,
|
|
248
|
-
onCancel,
|
|
249
|
-
compose
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
return null;
|
|
253
|
-
});
|
|
254
|
-
export default EmailComposer;
|
|
255
|
-
//# sourceMappingURL=EmailComposer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailComposer.js","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAGV,QAAQ,EAER,OAAO,EACP,MAAM,EACN,mBAAmB,EACnB,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,UAAU,EAEV,KAAK,EAEL,KAAK,EAEL,eAAe,EACf,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,WAAW,EAGX,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAA4B,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAG9F,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,YAAY,CAAC,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAqB,CAAC,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C,CAAC,CAAC,MAAM,CAAC,GACH,IACJ,EACP,gBACE,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,YAAY,EACtB,QAAQ,SACR,IACG,GACF,CACR,CAAC;IAEF,wBAAwB;IACxB,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,GAAG,WAAW,CAChC,aAAa,EACb,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EACvF,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CACzD,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,kCAAkC;YAClC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAChC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC;YAC3B,YAAY,EAAE,OAAO;YACrB,OAAO,EAAE,aAAa;YACtB,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useState,\n ChangeEvent,\n useMemo,\n useRef,\n useImperativeHandle,\n useEffect,\n ReactNode\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { stripUnit } from 'polished';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n useI18n,\n defaultThemeProp,\n FileUploadItem,\n MenuButton,\n FileUploadItemProps,\n Input,\n ModalMethods,\n Modal,\n ModalProps,\n useModalManager,\n useModalContext,\n Grid,\n ComboBox,\n menuHelpers,\n MenuItemProps,\n MenuProps,\n createStringMatcher\n} from '@pega/cosmos-react-core';\nimport { Editor, EditorState, EditorProps } from '@pega/cosmos-react-rte';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\nimport * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';\nimport * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';\nimport * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';\n\nimport { EmailComposerProps } from './Email.types';\nimport EmailSelector from './EmailSelector';\n\nregisterIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);\n\nexport const StyledEmailComposer = styled.div<EmailComposerProps>(({ progress }) => {\n return css`\n ${progress\n ? css`\n visibility: hidden;\n `\n : css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledResponseTypeIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledResponseTypeIcon.defaultProps = defaultThemeProp;\n\nexport const StyledToggleButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(2 * ${theme.base.spacing});\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledToggleButton.defaultProps = defaultThemeProp;\n\nconst StyledResponseType = styled(MenuButton)`\n align-self: flex-start;\n`;\n\nStyledResponseType.defaultProps = defaultThemeProp;\n\nexport const StyledModal = styled(Modal)(({ state, theme }) => {\n if (state !== 'docked') return;\n\n return css`\n max-height: calc(100vh - ${theme.base.spacing} * 4);\n `;\n});\n\nStyledModal.defaultProps = defaultThemeProp;\n\nconst responseTypeIcons = {\n reply: 'reply',\n replyAll: 'reply-all',\n forward: 'forward'\n};\n\nconst editorToolbar: EditorProps['toolbar'] = [\n 'inline-styling',\n 'lists',\n 'indentation',\n 'images',\n 'links'\n];\n\nconst ComposerModal: FunctionComponent<{\n modalContent: JSX.Element;\n actions: ReactNode;\n progress: ModalProps['progress'];\n subject: EmailComposerProps['data']['subject'];\n onCancel: EmailComposerProps['onCancel'];\n compose: boolean;\n}> = ({\n modalContent,\n actions: modalActions,\n progress: modalProgress,\n subject,\n onCancel,\n compose\n}) => {\n const { state } = useModalContext();\n const t = useI18n();\n return (\n <StyledModal\n heading={compose ? t('compose_label') : subject.value}\n onRequestDismiss={() => {\n onCancel();\n return false;\n }}\n actions={!modalProgress ? modalActions : undefined}\n progress={modalProgress}\n state={state}\n >\n {modalContent}\n </StyledModal>\n );\n};\n\nconst createEmailTemplates = (\n selectedTemplateId: EmailComposerProps['data']['selectedTemplateId'],\n templates: EmailComposerProps['templates'] = []\n): MenuProps['items'] => {\n return templates.map(template => {\n return {\n id: template.id,\n primary: template.title,\n items: template.templates\n ? createEmailTemplates(selectedTemplateId, template.templates)\n : undefined,\n selected: template.id === selectedTemplateId\n };\n });\n};\n\nconst EmailComposer: FunctionComponent<EmailComposerProps> = forwardRef(function EmailComposer(\n {\n participants,\n senderAccounts,\n onCancel,\n onSend,\n onSave,\n onImageAdded,\n externalValidator,\n onChange,\n footerMoreActions,\n progress = false,\n templates,\n data: {\n to,\n cc,\n bcc,\n responseType,\n subject,\n bodyContent,\n selectedTemplateId,\n attachments,\n emailAccount\n },\n handle,\n onEditorInit,\n ...restProps\n }: PropsWithoutRef<EmailComposerProps>,\n ref: EmailComposerProps['ref']\n) {\n const t = useI18n();\n const { create: createModal } = useModalManager();\n\n const [userCCToggleState, setUserCCToggleState] = useState(false);\n const [userBCCToggleState, setUserBCCToggleState] = useState(false);\n const [editorContent, setEditorContent] = useState('');\n const [filterValue, setFilterValue] = useState('');\n\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const compose = useMemo(() => {\n return !!(senderAccounts && senderAccounts.length > 0);\n }, [senderAccounts]);\n\n const emailTemplatesToRender = useMemo(() => {\n const emailTemplates = createEmailTemplates(selectedTemplateId, templates);\n const newItems = filterValue\n ? menuHelpers.flatten(emailTemplates).filter(({ primary }: MenuItemProps) => {\n return filterRegex.test(primary);\n })\n : emailTemplates;\n\n return menuHelpers.mapTree(newItems, item => ({\n ...item,\n selected: item.items ? undefined : item.selected\n }));\n }, [filterValue, selectedTemplateId, templates]);\n\n const selectedEmailTemplate = useMemo(() => {\n return menuHelpers.getSelected(emailTemplatesToRender)[0];\n }, [emailTemplatesToRender]);\n\n const editorRef = useRef<EditorState>(null);\n const fileUploadInputRef = useRef<HTMLInputElement>(null);\n const modalMethods = useRef<ModalMethods>();\n\n const responseTypeMenuData = useMemo(() => {\n const menuItems = [\n {\n id: 'reply',\n primary: t('reply'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.reply} />,\n selected: responseType === 'reply',\n onClick: () => {\n onChange('responseType', 'reply');\n }\n },\n {\n id: 'replyAll',\n primary: t('reply_all'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.replyAll} />,\n selected: responseType === 'replyAll',\n onClick: () => {\n onChange('responseType', 'replyAll');\n }\n },\n {\n id: 'forward',\n primary: t('forward'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.forward} />,\n selected: responseType === 'forward',\n onClick: () => {\n onChange('responseType', 'forward');\n }\n }\n ];\n return {\n menuItems,\n selectedResponseType: menuItems.find(item => item.selected)?.primary || menuItems[0].primary,\n selectedResponseTypeIcon:\n (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply\n };\n }, [responseType]);\n\n const onAttachmentDelete = (name: FileUploadItemProps['name']) => {\n onChange('attachments', attachments?.filter(item => item.name !== name) || []);\n };\n\n const onFileChange = (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n const newFiles = Array.from(e.target.files).map(file => ({ name: file.name, file }));\n onChange('attachments', attachments ? [...attachments, ...newFiles] : newFiles);\n }\n };\n\n useImperativeHandle(handle, () => ({\n replaceBodyContent: (contentToReplace: string) => {\n editorRef.current?.insertHtml(contentToReplace, true);\n // Triggering onChange manually with new content as onChange on RTE is not triggered automatically for insertHTML\n onChange('bodyContent', editorRef.current?.getHtml() || '', true);\n },\n updateImage: (imageData: { src: string; alt: string }, id: string) => {\n editorRef.current?.appendImage(imageData, id);\n // Triggering onChange manually as onChange on RTE is not triggered automatically for appendImage\n onChange('bodyContent', editorRef.current?.getHtml() || '', true);\n },\n activate: () => {\n modalMethods.current?.activate();\n },\n setCursorLocationToStart: () => {\n editorRef.current?.setCursorLocationToStart?.();\n }\n }));\n\n const hasCC = useMemo(() => !!cc?.value?.length, [cc]);\n const hasBCC = useMemo(() => !!bcc?.value?.length, [bcc]);\n\n const content = (\n <Flex\n as={StyledEmailComposer}\n {...restProps}\n container={{\n gap: 2,\n direction: 'column'\n }}\n progress={!!progress}\n ref={ref}\n >\n {senderAccounts && senderAccounts.length > 0 && (\n <EmailSelector\n participants={senderAccounts}\n selectedItems={emailAccount ? [emailAccount.value] : []}\n label={t('email_account')}\n mode='single-select'\n required\n onSelectedItemChange={(selectedItems: string[]) => {\n onChange('emailAccount', selectedItems[0]);\n }}\n status={emailAccount?.error ? 'error' : undefined}\n info={emailAccount?.error}\n compose\n />\n )}\n {responseType && (\n <StyledResponseType\n text={responseTypeMenuData.selectedResponseType}\n variant='link'\n icon={responseTypeMenuData.selectedResponseTypeIcon}\n menu={{\n mode: 'single-select',\n items: responseTypeMenuData.menuItems\n }}\n />\n )}\n\n <Flex\n container={{\n alignItems: 'start',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n item={{\n grow: 1\n }}\n >\n <EmailSelector\n participants={participants}\n selectedItems={to?.value || []}\n label={t('to')}\n mode='multi-select'\n required\n onSelectedItemChange={(selectedItems: string[]) => {\n onChange('to', selectedItems);\n }}\n externalValidator={externalValidator}\n status={to?.error ? 'error' : undefined}\n info={to?.error}\n />\n </Flex>\n {!(userCCToggleState || hasCC) && (\n <StyledToggleButton variant='simple' onClick={() => setUserCCToggleState(true)} icon>\n {t('cc')}\n </StyledToggleButton>\n )}\n {!(userBCCToggleState || hasBCC) && (\n <StyledToggleButton variant='simple' onClick={() => setUserBCCToggleState(true)} icon>\n {t('bcc')}\n </StyledToggleButton>\n )}\n </Flex>\n\n {(userCCToggleState || hasCC) && (\n <EmailSelector\n participants={participants}\n selectedItems={cc?.value || []}\n label={t('cc')}\n mode='multi-select'\n onSelectedItemChange={(selectedItems: string[]) => onChange('cc', selectedItems)}\n externalValidator={externalValidator}\n status={cc?.error ? 'error' : undefined}\n info={cc?.error}\n />\n )}\n {(userBCCToggleState || hasBCC) && (\n <EmailSelector\n participants={participants}\n selectedItems={bcc?.value || []}\n label={t('bcc')}\n mode='multi-select'\n onSelectedItemChange={(selectedItems: string[]) => onChange('bcc', selectedItems)}\n externalValidator={externalValidator}\n status={bcc?.error ? 'error' : undefined}\n info={bcc?.error}\n />\n )}\n\n <Input\n value={subject.value}\n onChange={(e: ChangeEvent<HTMLInputElement>) => onChange('subject', e.target.value)}\n label={t('subject')}\n status={subject.error ? 'error' : undefined}\n info={subject.error}\n />\n\n <ComboBox\n label={t('response_templates')}\n value={filterValue}\n mode='single-select'\n menu={{\n items: emailTemplatesToRender,\n onItemClick: (id: MenuItemProps['id']) => {\n setFilterValue('');\n onChange('selectedTemplateId', id);\n },\n accent: filterRegex\n }}\n selected={\n selectedEmailTemplate\n ? {\n items: {\n id: selectedEmailTemplate.id,\n text: selectedEmailTemplate.primary\n }\n }\n : undefined\n }\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (!e.target.value) onChange('selectedTemplateId', '');\n setFilterValue(e.target.value);\n }}\n />\n\n <Editor\n autoFocus\n ref={editorRef}\n toolbar={editorToolbar}\n onImageAdded={onImageAdded}\n labelHidden\n label={t('email_message')}\n defaultValue={editorContent || bodyContent.defaultValue}\n // Below rem values are derived from min 150px, max 300px minus the approx height of toolbar\n height={{\n min: (stripUnit('7rem') as number) * 16,\n max: (stripUnit('16.5rem') as number) * 16\n }}\n status={bodyContent.error ? 'error' : undefined}\n info={bodyContent.error}\n onChange={() => {\n const currentHtml = editorRef?.current?.getHtml() || '';\n setEditorContent(currentHtml);\n onChange('bodyContent', currentHtml);\n }}\n onInit={onEditorInit}\n />\n {!!attachments?.length && (\n <Grid\n ref={ref}\n container={{\n cols: 'repeat(auto-fill, minmax(15rem, 1fr))',\n gap: 1\n }}\n >\n {attachments?.map(attachment => (\n <FileUploadItem {...attachment} key={attachment.name} onDelete={onAttachmentDelete} />\n ))}\n </Grid>\n )}\n </Flex>\n );\n\n const footerContent = (\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n item={{ grow: 1 }}\n >\n <Flex\n container={{\n gap: 1\n }}\n >\n <Flex container item={{ grow: 1 }}>\n <Button\n variant='secondary'\n onClick={() => {\n onCancel();\n }}\n >\n {t('cancel')}\n </Button>\n {footerMoreActions}\n </Flex>\n <Flex container>\n <Button\n icon\n onClick={() => fileUploadInputRef.current?.click()}\n variant='simple'\n label={t('file_upload_text_multiple')}\n >\n <Icon name='paper-clip' />\n </Button>\n\n {onSave && <Button onClick={onSave}>{t('save_as_draft')}</Button>}\n <Button variant='primary' onClick={onSend}>\n {t('send')}\n </Button>\n </Flex>\n <input\n type='file'\n style={{ display: 'none' }}\n ref={fileUploadInputRef}\n onChange={onFileChange}\n multiple\n />\n </Flex>\n </Flex>\n );\n\n // Create modal on mount\n useEffect(() => {\n modalMethods.current = createModal(\n ComposerModal,\n { modalContent: content, actions: footerContent, progress, subject, onCancel, compose },\n { minimizable: true, maximizable: true, dockable: true }\n );\n\n return () => {\n // Will close the modal on unmount\n modalMethods.current?.dismiss();\n modalMethods.current?.unmount();\n };\n }, []);\n\n useEffect(() => {\n modalMethods.current?.update({\n modalContent: content,\n actions: footerContent,\n progress,\n subject,\n onCancel,\n compose\n });\n });\n return null;\n});\n\nexport default EmailComposer;\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { EmailConversationProps } from './Email.types';
|
|
4
|
-
export declare const StyledEmailParticipantsText: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledCompactTimeStampDisplay: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
-
export declare const StyledConversationHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
|
|
7
|
-
collapsed: boolean;
|
|
8
|
-
}, never>;
|
|
9
|
-
export declare const StyledUnReadCount: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
-
export declare const StyledEmailConversation: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {
|
|
11
|
-
singleConversation?: boolean | undefined;
|
|
12
|
-
showHeader?: boolean | undefined;
|
|
13
|
-
}, never>;
|
|
14
|
-
export declare const StyledEmailInConversation: import("styled-components").StyledComponent<FunctionComponent<import("./Email.types").EmailProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
15
|
-
declare const EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps>;
|
|
16
|
-
export default EmailConversation;
|
|
17
|
-
//# sourceMappingURL=EmailConversation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailConversation.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8C,MAAM,OAAO,CAAC;AAKlG,OAAO,EAQL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAWvD,eAAO,MAAM,2BAA2B,iLAEvC,CAAC;AAIF,eAAO,MAAM,6BAA6B,iLAGzC,CAAC;AAGF,eAAO,MAAM,wBAAwB;eAA8B,OAAO;SAczE,CAAC;AAGF,eAAO,MAAM,iBAAiB,yGAsB7B,CAAC;AAIF,eAAO,MAAM,uBAAuB;;;SAqBnC,CAAC;AAGF,eAAO,MAAM,yBAAyB,wKA4BrC,CAAC;AAuEF,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CAgJ/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef, useState, useMemo } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { mix, readableColor } from 'polished';
|
|
5
|
-
import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
|
|
6
|
-
import { ExpandCollapse, Flex, Icon, registerIcon, Text, useI18n, defaultThemeProp, useAfterInitialEffect, DateTimeDisplay, readableHue, useBreakpoint, useConfiguration, StyledIcon, tryCatch, useDirection, Status } from '@pega/cosmos-react-core';
|
|
7
|
-
import Email from './Email';
|
|
8
|
-
registerIcon(caretDownIcon);
|
|
9
|
-
const EmailParticipantTextCss = css `
|
|
10
|
-
white-space: nowrap;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
text-overflow: ellipsis;
|
|
13
|
-
max-width: 100%;
|
|
14
|
-
`;
|
|
15
|
-
export const StyledEmailParticipantsText = styled(Text) `
|
|
16
|
-
${EmailParticipantTextCss}
|
|
17
|
-
`;
|
|
18
|
-
StyledEmailParticipantsText.defaultProps = defaultThemeProp;
|
|
19
|
-
export const StyledCompactTimeStampDisplay = styled(Text) `
|
|
20
|
-
${EmailParticipantTextCss}
|
|
21
|
-
margin-top: calc(${props => props.theme.base.spacing} / 2);
|
|
22
|
-
`;
|
|
23
|
-
StyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;
|
|
24
|
-
export const StyledConversationHeader = styled.header(({ theme: { base: { palette } }, collapsed }) => {
|
|
25
|
-
return css `
|
|
26
|
-
border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${palette['border-line']};
|
|
27
|
-
position: sticky;
|
|
28
|
-
top: 0;
|
|
29
|
-
z-index: 1;
|
|
30
|
-
`;
|
|
31
|
-
});
|
|
32
|
-
StyledConversationHeader.defaultProps = defaultThemeProp;
|
|
33
|
-
export const StyledUnReadCount = styled.div(({ theme: { base: { spacing, palette, 'font-weight': { 'semi-bold': fontWeightSemiBold } } } }) => {
|
|
34
|
-
const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);
|
|
35
|
-
const readableTextColor = readableColor(readableBackground);
|
|
36
|
-
return css `
|
|
37
|
-
align-self: flex-start;
|
|
38
|
-
background-color: ${readableBackground};
|
|
39
|
-
color: ${readableTextColor};
|
|
40
|
-
padding: 0 ${spacing};
|
|
41
|
-
font-weight: ${fontWeightSemiBold};
|
|
42
|
-
width: fit-content;
|
|
43
|
-
`;
|
|
44
|
-
});
|
|
45
|
-
StyledUnReadCount.defaultProps = defaultThemeProp;
|
|
46
|
-
export const StyledEmailConversation = styled.li(({ theme: { base: { spacing, palette, 'border-radius': baseBorderRadius } }, singleConversation, showHeader }) => {
|
|
47
|
-
return css `
|
|
48
|
-
margin-bottom: ${spacing};
|
|
49
|
-
border-radius: ${singleConversation && showHeader
|
|
50
|
-
? `0 0 ${baseBorderRadius} ${baseBorderRadius}`
|
|
51
|
-
: baseBorderRadius};
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
background-color: ${palette['primary-background']};
|
|
54
|
-
list-style-type: none;
|
|
55
|
-
`;
|
|
56
|
-
});
|
|
57
|
-
StyledEmailConversation.defaultProps = defaultThemeProp;
|
|
58
|
-
export const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base: { spacing, palette } } }) => {
|
|
59
|
-
const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);
|
|
60
|
-
return css `
|
|
61
|
-
padding: calc(2 * ${spacing}) 0;
|
|
62
|
-
position: relative;
|
|
63
|
-
:not(:last-child) {
|
|
64
|
-
border-bottom: 0.0625rem solid ${palette['border-line']};
|
|
65
|
-
}
|
|
66
|
-
${unRead &&
|
|
67
|
-
css `
|
|
68
|
-
&::before {
|
|
69
|
-
content: '';
|
|
70
|
-
background-color: ${readableBackground};
|
|
71
|
-
position: absolute;
|
|
72
|
-
inset: 0;
|
|
73
|
-
height: calc(100% + 0.0625rem);
|
|
74
|
-
top: -0.0625rem;
|
|
75
|
-
width: 0.125rem;
|
|
76
|
-
}
|
|
77
|
-
`}
|
|
78
|
-
`;
|
|
79
|
-
});
|
|
80
|
-
StyledEmailInConversation.defaultProps = defaultThemeProp;
|
|
81
|
-
const StyledUnreadIndicator = styled.span(({ theme: { base: { palette } }, isVisible }) => {
|
|
82
|
-
const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);
|
|
83
|
-
const diameter = '0.375rem';
|
|
84
|
-
return css `
|
|
85
|
-
width: ${isVisible ? diameter : 0};
|
|
86
|
-
margin: 0 ${isVisible ? 0 : '0.188rem'};
|
|
87
|
-
height: ${diameter};
|
|
88
|
-
display: inline-block;
|
|
89
|
-
border-radius: 50%;
|
|
90
|
-
background: ${readableBackground};
|
|
91
|
-
position: relative;
|
|
92
|
-
top: 0.375rem;
|
|
93
|
-
align-self: flex-start;
|
|
94
|
-
`;
|
|
95
|
-
});
|
|
96
|
-
StyledUnreadIndicator.defaultProps = defaultThemeProp;
|
|
97
|
-
const StyledConversationButton = styled.button(({ theme: { base: { spacing, palette } } }) => {
|
|
98
|
-
const hoverColor = tryCatch(() => mix(0.85, palette['primary-background'], palette['brand-primary']));
|
|
99
|
-
return css `
|
|
100
|
-
border-width: 0;
|
|
101
|
-
width: 100%;
|
|
102
|
-
padding: ${spacing};
|
|
103
|
-
background: ${palette['primary-background']};
|
|
104
|
-
color: ${palette['foreground-color']};
|
|
105
|
-
position: sticky;
|
|
106
|
-
top: 0;
|
|
107
|
-
z-index: 1;
|
|
108
|
-
|
|
109
|
-
&[aria-expanded='true'] {
|
|
110
|
-
border-bottom: 0.0625rem solid ${palette['border-line']};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&:focus {
|
|
114
|
-
background: ${palette['secondary-background']};
|
|
115
|
-
outline: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&:hover {
|
|
119
|
-
background: ${hoverColor};
|
|
120
|
-
outline: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
& > ${StyledIcon} {
|
|
124
|
-
align-self: flex-start;
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
127
|
-
});
|
|
128
|
-
StyledConversationButton.defaultProps = defaultThemeProp;
|
|
129
|
-
const EmailConversation = forwardRef(function EmailConversation(props, ref) {
|
|
130
|
-
const { id, emails, from, to, unReadEmailCount, timeStamp, isForwarded = false, isCollapsed = false, onCollapse, onExpand, undelivered, drafts, ...restProps } = props;
|
|
131
|
-
const t = useI18n();
|
|
132
|
-
const [collapsedState, setCollapsedState] = useState(isCollapsed);
|
|
133
|
-
useAfterInitialEffect(() => {
|
|
134
|
-
setCollapsedState(isCollapsed);
|
|
135
|
-
}, [isCollapsed]);
|
|
136
|
-
const onExpandCollapse = () => {
|
|
137
|
-
setCollapsedState(!collapsedState);
|
|
138
|
-
};
|
|
139
|
-
const headerRef = useRef(null);
|
|
140
|
-
const isSmallOrAbove = useBreakpoint('sm', {
|
|
141
|
-
breakpointRef: headerRef,
|
|
142
|
-
themeProp: 'content-width'
|
|
143
|
-
});
|
|
144
|
-
const { locale } = useConfiguration();
|
|
145
|
-
const { rtl } = useDirection();
|
|
146
|
-
const caretDirection = rtl ? 'caret-left' : 'caret-right';
|
|
147
|
-
const generateRecipientList = useMemo(() => {
|
|
148
|
-
const recipientElements = to.slice(0, 2).map((recipient, i) => {
|
|
149
|
-
return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;
|
|
150
|
-
});
|
|
151
|
-
if (to.length > 2) {
|
|
152
|
-
return [...recipientElements, `+${to.length - 2} more`];
|
|
153
|
-
}
|
|
154
|
-
return recipientElements;
|
|
155
|
-
}, [to]);
|
|
156
|
-
return (_jsxs(StyledEmailConversation, { ...restProps, id: id, ref: ref, children: [_jsxs(Flex, { as: StyledConversationButton, id: `conversation-heading${id}`, "aria-controls": id, "aria-expanded": !collapsedState, container: { gap: 1, alignItems: 'center', pad: 1 }, onClick: onExpandCollapse, ref: headerRef, children: [_jsx(Icon, { name: collapsedState ? caretDirection : 'caret-down' }), _jsx(StyledUnreadIndicator, { isVisible: !!unReadEmailCount }), _jsxs(Flex, { container: {
|
|
157
|
-
wrap: 'nowrap',
|
|
158
|
-
alignItems: 'start',
|
|
159
|
-
direction: 'column'
|
|
160
|
-
}, item: {
|
|
161
|
-
grow: 1,
|
|
162
|
-
shrink: 1
|
|
163
|
-
}, children: [_jsxs(Flex, { container: { gap: 1 }, children: [_jsx(Text, { variant: 'primary', as: StyledEmailParticipantsText, children: `${isForwarded ? 'FW' : t('from')}: ${from.fullName}` }), (undelivered || drafts) && (_jsxs(_Fragment, { children: [undelivered && _jsx(Status, { variant: 'urgent', children: t('undelivered') }), drafts && (_jsx(Status, { variant: 'pending', children: t('draft', [], { count: Infinity }) }))] }))] }), _jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${t('to')}: `, generateRecipientList] }), !isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledCompactTimeStampDisplay, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] }))] }), _jsx(Flex, { container: {
|
|
164
|
-
gap: 1,
|
|
165
|
-
alignItems: 'center'
|
|
166
|
-
}, item: {
|
|
167
|
-
shrink: 0
|
|
168
|
-
}, children: isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] })) })] }), _jsxs(ExpandCollapse, { as: Flex, container: { direction: 'column' }, collapsed: collapsedState, onBeforeCollapse: onCollapse, onBeforeExpand: onExpand, role: 'region', "aria-labelledby": `conversation-heading${id}`, id: `conversation-content${id}`, children: [!!unReadEmailCount && (_jsx(Text, { as: StyledUnReadCount, id: `unread-emailCount-${id}`, variant: 'secondary', children: t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount }) })), emails &&
|
|
169
|
-
emails.map(email => {
|
|
170
|
-
return _jsx(StyledEmailInConversation, { ...email }, email.id);
|
|
171
|
-
})] })] }));
|
|
172
|
-
});
|
|
173
|
-
export default EmailConversation;
|
|
174
|
-
//# sourceMappingURL=EmailConversation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailConversation.js","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EACL,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,MAAM,EACP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,YAAY,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;CAKlC,CAAC;AAEF,MAAM,CAA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E,EAC5C,EAAE,EAAE,uBAAuB,EAAE,EAAE,aAE9B,CAAC,CAAC,gBAAgB,IAAI,CACrB,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,YAC5E,CAAC,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,GAClE,CACR,EACA,MAAM;wBACL,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;4BACjB,OAAO,KAAC,yBAAyB,OAAoB,KAAK,IAAnB,KAAK,CAAC,EAAE,CAAe,CAAC;wBACjE,CAAC,CAAC,IACW,IACO,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useState, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport {\n ExpandCollapse,\n Flex,\n Icon,\n registerIcon,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useAfterInitialEffect,\n DateTimeDisplay,\n readableHue,\n useBreakpoint,\n useConfiguration,\n StyledIcon,\n tryCatch,\n useDirection,\n Status\n} from '@pega/cosmos-react-core';\n\nimport Email from './Email';\nimport { EmailConversationProps } from './Email.types';\n\nregisterIcon(caretDownIcon);\n\nconst EmailParticipantTextCss = css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n`;\n\nexport const StyledEmailParticipantsText = styled(Text)`\n ${EmailParticipantTextCss}\n`;\n\nStyledEmailParticipantsText.defaultProps = defaultThemeProp;\n\nexport const StyledCompactTimeStampDisplay = styled(Text)`\n ${EmailParticipantTextCss}\n margin-top: calc(${props => props.theme.base.spacing} / 2);\n`;\nStyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledConversationHeader = styled.header<{ collapsed: boolean }>(\n ({\n theme: {\n base: { palette }\n },\n collapsed\n }) => {\n return css`\n border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${palette['border-line']};\n position: sticky;\n top: 0;\n z-index: 1;\n `;\n }\n);\nStyledConversationHeader.defaultProps = defaultThemeProp;\n\nexport const StyledUnReadCount = styled.div(\n ({\n theme: {\n base: {\n spacing,\n palette,\n 'font-weight': { 'semi-bold': fontWeightSemiBold }\n }\n }\n }) => {\n const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);\n const readableTextColor = readableColor(readableBackground);\n\n return css`\n align-self: flex-start;\n background-color: ${readableBackground};\n color: ${readableTextColor};\n padding: 0 ${spacing};\n font-weight: ${fontWeightSemiBold};\n width: fit-content;\n `;\n }\n);\n\nStyledUnReadCount.defaultProps = defaultThemeProp;\n\nexport const StyledEmailConversation = styled.li<{\n singleConversation?: boolean;\n showHeader?: boolean;\n}>(\n ({\n theme: {\n base: { spacing, palette, 'border-radius': baseBorderRadius }\n },\n singleConversation,\n showHeader\n }) => {\n return css`\n margin-bottom: ${spacing};\n border-radius: ${singleConversation && showHeader\n ? `0 0 ${baseBorderRadius} ${baseBorderRadius}`\n : baseBorderRadius};\n overflow: hidden;\n background-color: ${palette['primary-background']};\n list-style-type: none;\n `;\n }\n);\nStyledEmailConversation.defaultProps = defaultThemeProp;\n\nexport const StyledEmailInConversation = styled(Email)(\n ({\n unRead,\n theme: {\n base: { spacing, palette }\n }\n }) => {\n const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);\n return css`\n padding: calc(2 * ${spacing}) 0;\n position: relative;\n :not(:last-child) {\n border-bottom: 0.0625rem solid ${palette['border-line']};\n }\n ${unRead &&\n css`\n &::before {\n content: '';\n background-color: ${readableBackground};\n position: absolute;\n inset: 0;\n height: calc(100% + 0.0625rem);\n top: -0.0625rem;\n width: 0.125rem;\n }\n `}\n `;\n }\n);\nStyledEmailInConversation.defaultProps = defaultThemeProp;\n\nconst StyledUnreadIndicator = styled.span<{ isVisible: boolean }>(\n ({\n theme: {\n base: { palette }\n },\n isVisible\n }) => {\n const readableBackground = readableHue(palette['brand-primary'], palette['primary-background']);\n\n const diameter = '0.375rem';\n\n return css`\n width: ${isVisible ? diameter : 0};\n margin: 0 ${isVisible ? 0 : '0.188rem'};\n height: ${diameter};\n display: inline-block;\n border-radius: 50%;\n background: ${readableBackground};\n position: relative;\n top: 0.375rem;\n align-self: flex-start;\n `;\n }\n);\nStyledUnreadIndicator.defaultProps = defaultThemeProp;\n\nconst StyledConversationButton = styled.button(\n ({\n theme: {\n base: { spacing, palette }\n }\n }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, palette['primary-background'], palette['brand-primary'])\n );\n return css`\n border-width: 0;\n width: 100%;\n padding: ${spacing};\n background: ${palette['primary-background']};\n color: ${palette['foreground-color']};\n position: sticky;\n top: 0;\n z-index: 1;\n\n &[aria-expanded='true'] {\n border-bottom: 0.0625rem solid ${palette['border-line']};\n }\n\n &:focus {\n background: ${palette['secondary-background']};\n outline: none;\n }\n\n &:hover {\n background: ${hoverColor};\n outline: none;\n }\n\n & > ${StyledIcon} {\n align-self: flex-start;\n }\n `;\n }\n);\n\nStyledConversationButton.defaultProps = defaultThemeProp;\n\nconst EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps> = forwardRef(\n function EmailConversation(\n props: PropsWithoutRef<EmailConversationProps>,\n ref: EmailConversationProps['ref']\n ) {\n const {\n id,\n emails,\n from,\n to,\n unReadEmailCount,\n timeStamp,\n isForwarded = false,\n isCollapsed = false,\n onCollapse,\n onExpand,\n undelivered,\n drafts,\n ...restProps\n } = props;\n const t = useI18n();\n const [collapsedState, setCollapsedState] = useState(isCollapsed);\n useAfterInitialEffect(() => {\n setCollapsedState(isCollapsed);\n }, [isCollapsed]);\n const onExpandCollapse = () => {\n setCollapsedState(!collapsedState);\n };\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', {\n breakpointRef: headerRef,\n themeProp: 'content-width'\n });\n const { locale } = useConfiguration();\n const { rtl } = useDirection();\n\n const caretDirection = rtl ? 'caret-left' : 'caret-right';\n const generateRecipientList = useMemo(() => {\n const recipientElements = to.slice(0, 2).map((recipient, i) => {\n return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;\n });\n if (to.length > 2) {\n return [...recipientElements, `+${to.length - 2} more`];\n }\n return recipientElements;\n }, [to]);\n\n return (\n <StyledEmailConversation {...restProps} id={id} ref={ref}>\n <Flex\n as={StyledConversationButton}\n id={`conversation-heading${id}`}\n aria-controls={id}\n aria-expanded={!collapsedState}\n container={{ gap: 1, alignItems: 'center', pad: 1 }}\n onClick={onExpandCollapse}\n ref={headerRef}\n >\n <Icon name={collapsedState ? caretDirection : 'caret-down'} />\n <StyledUnreadIndicator isVisible={!!unReadEmailCount} />\n <Flex\n container={{\n wrap: 'nowrap',\n alignItems: 'start',\n direction: 'column'\n }}\n item={{\n grow: 1,\n shrink: 1\n }}\n >\n <Flex container={{ gap: 1 }}>\n <Text variant='primary' as={StyledEmailParticipantsText}>\n {`${isForwarded ? 'FW' : t('from')}: ${from.fullName}`}\n </Text>\n\n {(undelivered || drafts) && (\n <>\n {undelivered && <Status variant='urgent'>{t('undelivered')}</Status>}\n {/* Passing Infinity for count so the correct plural translation is chosen\n along with an empty tokens array so that a count is not shown. */}\n {drafts && (\n <Status variant='pending'>{t('draft', [], { count: Infinity })}</Status>\n )}\n </>\n )}\n </Flex>\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${t('to')}: `}\n {generateRecipientList}\n </Text>\n {!isSmallOrAbove && (\n <Text variant='secondary' as={StyledCompactTimeStampDisplay}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n item={{\n shrink: 0\n }}\n >\n {isSmallOrAbove && (\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n </Flex>\n\n <ExpandCollapse\n as={Flex}\n container={{ direction: 'column' }}\n collapsed={collapsedState}\n onBeforeCollapse={onCollapse}\n onBeforeExpand={onExpand}\n role='region'\n aria-labelledby={`conversation-heading${id}`}\n id={`conversation-content${id}`}\n >\n {!!unReadEmailCount && (\n <Text as={StyledUnReadCount} id={`unread-emailCount-${id}`} variant='secondary'>\n {t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount })}\n </Text>\n )}\n {emails &&\n emails.map(email => {\n return <StyledEmailInConversation key={email.id} {...email} />;\n })}\n </ExpandCollapse>\n </StyledEmailConversation>\n );\n }\n);\n\nexport default EmailConversation;\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { EmailEntityProps } from './Email.types';
|
|
4
|
-
declare const EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps>;
|
|
5
|
-
export declare class EmailEntityWeb extends HTMLElement {
|
|
6
|
-
removeElements(): void;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
disconnectedCallback(): void;
|
|
9
|
-
}
|
|
10
|
-
export default EmailEntity;
|
|
11
|
-
//# sourceMappingURL=EmailEntity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailEntity.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA2B,MAAM,OAAO,CAAC;AAG/E,OAAO,EACL,YAAY,EAQb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAuCnE,CAAC;AAEF,qBAAa,cAAe,SAAQ,WAAW;IAC7C,cAAc;IAMd,iBAAiB;IAoBjB,oBAAoB;CAGrB;AAMD,eAAe,WAAW,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef } from 'react';
|
|
3
|
-
import { render, unmountComponentAtNode } from 'react-dom';
|
|
4
|
-
import { Tooltip, useConsolidatedRef, useElement, useI18n, useConfiguration, formatListToLocaleString, Icon } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledEmailEntity } from './Email.styles';
|
|
6
|
-
const EmailEntity = forwardRef(function EmailEntity({ entity, ...restProps }, ref) {
|
|
7
|
-
const [el, setEl] = useElement();
|
|
8
|
-
const elementRef = useConsolidatedRef(setEl, ref);
|
|
9
|
-
const t = useI18n();
|
|
10
|
-
const { locale } = useConfiguration();
|
|
11
|
-
const tooltipRef = useRef(null);
|
|
12
|
-
return (_jsxs(StyledEmailEntity, { ...restProps, entity: entity, ref: elementRef, "aria-label": Array.isArray(entity.description)
|
|
13
|
-
? formatListToLocaleString(entity.description, t, locale)
|
|
14
|
-
: entity.description, onContextMenu: () => {
|
|
15
|
-
if (tooltipRef.current)
|
|
16
|
-
tooltipRef.current.hidden = true;
|
|
17
|
-
}, contentEditable: false, children: [entity.value, entity.icon && _jsx(Icon, { name: entity.icon }), entity.description && entity.description.length > 0 && (_jsx(Tooltip, { target: el, ref: tooltipRef, hideDelay: 'short', children: Array.isArray(entity.description)
|
|
18
|
-
? formatListToLocaleString(entity.description, t, locale, {
|
|
19
|
-
separator: '\n'
|
|
20
|
-
})
|
|
21
|
-
: entity.description }))] }));
|
|
22
|
-
});
|
|
23
|
-
export class EmailEntityWeb extends HTMLElement {
|
|
24
|
-
removeElements() {
|
|
25
|
-
while (this.firstChild) {
|
|
26
|
-
this.removeChild(this.firstChild);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
connectedCallback() {
|
|
30
|
-
const inner = this.innerHTML;
|
|
31
|
-
this.removeElements();
|
|
32
|
-
const variant = Number(this.getAttribute('data-variant'));
|
|
33
|
-
const descAttribute = this.getAttribute('data-description');
|
|
34
|
-
const description = descAttribute !== null ? JSON.parse(descAttribute) : undefined;
|
|
35
|
-
const type = this.getAttribute('data-type') || '';
|
|
36
|
-
render(_jsx(EmailEntity, { entity: {
|
|
37
|
-
value: inner,
|
|
38
|
-
type,
|
|
39
|
-
variant,
|
|
40
|
-
description
|
|
41
|
-
} }), this);
|
|
42
|
-
}
|
|
43
|
-
disconnectedCallback() {
|
|
44
|
-
unmountComponentAtNode(this);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!customElements.get('pega-email-entity')) {
|
|
48
|
-
customElements.define('pega-email-entity', EmailEntityWeb);
|
|
49
|
-
}
|
|
50
|
-
export default EmailEntity;
|
|
51
|
-
//# sourceMappingURL=EmailEntity.js.map
|