@pega/cosmos-react-demos 3.0.0-dev.24.0 → 3.0.0-dev.27.0
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/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +51 -2
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js +380 -47
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +3 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx +206 -23
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx +16 -3
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx.map +1 -1
- package/jsx/core/FieldGroup/FieldGroup.stories.d.ts +2 -0
- package/jsx/core/FieldGroup/FieldGroup.stories.d.ts.map +1 -1
- package/jsx/core/FieldGroup/FieldGroup.stories.jsx +12 -4
- package/jsx/core/FieldGroup/FieldGroup.stories.jsx.map +1 -1
- package/jsx/core/Link/Link.stories.d.ts.map +1 -1
- package/jsx/core/Link/Link.stories.jsx +2 -1
- package/jsx/core/Link/Link.stories.jsx.map +1 -1
- package/jsx/core/ListToolbar/ListToolbar.stories.d.ts +3 -1
- package/jsx/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
- package/jsx/core/ListToolbar/ListToolbar.stories.jsx +15 -6
- package/jsx/core/ListToolbar/ListToolbar.stories.jsx.map +1 -1
- package/jsx/core/Modal/Modal.stories.d.ts +10 -1
- package/jsx/core/Modal/Modal.stories.d.ts.map +1 -1
- package/jsx/core/Modal/Modal.stories.jsx +33 -6
- package/jsx/core/Modal/Modal.stories.jsx.map +1 -1
- package/jsx/core/SkipLinks/SkipLinks.stories.d.ts +6 -0
- package/jsx/core/SkipLinks/SkipLinks.stories.d.ts.map +1 -0
- package/jsx/core/SkipLinks/SkipLinks.stories.jsx +29 -0
- package/jsx/core/SkipLinks/SkipLinks.stories.jsx.map +1 -0
- package/jsx/core/SkipLinks/SkipLinks.styles.d.ts +2 -0
- package/jsx/core/SkipLinks/SkipLinks.styles.d.ts.map +1 -0
- package/jsx/core/SkipLinks/SkipLinks.styles.js +16 -0
- package/jsx/core/SkipLinks/SkipLinks.styles.js.map +1 -0
- package/jsx/core/Tree/Tree.stories.d.ts.map +1 -1
- package/jsx/core/Tree/Tree.stories.jsx +14 -0
- package/jsx/core/Tree/Tree.stories.jsx.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/jsx/cs/TaskManager/TaskManager.stories.jsx +17 -10
- package/jsx/cs/TaskManager/TaskManager.stories.jsx.map +1 -1
- package/jsx/social/Chat/Chat.mocks.d.ts +14 -1
- package/jsx/social/Chat/Chat.mocks.d.ts.map +1 -1
- package/jsx/social/Chat/Chat.mocks.js +5 -5
- package/jsx/social/Chat/Chat.mocks.js.map +1 -1
- package/jsx/social/Chat/Chat.stories.d.ts.map +1 -1
- package/jsx/social/Chat/Chat.stories.jsx +87 -7
- package/jsx/social/Chat/Chat.stories.jsx.map +1 -1
- package/jsx/social/Email/Email.mocks.d.ts +10 -1
- package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
- package/jsx/social/Email/Email.mocks.jsx +12 -15
- package/jsx/social/Email/Email.mocks.jsx.map +1 -1
- package/jsx/social/Email/Email.stories.d.ts +15 -1
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +279 -108
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/tools/Clipboard/Clipboard.mocks.d.ts +2 -2
- package/jsx/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -1
- package/jsx/tools/Clipboard/Clipboard.mocks.jsx +42 -43
- package/jsx/tools/Clipboard/Clipboard.mocks.jsx.map +1 -1
- package/jsx/tools/Clipboard/Clipboard.stories.d.ts.map +1 -1
- package/jsx/tools/Clipboard/Clipboard.stories.jsx +32 -31
- package/jsx/tools/Clipboard/Clipboard.stories.jsx.map +1 -1
- package/jsx/work/Details/Details.stories.d.ts.map +1 -1
- package/jsx/work/Details/Details.stories.jsx +7 -0
- package/jsx/work/Details/Details.stories.jsx.map +1 -1
- package/jsx/work/SearchResults/SearchResults.mocks.d.ts +6 -0
- package/jsx/work/SearchResults/SearchResults.mocks.d.ts.map +1 -1
- package/jsx/work/SearchResults/SearchResults.mocks.jsx +39 -38
- package/jsx/work/SearchResults/SearchResults.mocks.jsx.map +1 -1
- package/jsx/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
- package/jsx/work/SearchResults/SearchResults.stories.jsx +71 -43
- package/jsx/work/SearchResults/SearchResults.stories.jsx.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +51 -2
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js +380 -47
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +3 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js +215 -26
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.js +16 -3
- package/lib/build/ObjectSelect/ObjectSelect.stories.js.map +1 -1
- package/lib/core/FieldGroup/FieldGroup.stories.d.ts +2 -0
- package/lib/core/FieldGroup/FieldGroup.stories.d.ts.map +1 -1
- package/lib/core/FieldGroup/FieldGroup.stories.js +11 -3
- package/lib/core/FieldGroup/FieldGroup.stories.js.map +1 -1
- package/lib/core/Link/Link.stories.d.ts.map +1 -1
- package/lib/core/Link/Link.stories.js +2 -1
- package/lib/core/Link/Link.stories.js.map +1 -1
- package/lib/core/ListToolbar/ListToolbar.stories.d.ts +3 -1
- package/lib/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
- package/lib/core/ListToolbar/ListToolbar.stories.js +15 -6
- package/lib/core/ListToolbar/ListToolbar.stories.js.map +1 -1
- package/lib/core/Modal/Modal.stories.d.ts +10 -1
- package/lib/core/Modal/Modal.stories.d.ts.map +1 -1
- package/lib/core/Modal/Modal.stories.js +33 -6
- package/lib/core/Modal/Modal.stories.js.map +1 -1
- package/lib/core/SkipLinks/SkipLinks.stories.d.ts +6 -0
- package/lib/core/SkipLinks/SkipLinks.stories.d.ts.map +1 -0
- package/lib/core/SkipLinks/SkipLinks.stories.js +28 -0
- package/lib/core/SkipLinks/SkipLinks.stories.js.map +1 -0
- package/lib/core/SkipLinks/SkipLinks.styles.d.ts +2 -0
- package/lib/core/SkipLinks/SkipLinks.styles.d.ts.map +1 -0
- package/lib/core/SkipLinks/SkipLinks.styles.js +16 -0
- package/lib/core/SkipLinks/SkipLinks.styles.js.map +1 -0
- package/lib/core/Tree/Tree.stories.d.ts.map +1 -1
- package/lib/core/Tree/Tree.stories.js +16 -0
- package/lib/core/Tree/Tree.stories.js.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.d.ts.map +1 -1
- package/lib/cs/TaskManager/TaskManager.stories.js +17 -10
- package/lib/cs/TaskManager/TaskManager.stories.js.map +1 -1
- package/lib/social/Chat/Chat.mocks.d.ts +14 -1
- package/lib/social/Chat/Chat.mocks.d.ts.map +1 -1
- package/lib/social/Chat/Chat.mocks.js +5 -5
- package/lib/social/Chat/Chat.mocks.js.map +1 -1
- package/lib/social/Chat/Chat.stories.d.ts.map +1 -1
- package/lib/social/Chat/Chat.stories.js +68 -6
- package/lib/social/Chat/Chat.stories.js.map +1 -1
- package/lib/social/Email/Email.mocks.d.ts +10 -1
- package/lib/social/Email/Email.mocks.d.ts.map +1 -1
- package/lib/social/Email/Email.mocks.js +12 -15
- package/lib/social/Email/Email.mocks.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts +15 -1
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +246 -85
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/tools/Clipboard/Clipboard.mocks.d.ts +2 -2
- package/lib/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -1
- package/lib/tools/Clipboard/Clipboard.mocks.js +35 -40
- package/lib/tools/Clipboard/Clipboard.mocks.js.map +1 -1
- package/lib/tools/Clipboard/Clipboard.stories.d.ts.map +1 -1
- package/lib/tools/Clipboard/Clipboard.stories.js +40 -31
- package/lib/tools/Clipboard/Clipboard.stories.js.map +1 -1
- package/lib/work/Details/Details.stories.d.ts.map +1 -1
- package/lib/work/Details/Details.stories.js +1 -1
- package/lib/work/Details/Details.stories.js.map +1 -1
- package/lib/work/SearchResults/SearchResults.mocks.d.ts +6 -0
- package/lib/work/SearchResults/SearchResults.mocks.d.ts.map +1 -1
- package/lib/work/SearchResults/SearchResults.mocks.js +39 -38
- package/lib/work/SearchResults/SearchResults.mocks.js.map +1 -1
- package/lib/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
- package/lib/work/SearchResults/SearchResults.stories.js +71 -43
- package/lib/work/SearchResults/SearchResults.stories.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useState, useRef, useCallback, useEffect, createRef } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import {
|
|
4
|
-
import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel, EmptyState, Modal, useModalManager, useModalContext, useToaster } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel, Modal, useModalManager, useModalContext, useToaster, Banner } from '@pega/cosmos-react-core';
|
|
5
4
|
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
6
|
-
import { Email as EmailComponent, EmailConversation, EmailComposer, EmailShell, EmailSummaryItem, EmailSummaryList, EntityList, EmailManager } from '@pega/cosmos-react-social';
|
|
5
|
+
import { Email as EmailComponent, EmailConversation, EmailComposer, EmailShell, EmailSummaryItem, EmailSummaryList, EntityList, EmailManager, EmailCaseView } from '@pega/cosmos-react-social';
|
|
7
6
|
import { AppShellDemo } from '../../core/AppShell/AppShell.stories';
|
|
8
|
-
import { bccParticipants, ccParticipants, emailBodyContent, participants, toParticipants, emailAttachments, EntityListMockData, viewAnalysisEmailHeaderMock, topicListMock,
|
|
7
|
+
import { bccParticipants, ccParticipants, emailBodyContent, participants, toParticipants, emailAttachments, EntityListMockData, viewAnalysisEmailHeaderMock, topicListMock, generateEmailConversationParticipants, templates, handleExternalEntry, emailDemoActions, LaunchAction, baseComposerProps, sentiment, emailSummaryItems, mockEmails, mockSuggestedReplies, mockEmailBodyTemplates, forwardedContent, getCompositeId, emptyFieldErrorMessage, fieldValidation, emailWorklistItemsMock, contextMenuItemsMock, highlightedEntitiesMock, mockUploadImage, mailDeliverySystemEmail, supportTeamEmail } from './Email.mocks';
|
|
9
8
|
import { StyledEmailCardContent } from './Email.styles';
|
|
10
9
|
registerIcon(filterIcon);
|
|
11
10
|
export default {
|
|
@@ -13,27 +12,52 @@ export default {
|
|
|
13
12
|
component: EmailComponent
|
|
14
13
|
};
|
|
15
14
|
export const Email = (args) => {
|
|
16
|
-
const
|
|
15
|
+
const contextMenuHandle = useRef(null);
|
|
17
16
|
const timeout = useRef(null);
|
|
18
|
-
const handleRightClick = () => {
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const handleRightClick = (id, e) => {
|
|
18
|
+
action('onContextMenu')(id, e);
|
|
19
|
+
if (contextMenuHandle.current && args.enableContextMenu) {
|
|
20
|
+
const { setItems, setOpen, setLoading } = contextMenuHandle.current;
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
setLoading(true);
|
|
23
|
+
setItems([]);
|
|
24
|
+
setOpen(true);
|
|
25
|
+
if (timeout.current) {
|
|
26
|
+
clearTimeout(timeout.current);
|
|
27
|
+
}
|
|
28
|
+
timeout.current = window.setTimeout(() => {
|
|
29
|
+
setItems(contextMenuItemsMock);
|
|
30
|
+
setLoading(false);
|
|
31
|
+
}, 1000);
|
|
21
32
|
}
|
|
22
|
-
timeout.current = window.setTimeout(() => {
|
|
23
|
-
emailImperativeHandle.current?.setContextMenuItems(contextMenuItemsMock);
|
|
24
|
-
}, 1000);
|
|
25
33
|
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
return () => {
|
|
36
|
+
if (timeout.current) {
|
|
37
|
+
window.clearTimeout(timeout.current);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
26
41
|
return (<Card>
|
|
27
42
|
<StyledEmailCardContent>
|
|
28
|
-
<EmailComponent id={createUID()} timeStamp='2021-01-05T09:12' from={mockEmails['Laura Stevens']} cc={[mockEmails['Adam Gillchrist'], mockEmails['John Paul']]} bcc={[mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']]} to={[mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']]} body='<div>Hi,<br/><p>I am one of the customer of Indian Overseas Bank, <b><i>Nagercoil</i></b> branch, with code <b><a href="www.google.com"><i>3967</i></a></b>. I have a saving bank account here. My account number is <i>6785420965476</i>.</p><br/><p>I have been given a debit cum ATM card from this bank and the same has been lost when I was traveling from Nagercoil to Trichy by Bus on Jan 04, 2021. I remember that my ATM card number was 1920 6746 8653 1256.</p><br/>I hereby request you to block my debit card immediately to prevent misuse of the same by some others. Also I request you to give me an new debit card as early as possible.<br/><br/>Regards,<br/>Laura Stevens</div>' forwardedContent={args.forwardedContent} entityHighlightMapping={args.enableEntityHighlighting ? highlightedEntitiesMock : undefined} subject='I lost my debit card'
|
|
29
|
-
variant: 'neutral'
|
|
30
|
-
}} actions={emailActions} suggestions={mockSuggestedReplies} contextMenu={args.enableContextMenu
|
|
43
|
+
<EmailComponent id={createUID()} timeStamp='2021-01-05T09:12' from={mockEmails['Laura Stevens']} cc={[mockEmails['Adam Gillchrist'], mockEmails['John Paul']]} bcc={[mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']]} to={[mockEmails['Sara Davis'], mockEmails['John Brown'], mockEmails['Joe Stevens']]} body='<div>Hi,<br/><p>I am one of the customer of Indian Overseas Bank, <b><i>Nagercoil</i></b> branch, with code <b><a href="www.google.com"><i>3967</i></a></b>. I have a saving bank account here. My account number is <i>6785420965476</i>.</p><br/><p>I have been given a debit cum ATM card from this bank and the same has been lost when I was traveling from Nagercoil to Trichy by Bus on Jan 04, 2021. I remember that my ATM card number was 1920 6746 8653 1256.</p><br/>I hereby request you to block my debit card immediately to prevent misuse of the same by some others. Also I request you to give me an new debit card as early as possible.<br/><br/>Regards,<br/>Laura Stevens</div>' forwardedContent={args.forwardedContent} entityHighlightMapping={args.enableEntityHighlighting ? highlightedEntitiesMock : undefined} subject='I lost my debit card' banner={args.showEmailBanner
|
|
31
44
|
? {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
id: 'banner_1',
|
|
46
|
+
heading: 'Address not found ',
|
|
47
|
+
messages: [
|
|
48
|
+
'550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipients email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/?p=NoSuchUser k24-20020aa790d8000000b0050dd7e3b84csor451330pfk.28'
|
|
49
|
+
]
|
|
35
50
|
}
|
|
36
|
-
: undefined}
|
|
51
|
+
: undefined} onReply={args.showDraft ? undefined : action('On reply')} onReplyAll={args.showDraft ? undefined : action('On reply all')} onForward={args.showDraft ? undefined : action('On forward')} onEditDraft={args.showDraft ? action('On forward') : undefined} onDeleteDraft={args.showDraft ? action('On forward') : undefined} onSuggestionClick={action('On Suggested reply clicked')} sentiment={{
|
|
52
|
+
variant: 'neutral'
|
|
53
|
+
}} status={args.showDraft ? 'draft' : undefined} suggestions={mockSuggestedReplies} contextMenu={{
|
|
54
|
+
onItemClick: (selectedValue) => {
|
|
55
|
+
action('onItemClick')(selectedValue);
|
|
56
|
+
contextMenuHandle.current?.setOpen(false);
|
|
57
|
+
},
|
|
58
|
+
onContextMenu: handleRightClick,
|
|
59
|
+
handle: contextMenuHandle
|
|
60
|
+
}} attachments={[
|
|
37
61
|
{
|
|
38
62
|
id: 'attachment_0',
|
|
39
63
|
value: 'https://pega.com/media/document.doc',
|
|
@@ -57,12 +81,16 @@ export const Email = (args) => {
|
|
|
57
81
|
Email.args = {
|
|
58
82
|
enableEntityHighlighting: false,
|
|
59
83
|
enableContextMenu: false,
|
|
60
|
-
forwardedContent
|
|
84
|
+
forwardedContent,
|
|
85
|
+
showEmailBanner: false,
|
|
86
|
+
showDraft: false
|
|
61
87
|
};
|
|
62
88
|
Email.argTypes = {
|
|
63
89
|
enableEntityHighlighting: { control: { type: 'boolean' } },
|
|
64
90
|
enableContextMenu: { control: { type: 'boolean' } },
|
|
65
|
-
forwardedContent: { control: { type: 'text' } }
|
|
91
|
+
forwardedContent: { control: { type: 'text' } },
|
|
92
|
+
showEmailBanner: { control: { type: 'boolean' } },
|
|
93
|
+
showDraft: { control: { type: 'boolean' } }
|
|
66
94
|
};
|
|
67
95
|
export const Composer = () => {
|
|
68
96
|
const [composerProgress, setComposerProgress] = useState(false);
|
|
@@ -229,7 +257,6 @@ export const Conversation = () => {
|
|
|
229
257
|
onReply: action('On reply'),
|
|
230
258
|
onForward: action('On forward'),
|
|
231
259
|
onSuggestionClick: action('On Suggested reply clicked'),
|
|
232
|
-
actions: emailActions,
|
|
233
260
|
suggestions: mockSuggestedReplies
|
|
234
261
|
},
|
|
235
262
|
{
|
|
@@ -242,8 +269,7 @@ export const Conversation = () => {
|
|
|
242
269
|
body: '<div> Hi, <br /> <br /> <div>I’m still at the airport, I need help now!! </div> <br /><br /> Regards, <br /> Sara Davis </div>',
|
|
243
270
|
onReply: action('On reply'),
|
|
244
271
|
onForward: action('On forward'),
|
|
245
|
-
onSuggestionClick: action('On Suggested reply clicked')
|
|
246
|
-
actions: emailActions
|
|
272
|
+
onSuggestionClick: action('On Suggested reply clicked')
|
|
247
273
|
}
|
|
248
274
|
];
|
|
249
275
|
return (<EmailConversation participants={generateEmailConversationParticipants(emailArr)} from={generateEmailConversationParticipants(emailArr, ['from'])[0]} to={generateEmailConversationParticipants(emailArr, ['to'])} id={createUID()} timeStamp={emailArr[0].timeStamp} unReadEmailCount={emailArr.filter(item => item.unRead).length} emails={emailArr}/>);
|
|
@@ -378,6 +404,7 @@ export const EmailShellDemo = (args) => {
|
|
|
378
404
|
const MyModal = ({ currentID }) => {
|
|
379
405
|
const { dismiss } = useModalContext();
|
|
380
406
|
return (<Modal heading='Discard unsaved changes?' actions={<>
|
|
407
|
+
<Button onClick={dismiss}>Go back</Button>
|
|
381
408
|
<Flex>
|
|
382
409
|
<Button onClick={() => {
|
|
383
410
|
dismiss();
|
|
@@ -399,10 +426,9 @@ export const EmailShellDemo = (args) => {
|
|
|
399
426
|
push({ content: 'Draft Saved' });
|
|
400
427
|
}, 1000);
|
|
401
428
|
}}>
|
|
402
|
-
Save
|
|
429
|
+
Save & close
|
|
403
430
|
</Button>
|
|
404
|
-
|
|
405
|
-
<Button onClick={() => {
|
|
431
|
+
<Button variant='primary' onClick={() => {
|
|
406
432
|
dismiss();
|
|
407
433
|
setComposersData(prev => {
|
|
408
434
|
const newComposersData = { ...prev };
|
|
@@ -413,12 +439,7 @@ export const EmailShellDemo = (args) => {
|
|
|
413
439
|
Discard
|
|
414
440
|
</Button>
|
|
415
441
|
</Flex>
|
|
416
|
-
|
|
417
|
-
dismiss();
|
|
418
|
-
}}>
|
|
419
|
-
Cancel
|
|
420
|
-
</Button>
|
|
421
|
-
</>} center>
|
|
442
|
+
</>}>
|
|
422
443
|
<Text variant='primary'>
|
|
423
444
|
You have unsaved changes. You can discard them or go back to keep working.
|
|
424
445
|
</Text>
|
|
@@ -579,27 +600,72 @@ export const EmailShellDemo = (args) => {
|
|
|
579
600
|
}
|
|
580
601
|
};
|
|
581
602
|
});
|
|
603
|
+
const DeleteDraft = ({ currentID }) => {
|
|
604
|
+
const { dismiss } = useModalContext();
|
|
605
|
+
return (<Modal heading='Delete draft?' actions={<>
|
|
606
|
+
<Button onClick={dismiss}>Go back</Button>
|
|
607
|
+
|
|
608
|
+
<Button variant='primary' onClick={() => {
|
|
609
|
+
dismiss();
|
|
610
|
+
setConversationEmails(prev => {
|
|
611
|
+
const newEmailConversation = [];
|
|
612
|
+
prev.forEach(arr => {
|
|
613
|
+
const newArr = arr.filter(index => index.id !== currentID);
|
|
614
|
+
if (newArr.length !== 0)
|
|
615
|
+
newEmailConversation.push(newArr);
|
|
616
|
+
});
|
|
617
|
+
return newEmailConversation;
|
|
618
|
+
});
|
|
619
|
+
}}>
|
|
620
|
+
Delete
|
|
621
|
+
</Button>
|
|
622
|
+
</>}>
|
|
623
|
+
<Text>Are you sure that you want to permanently delete the selected message?</Text>
|
|
624
|
+
</Modal>);
|
|
625
|
+
};
|
|
582
626
|
const deleteEmail = (id) => {
|
|
583
|
-
|
|
584
|
-
const newEmailConversation = [];
|
|
585
|
-
prev.forEach(arr => {
|
|
586
|
-
const newArr = arr.filter(index => index.id !== id);
|
|
587
|
-
if (newArr.length !== 0)
|
|
588
|
-
newEmailConversation.push(newArr);
|
|
589
|
-
});
|
|
590
|
-
return newEmailConversation;
|
|
591
|
-
});
|
|
627
|
+
create(DeleteDraft, { currentID: id }, { alert: true });
|
|
592
628
|
};
|
|
593
629
|
useEffect(() => {
|
|
594
630
|
setConversationEmails([
|
|
595
|
-
[
|
|
631
|
+
[
|
|
632
|
+
{
|
|
633
|
+
...emailsData[1],
|
|
634
|
+
id: 'item0',
|
|
635
|
+
from: mailDeliverySystemEmail,
|
|
636
|
+
to: [supportTeamEmail],
|
|
637
|
+
body: '<div>Hi, <br /> <br /><div>Your address change request is approved.</div> <br /> <br />Regards, <br />Support team </div>',
|
|
638
|
+
banner: {
|
|
639
|
+
id: 'banner_1',
|
|
640
|
+
heading: 'Address not found ',
|
|
641
|
+
messages: [
|
|
642
|
+
'550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipients email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/?p=NoSuchUser k24-20020aa790d8000000b0050dd7e3b84csor451330pfk.28'
|
|
643
|
+
]
|
|
644
|
+
},
|
|
645
|
+
onReply: undefined,
|
|
646
|
+
onForward: undefined
|
|
647
|
+
},
|
|
648
|
+
{ ...emailsData[1], unRead: false }
|
|
649
|
+
],
|
|
596
650
|
[
|
|
597
651
|
{
|
|
598
652
|
...emailsData[0],
|
|
599
653
|
id: 'item2',
|
|
600
654
|
status: 'draft',
|
|
655
|
+
onEditDraft: (id) => createOrActivateComposer(id, LaunchAction.REPLY, {
|
|
656
|
+
...baseComposerProps,
|
|
657
|
+
data: {
|
|
658
|
+
...baseComposerProps.data,
|
|
659
|
+
responseType: 'reply',
|
|
660
|
+
subject: { value: `Re-${emailsData[0].subject}` || '' },
|
|
661
|
+
bodyContent: { defaultValue: emailsData[0].body || '' }
|
|
662
|
+
}
|
|
663
|
+
}),
|
|
664
|
+
onDeleteDraft: (id) => deleteEmail(id),
|
|
665
|
+
onReply: undefined,
|
|
666
|
+
onForward: undefined,
|
|
667
|
+
suggestions: undefined,
|
|
601
668
|
unRead: false,
|
|
602
|
-
actions: emailDemoActions('item2', emailsData[0].subject, createOrActivateComposer, true, '<div>Hi, <br /> <br /><div>Sure, Our executive will come and check your connection in 24hrs. </div> <br />Regards, <br />Hugh Phillips </div>', deleteEmail),
|
|
603
669
|
timeStamp: '2021-01-03T17:15',
|
|
604
670
|
from: mockEmails['Hugh Phillips'],
|
|
605
671
|
to: [mockEmails['Mystery Rey'], ...emailsData[0].to],
|
|
@@ -611,7 +677,19 @@ export const EmailShellDemo = (args) => {
|
|
|
611
677
|
...emailsData[1],
|
|
612
678
|
id: 'item3',
|
|
613
679
|
status: 'draft',
|
|
614
|
-
|
|
680
|
+
onEditDraft: (id) => createOrActivateComposer(id, LaunchAction.REPLY, {
|
|
681
|
+
...baseComposerProps,
|
|
682
|
+
data: {
|
|
683
|
+
...baseComposerProps.data,
|
|
684
|
+
responseType: 'reply',
|
|
685
|
+
subject: { value: `Re-${emailsData[0].subject}` || '' },
|
|
686
|
+
bodyContent: { defaultValue: emailsData[0].body || '' }
|
|
687
|
+
}
|
|
688
|
+
}),
|
|
689
|
+
onDeleteDraft: (id) => deleteEmail(id),
|
|
690
|
+
onReply: undefined,
|
|
691
|
+
onForward: undefined,
|
|
692
|
+
suggestions: undefined,
|
|
615
693
|
unRead: false,
|
|
616
694
|
timeStamp: '2021-01-02T14:16',
|
|
617
695
|
from: mockEmails['Mystery Rey'],
|
|
@@ -646,8 +724,8 @@ export const EmailShellDemo = (args) => {
|
|
|
646
724
|
}, []);
|
|
647
725
|
const emailConversations = conversationEmails.map((emails, i) => {
|
|
648
726
|
return {
|
|
649
|
-
from: generateEmailConversationParticipants(emails, ['from'])[0],
|
|
650
|
-
to: emails[0].to,
|
|
727
|
+
from: i === 0 ? emails[1].from : generateEmailConversationParticipants(emails, ['from'])[0],
|
|
728
|
+
to: i === 0 ? emails[1].to : emails[0].to,
|
|
651
729
|
id: `item_${i}`,
|
|
652
730
|
timeStamp: emails[0].timeStamp,
|
|
653
731
|
unReadEmailCount: emails.filter(item => item.unRead).length,
|
|
@@ -665,23 +743,43 @@ export const EmailShellDemo = (args) => {
|
|
|
665
743
|
to: generateEmailConversationParticipants(emailsData, ['to']),
|
|
666
744
|
id: 'item_0',
|
|
667
745
|
timeStamp: new Date(emailsData[0].timeStamp),
|
|
668
|
-
unReadEmailCount:
|
|
669
|
-
emails: [
|
|
746
|
+
unReadEmailCount: 1,
|
|
747
|
+
emails: [
|
|
748
|
+
{
|
|
749
|
+
...emailsData[1],
|
|
750
|
+
id: 'item0',
|
|
751
|
+
from: mailDeliverySystemEmail,
|
|
752
|
+
to: [supportTeamEmail],
|
|
753
|
+
body: '<div>Hi, <br /> <br /><div>Your address change request is approved.</div> <br /> <br />Regards, <br />Support team </div>',
|
|
754
|
+
banner: {
|
|
755
|
+
id: 'banner_1',
|
|
756
|
+
heading: 'Address not found ',
|
|
757
|
+
messages: [
|
|
758
|
+
'550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipients email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/?p=NoSuchUser k24-20020aa790d8000000b0050dd7e3b84csor451330pfk.28'
|
|
759
|
+
]
|
|
760
|
+
},
|
|
761
|
+
onReply: undefined,
|
|
762
|
+
onForward: undefined
|
|
763
|
+
},
|
|
764
|
+
{ ...emailsData[1], unRead: false }
|
|
765
|
+
]
|
|
670
766
|
}
|
|
671
767
|
];
|
|
672
768
|
return (<>
|
|
673
|
-
<EmailShell headerProps={
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
769
|
+
<EmailShell headerProps={args.showHeader
|
|
770
|
+
? {
|
|
771
|
+
actions: (<Flex container={{
|
|
772
|
+
alignItems: 'center',
|
|
773
|
+
gap: 0
|
|
774
|
+
}}>
|
|
775
|
+
<Button variant='simple' icon>
|
|
776
|
+
<Icon name='filter'/>
|
|
777
|
+
</Button>
|
|
778
|
+
<MenuButton variant='simple' text='More actions' icon='more' iconOnly portal menu={{ items: actions }}/>
|
|
779
|
+
</Flex>),
|
|
780
|
+
subject: 'Pause service'
|
|
781
|
+
}
|
|
782
|
+
: undefined} autoCollapse={args.autoCollapse} conversations={args.singleConversation ? singleEmailConversation : emailConversations}/>
|
|
685
783
|
<>
|
|
686
784
|
{Object.keys(composersData).map(guid => {
|
|
687
785
|
return <EmailComposer key={guid} {...composersData[guid]}/>;
|
|
@@ -692,37 +790,53 @@ export const EmailShellDemo = (args) => {
|
|
|
692
790
|
EmailShellDemo.args = {
|
|
693
791
|
autoCollapse: true,
|
|
694
792
|
hideSuggestions: false,
|
|
695
|
-
singleConversation:
|
|
793
|
+
singleConversation: false,
|
|
794
|
+
showHeader: true
|
|
696
795
|
};
|
|
697
796
|
EmailShellDemo.argTypes = {
|
|
698
797
|
autoCollapse: { control: { type: 'boolean' } },
|
|
699
798
|
hideSuggestions: { control: { type: 'boolean' } },
|
|
700
|
-
singleConversation: { control: { type: 'boolean' } }
|
|
799
|
+
singleConversation: { control: { type: 'boolean' } },
|
|
800
|
+
showHeader: { control: { type: 'boolean' } }
|
|
701
801
|
};
|
|
702
802
|
export const EntityListDemo = (args) => {
|
|
703
803
|
const itemCounter = useRef(3);
|
|
704
804
|
const timeout = useRef(null);
|
|
705
|
-
const
|
|
805
|
+
const contextMenuHandle = useRef(null);
|
|
706
806
|
const headerProps = {
|
|
707
807
|
icon: 'list-number',
|
|
708
808
|
text: 'Entities'
|
|
709
809
|
};
|
|
710
|
-
const handleRightClick = () => {
|
|
711
|
-
|
|
712
|
-
if (
|
|
713
|
-
|
|
810
|
+
const handleRightClick = (e) => {
|
|
811
|
+
action('onContextMenu')(e);
|
|
812
|
+
if (contextMenuHandle.current && args.enableContextMenu) {
|
|
813
|
+
itemCounter.current += 1;
|
|
814
|
+
const { setItems, setOpen, setLoading } = contextMenuHandle.current;
|
|
815
|
+
e.preventDefault();
|
|
816
|
+
setLoading(true);
|
|
817
|
+
setItems([]);
|
|
818
|
+
setOpen(true);
|
|
819
|
+
if (timeout.current) {
|
|
820
|
+
window.clearTimeout(timeout.current);
|
|
821
|
+
}
|
|
822
|
+
timeout.current = window.setTimeout(() => {
|
|
823
|
+
setItems(contextMenuItemsMock);
|
|
824
|
+
setLoading(false);
|
|
825
|
+
}, 1000);
|
|
714
826
|
}
|
|
715
|
-
timeout.current = window.setTimeout(() => {
|
|
716
|
-
imperativeHandle.current?.setContextMenuItems(contextMenuItemsMock);
|
|
717
|
-
}, 1000);
|
|
718
827
|
};
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
handle: imperativeHandle
|
|
828
|
+
useEffect(() => {
|
|
829
|
+
return () => {
|
|
830
|
+
if (timeout.current) {
|
|
831
|
+
window.clearTimeout(timeout.current);
|
|
724
832
|
}
|
|
725
|
-
|
|
833
|
+
};
|
|
834
|
+
}, []);
|
|
835
|
+
return (<EntityList header={headerProps} content={EntityListMockData} contextMenu={{
|
|
836
|
+
onItemClick: action('onItemClick'),
|
|
837
|
+
onContextMenu: args.onContextMenu || handleRightClick,
|
|
838
|
+
handle: contextMenuHandle
|
|
839
|
+
}}/>);
|
|
726
840
|
};
|
|
727
841
|
EntityListDemo.args = {
|
|
728
842
|
enableContextMenu: true
|
|
@@ -791,15 +905,61 @@ export const EmailSummaryListDemo = (args) => {
|
|
|
791
905
|
}, [loading]);
|
|
792
906
|
return (<EmailSummaryList ref={emailSummaryListRef} unreadEmailCount={99} categories={categories} items={args.items || allEmailItems} onItemClick={args.onItemClick || handleItemClick} onCategoryClick={onCategoryClick} onLoadMore={args.onLoadMore || (hasMore ? loadMore : undefined)} loading={args.loading || loading} emptyMessage='No emails.'/>);
|
|
793
907
|
};
|
|
908
|
+
export const EmailCaseViewDemo = (args) => {
|
|
909
|
+
const content = <EmailShellDemo />;
|
|
910
|
+
const utilities = (<Grid container={{ rowGap: 2 }}>
|
|
911
|
+
<EntityListDemo />
|
|
912
|
+
<Card>
|
|
913
|
+
<CardHeader container={{ alignItems: 'center', gap: 1 }}>
|
|
914
|
+
<Icon name='document-doc'/>
|
|
915
|
+
<Text variant='h3'>Email header</Text>
|
|
916
|
+
</CardHeader>
|
|
917
|
+
<CardContent>
|
|
918
|
+
<FieldValueList fields={viewAnalysisEmailHeaderMock} variant='stacked'/>
|
|
919
|
+
</CardContent>
|
|
920
|
+
</Card>
|
|
921
|
+
<SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
|
|
922
|
+
...items,
|
|
923
|
+
primary: <StyledLabel>{items.primary}</StyledLabel>,
|
|
924
|
+
secondary: (<Flex container={{ direction: 'row', justify: 'between' }}>
|
|
925
|
+
<Text variant='primary'>{items.secondary.indicator}</Text>
|
|
926
|
+
<StyledLabel>{items.secondary.value}</StyledLabel>
|
|
927
|
+
</Flex>)
|
|
928
|
+
}))} noItemsText='No items'/>
|
|
929
|
+
</Grid>);
|
|
930
|
+
return (<AppShellDemo appHeader main={<EmailCaseView header={args.showHeader
|
|
931
|
+
? {
|
|
932
|
+
icon: 'mail',
|
|
933
|
+
title: 'ET-5432'
|
|
934
|
+
}
|
|
935
|
+
: undefined} banners={args.showBanners && (<Banner id='error' variant='urgent' heading='Error' messages={['Your email could not be delivered due to poor network connection.']}/>)} content={content} utilities={!args.noUtilityView && utilities} utilitiesSummaryItems={!args.noUtilityView
|
|
936
|
+
? [
|
|
937
|
+
{ iconName: 'list-number', count: 7 },
|
|
938
|
+
{ iconName: 'document-doc', count: 1 },
|
|
939
|
+
{ iconName: 'headline', count: 4 }
|
|
940
|
+
]
|
|
941
|
+
: undefined} defaultUtilitiesExpanded/>}/>);
|
|
942
|
+
};
|
|
943
|
+
EmailCaseViewDemo.args = {
|
|
944
|
+
showBanners: false,
|
|
945
|
+
noUtilityView: false,
|
|
946
|
+
showHeader: true
|
|
947
|
+
};
|
|
948
|
+
EmailCaseViewDemo.argTypes = {
|
|
949
|
+
showBanners: { control: { type: 'boolean' } },
|
|
950
|
+
noUtilityView: { control: { type: 'boolean' } },
|
|
951
|
+
showHeader: { control: { type: 'boolean' } }
|
|
952
|
+
};
|
|
953
|
+
EmailCaseViewDemo.parameters = {
|
|
954
|
+
layout: 'fullscreen'
|
|
955
|
+
};
|
|
794
956
|
export const EmailManagerAppShell = (args) => {
|
|
795
957
|
const INITIAL_CHUNK_SIZE = 9;
|
|
796
958
|
const APPEND_CHUNK_SIZE = 1;
|
|
797
|
-
const [activeItemId, setActiveItemId] = useState();
|
|
798
959
|
const [emailList, setEmailList] = useState(emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
|
|
799
960
|
const [loading, setLoading] = useState(false);
|
|
800
961
|
const [hasMore, setHasMore] = useState(true);
|
|
801
962
|
const handleEmailItemClick = (id) => {
|
|
802
|
-
setActiveItemId(id);
|
|
803
963
|
const index = emailList.findIndex(emailItem => {
|
|
804
964
|
return emailItem.id === id;
|
|
805
965
|
});
|
|
@@ -823,44 +983,55 @@ export const EmailManagerAppShell = (args) => {
|
|
|
823
983
|
}, 1500);
|
|
824
984
|
}
|
|
825
985
|
}, [loading]);
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
<
|
|
830
|
-
|
|
831
|
-
<
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
</Card>
|
|
839
|
-
<SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
|
|
986
|
+
const utilities = (<Grid container={{ rowGap: 2 }}>
|
|
987
|
+
<EntityListDemo />
|
|
988
|
+
<Card>
|
|
989
|
+
<CardHeader container={{ alignItems: 'center', gap: 1 }}>
|
|
990
|
+
<Icon name='document-doc'/>
|
|
991
|
+
<Text variant='h3'>Email header</Text>
|
|
992
|
+
</CardHeader>
|
|
993
|
+
<CardContent>
|
|
994
|
+
<FieldValueList fields={viewAnalysisEmailHeaderMock} variant='stacked'/>
|
|
995
|
+
</CardContent>
|
|
996
|
+
</Card>
|
|
997
|
+
<SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
|
|
840
998
|
...items,
|
|
841
999
|
primary: <StyledLabel>{items.primary}</StyledLabel>,
|
|
842
1000
|
secondary: (<Flex container={{ direction: 'row', justify: 'between' }}>
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1001
|
+
<Text variant='primary'>{items.secondary.indicator}</Text>
|
|
1002
|
+
<StyledLabel>{items.secondary.value}</StyledLabel>
|
|
1003
|
+
</Flex>)
|
|
846
1004
|
}))} noItemsText='No items'/>
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1005
|
+
</Grid>);
|
|
1006
|
+
const content = <EmailShellDemo showHeader={false}/>;
|
|
1007
|
+
return (<AppShellDemo appHeader main={<EmailManager header={args.showHeader
|
|
1008
|
+
? {
|
|
1009
|
+
icon: 'mail',
|
|
1010
|
+
title: 'Inbox'
|
|
1011
|
+
}
|
|
1012
|
+
: undefined} list={<EmailSummaryListDemo onItemClick={handleEmailItemClick} items={emailList} onLoadMore={hasMore ? onLoadMore : undefined} loading={loading}/>} emailCaseDetails={!args.showEmptyView && (<EmailCaseView banners={args.showCaseViewBanners && (<Banner id='error' variant='urgent' heading='Error' messages={[
|
|
1013
|
+
'Your email could not be delivered due to poor network connection.'
|
|
1014
|
+
]}/>)} content={content} utilities={args.showUtilities && utilities} utilitiesSummaryItems={args.showUtilities
|
|
1015
|
+
? [
|
|
1016
|
+
{ iconName: 'list-number', count: 7 },
|
|
1017
|
+
{ iconName: 'document-doc', count: 1 },
|
|
1018
|
+
{ iconName: 'headline', count: 4 }
|
|
1019
|
+
]
|
|
1020
|
+
: undefined} defaultUtilitiesExpanded={false}/>)}/>}/>);
|
|
858
1021
|
};
|
|
859
1022
|
EmailManagerAppShell.args = {
|
|
860
|
-
enableContextMenu: true
|
|
1023
|
+
enableContextMenu: true,
|
|
1024
|
+
showEmptyView: false,
|
|
1025
|
+
showHeader: true,
|
|
1026
|
+
showCaseViewBanners: false,
|
|
1027
|
+
showUtilities: true
|
|
861
1028
|
};
|
|
862
1029
|
EmailManagerAppShell.argTypes = {
|
|
863
|
-
enableContextMenu: { control: { type: 'boolean' } }
|
|
1030
|
+
enableContextMenu: { control: { type: 'boolean' } },
|
|
1031
|
+
showEmptyView: { control: { type: 'boolean' } },
|
|
1032
|
+
showHeader: { control: { type: 'boolean' } },
|
|
1033
|
+
showCaseViewBanners: { control: { type: 'boolean' } },
|
|
1034
|
+
showUtilities: { control: { type: 'boolean' } }
|
|
864
1035
|
};
|
|
865
1036
|
EmailManagerAppShell.parameters = {
|
|
866
1037
|
layout: 'fullscreen'
|