@pega/cosmos-react-demos 3.0.0-dev.26.0 → 3.0.0-dev.27.2

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.
Files changed (83) hide show
  1. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +9 -13
  2. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
  3. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js +46 -13
  4. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
  5. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +1 -0
  6. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
  7. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx +67 -11
  8. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx.map +1 -1
  9. package/jsx/core/FieldGroup/FieldGroup.stories.d.ts +2 -0
  10. package/jsx/core/FieldGroup/FieldGroup.stories.d.ts.map +1 -1
  11. package/jsx/core/FieldGroup/FieldGroup.stories.jsx +12 -4
  12. package/jsx/core/FieldGroup/FieldGroup.stories.jsx.map +1 -1
  13. package/jsx/core/ListToolbar/ListToolbar.stories.d.ts +2 -1
  14. package/jsx/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
  15. package/jsx/core/ListToolbar/ListToolbar.stories.jsx +9 -5
  16. package/jsx/core/ListToolbar/ListToolbar.stories.jsx.map +1 -1
  17. package/jsx/core/Tree/Tree.stories.d.ts.map +1 -1
  18. package/jsx/core/Tree/Tree.stories.jsx +14 -0
  19. package/jsx/core/Tree/Tree.stories.jsx.map +1 -1
  20. package/jsx/cs/CallControlPanel/CallControlPanel.mocks.d.ts +4 -0
  21. package/jsx/cs/CallControlPanel/CallControlPanel.mocks.d.ts.map +1 -1
  22. package/jsx/cs/CallControlPanel/CallControlPanel.mocks.js +14 -0
  23. package/jsx/cs/CallControlPanel/CallControlPanel.mocks.js.map +1 -1
  24. package/jsx/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
  25. package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx +64 -6
  26. package/jsx/cs/CallControlPanel/CallControlPanel.stories.jsx.map +1 -1
  27. package/jsx/social/Email/Email.mocks.d.ts +0 -1
  28. package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
  29. package/jsx/social/Email/Email.mocks.jsx +0 -13
  30. package/jsx/social/Email/Email.mocks.jsx.map +1 -1
  31. package/jsx/social/Email/Email.stories.d.ts +19 -2
  32. package/jsx/social/Email/Email.stories.d.ts.map +1 -1
  33. package/jsx/social/Email/Email.stories.jsx +159 -65
  34. package/jsx/social/Email/Email.stories.jsx.map +1 -1
  35. package/jsx/work/SearchResults/SearchResults.mocks.d.ts +6 -0
  36. package/jsx/work/SearchResults/SearchResults.mocks.d.ts.map +1 -1
  37. package/jsx/work/SearchResults/SearchResults.mocks.jsx +39 -38
  38. package/jsx/work/SearchResults/SearchResults.mocks.jsx.map +1 -1
  39. package/jsx/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
  40. package/jsx/work/SearchResults/SearchResults.stories.jsx +71 -43
  41. package/jsx/work/SearchResults/SearchResults.stories.jsx.map +1 -1
  42. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +9 -13
  43. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -1
  44. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js +46 -13
  45. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -1
  46. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +1 -0
  47. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -1
  48. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js +65 -12
  49. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js.map +1 -1
  50. package/lib/core/FieldGroup/FieldGroup.stories.d.ts +2 -0
  51. package/lib/core/FieldGroup/FieldGroup.stories.d.ts.map +1 -1
  52. package/lib/core/FieldGroup/FieldGroup.stories.js +11 -3
  53. package/lib/core/FieldGroup/FieldGroup.stories.js.map +1 -1
  54. package/lib/core/ListToolbar/ListToolbar.stories.d.ts +2 -1
  55. package/lib/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
  56. package/lib/core/ListToolbar/ListToolbar.stories.js +9 -5
  57. package/lib/core/ListToolbar/ListToolbar.stories.js.map +1 -1
  58. package/lib/core/Tree/Tree.stories.d.ts.map +1 -1
  59. package/lib/core/Tree/Tree.stories.js +16 -0
  60. package/lib/core/Tree/Tree.stories.js.map +1 -1
  61. package/lib/cs/CallControlPanel/CallControlPanel.mocks.d.ts +4 -0
  62. package/lib/cs/CallControlPanel/CallControlPanel.mocks.d.ts.map +1 -1
  63. package/lib/cs/CallControlPanel/CallControlPanel.mocks.js +14 -0
  64. package/lib/cs/CallControlPanel/CallControlPanel.mocks.js.map +1 -1
  65. package/lib/cs/CallControlPanel/CallControlPanel.stories.d.ts.map +1 -1
  66. package/lib/cs/CallControlPanel/CallControlPanel.stories.js +64 -6
  67. package/lib/cs/CallControlPanel/CallControlPanel.stories.js.map +1 -1
  68. package/lib/social/Email/Email.mocks.d.ts +0 -1
  69. package/lib/social/Email/Email.mocks.d.ts.map +1 -1
  70. package/lib/social/Email/Email.mocks.js +0 -13
  71. package/lib/social/Email/Email.mocks.js.map +1 -1
  72. package/lib/social/Email/Email.stories.d.ts +19 -2
  73. package/lib/social/Email/Email.stories.d.ts.map +1 -1
  74. package/lib/social/Email/Email.stories.js +127 -52
  75. package/lib/social/Email/Email.stories.js.map +1 -1
  76. package/lib/work/SearchResults/SearchResults.mocks.d.ts +6 -0
  77. package/lib/work/SearchResults/SearchResults.mocks.d.ts.map +1 -1
  78. package/lib/work/SearchResults/SearchResults.mocks.js +39 -38
  79. package/lib/work/SearchResults/SearchResults.mocks.js.map +1 -1
  80. package/lib/work/SearchResults/SearchResults.stories.d.ts.map +1 -1
  81. package/lib/work/SearchResults/SearchResults.stories.js +71 -43
  82. package/lib/work/SearchResults/SearchResults.stories.js.map +1 -1
  83. 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 { useMemo } from '@storybook/addons';
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, emailActions, generateEmailConversationParticipants, templates, handleExternalEntry, emailDemoActions, LaunchAction, baseComposerProps, sentiment, emailSummaryItems, mockEmails, mockSuggestedReplies, mockEmailBodyTemplates, forwardedContent, getCompositeId, emptyFieldErrorMessage, fieldValidation, emailWorklistItemsMock, contextMenuItemsMock, highlightedEntitiesMock, mockUploadImage, mailDeliverySystemEmail, supportTeamEmail } from './Email.mocks';
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 {
@@ -49,9 +48,9 @@ export const Email = (args) => {
49
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'
50
49
  ]
51
50
  }
52
- : undefined} onReply={action('On reply')} onReplyAll={action('On reply all')} onForward={action('On forward')} onSuggestionClick={action('On Suggested reply clicked')} sentiment={{
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={{
53
52
  variant: 'neutral'
54
- }} actions={emailActions} suggestions={mockSuggestedReplies} contextMenu={{
53
+ }} status={args.showDraft ? 'draft' : undefined} suggestions={mockSuggestedReplies} contextMenu={{
55
54
  onItemClick: (selectedValue) => {
56
55
  action('onItemClick')(selectedValue);
57
56
  contextMenuHandle.current?.setOpen(false);
@@ -83,15 +82,18 @@ Email.args = {
83
82
  enableEntityHighlighting: false,
84
83
  enableContextMenu: false,
85
84
  forwardedContent,
86
- showEmailBanner: false
85
+ showEmailBanner: false,
86
+ showDraft: false
87
87
  };
88
88
  Email.argTypes = {
89
89
  enableEntityHighlighting: { control: { type: 'boolean' } },
90
90
  enableContextMenu: { control: { type: 'boolean' } },
91
91
  forwardedContent: { control: { type: 'text' } },
92
- showEmailBanner: { control: { type: 'boolean' } }
92
+ showEmailBanner: { control: { type: 'boolean' } },
93
+ showDraft: { control: { type: 'boolean' } }
93
94
  };
94
- export const Composer = () => {
95
+ export const Composer = (args) => {
96
+ const { enableResponseTypeToggle = true, enableSaveAsDraft = true } = args;
95
97
  const [composerProgress, setComposerProgress] = useState(false);
96
98
  const composerHandle = useRef(null);
97
99
  const [data, setData] = useState({
@@ -240,7 +242,22 @@ export const Composer = () => {
240
242
  setComposerProgress(false);
241
243
  });
242
244
  };
243
- return (<EmailComposer handle={composerHandle} progress={composerProgress} onSave={action('On save')} onSend={handleOnSend} onCancel={action('On cancel')} externalValidator={handleExternalEntry} participants={participants} onChange={handleOnChange} data={data} templates={templates} onImageAdded={onImageAdded}/>);
245
+ return (<EmailComposer handle={composerHandle} progress={composerProgress} onSave={enableSaveAsDraft ? action('On save') : undefined} onSend={handleOnSend} onCancel={action('On cancel')} externalValidator={handleExternalEntry} participants={participants} onChange={handleOnChange} data={{
246
+ ...data,
247
+ responseType: enableResponseTypeToggle ? data.responseType : undefined
248
+ }} templates={templates} onImageAdded={onImageAdded}/>);
249
+ };
250
+ Composer.args = {
251
+ enableResponseTypeToggle: true,
252
+ enableSaveAsDraft: true
253
+ };
254
+ Composer.argTypes = {
255
+ enableResponseTypeToggle: {
256
+ control: 'boolean'
257
+ },
258
+ enableSaveAsDraft: {
259
+ control: { type: 'boolean' }
260
+ }
244
261
  };
245
262
  export const Conversation = () => {
246
263
  const emailArr = [
@@ -256,7 +273,6 @@ export const Conversation = () => {
256
273
  onReply: action('On reply'),
257
274
  onForward: action('On forward'),
258
275
  onSuggestionClick: action('On Suggested reply clicked'),
259
- actions: emailActions,
260
276
  suggestions: mockSuggestedReplies
261
277
  },
262
278
  {
@@ -269,8 +285,7 @@ export const Conversation = () => {
269
285
  body: '<div> Hi, <br /> <br /> <div>I’m still at the airport, I need help now!! </div> <br /><br /> Regards, <br /> Sara Davis </div>',
270
286
  onReply: action('On reply'),
271
287
  onForward: action('On forward'),
272
- onSuggestionClick: action('On Suggested reply clicked'),
273
- actions: emailActions
288
+ onSuggestionClick: action('On Suggested reply clicked')
274
289
  }
275
290
  ];
276
291
  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}/>);
@@ -632,6 +647,7 @@ export const EmailShellDemo = (args) => {
632
647
  [
633
648
  {
634
649
  ...emailsData[1],
650
+ id: 'item0',
635
651
  from: mailDeliverySystemEmail,
636
652
  to: [supportTeamEmail],
637
653
  body: '<div>Hi, <br /> <br /><div>Your address change request is approved.</div> <br /> <br />Regards, <br />Support team </div>',
@@ -643,8 +659,7 @@ export const EmailShellDemo = (args) => {
643
659
  ]
644
660
  },
645
661
  onReply: undefined,
646
- onForward: undefined,
647
- actions: undefined
662
+ onForward: undefined
648
663
  },
649
664
  { ...emailsData[1], unRead: false }
650
665
  ],
@@ -653,11 +668,20 @@ export const EmailShellDemo = (args) => {
653
668
  ...emailsData[0],
654
669
  id: 'item2',
655
670
  status: 'draft',
671
+ onEditDraft: (id) => createOrActivateComposer(id, LaunchAction.REPLY, {
672
+ ...baseComposerProps,
673
+ data: {
674
+ ...baseComposerProps.data,
675
+ responseType: 'reply',
676
+ subject: { value: `Re-${emailsData[0].subject}` || '' },
677
+ bodyContent: { defaultValue: emailsData[0].body || '' }
678
+ }
679
+ }),
680
+ onDeleteDraft: (id) => deleteEmail(id),
656
681
  onReply: undefined,
657
682
  onForward: undefined,
658
683
  suggestions: undefined,
659
684
  unRead: false,
660
- 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),
661
685
  timeStamp: '2021-01-03T17:15',
662
686
  from: mockEmails['Hugh Phillips'],
663
687
  to: [mockEmails['Mystery Rey'], ...emailsData[0].to],
@@ -669,10 +693,19 @@ export const EmailShellDemo = (args) => {
669
693
  ...emailsData[1],
670
694
  id: 'item3',
671
695
  status: 'draft',
696
+ onEditDraft: (id) => createOrActivateComposer(id, LaunchAction.REPLY, {
697
+ ...baseComposerProps,
698
+ data: {
699
+ ...baseComposerProps.data,
700
+ responseType: 'reply',
701
+ subject: { value: `Re-${emailsData[0].subject}` || '' },
702
+ bodyContent: { defaultValue: emailsData[0].body || '' }
703
+ }
704
+ }),
705
+ onDeleteDraft: (id) => deleteEmail(id),
672
706
  onReply: undefined,
673
707
  onForward: undefined,
674
708
  suggestions: undefined,
675
- actions: emailDemoActions('item3', emailsData[0].subject, createOrActivateComposer, true, '<div>Hi, <br /> <br /><div>Can you fix my internet connection. </div> <br /> <br />Regards, <br />Rey Mystery </div>', deleteEmail),
676
709
  unRead: false,
677
710
  timeStamp: '2021-01-02T14:16',
678
711
  from: mockEmails['Mystery Rey'],
@@ -730,6 +763,7 @@ export const EmailShellDemo = (args) => {
730
763
  emails: [
731
764
  {
732
765
  ...emailsData[1],
766
+ id: 'item0',
733
767
  from: mailDeliverySystemEmail,
734
768
  to: [supportTeamEmail],
735
769
  body: '<div>Hi, <br /> <br /><div>Your address change request is approved.</div> <br /> <br />Regards, <br />Support team </div>',
@@ -741,26 +775,27 @@ export const EmailShellDemo = (args) => {
741
775
  ]
742
776
  },
743
777
  onReply: undefined,
744
- onForward: undefined,
745
- actions: undefined
778
+ onForward: undefined
746
779
  },
747
780
  { ...emailsData[1], unRead: false }
748
781
  ]
749
782
  }
750
783
  ];
751
784
  return (<>
752
- <EmailShell headerProps={{
753
- actions: (<Flex container={{
754
- alignItems: 'center',
755
- gap: 0
756
- }}>
757
- <Button variant='simple' icon>
758
- <Icon name='filter'/>
759
- </Button>
760
- <MenuButton variant='simple' text='More actions' icon='more' iconOnly portal menu={{ items: actions }}/>
761
- </Flex>),
762
- subject: 'Pause service'
763
- }} autoCollapse={args.autoCollapse} conversations={args.singleConversation ? singleEmailConversation : emailConversations}/>
785
+ <EmailShell headerProps={args.showHeader
786
+ ? {
787
+ actions: (<Flex container={{
788
+ alignItems: 'center',
789
+ gap: 0
790
+ }}>
791
+ <Button variant='simple' icon>
792
+ <Icon name='filter'/>
793
+ </Button>
794
+ <MenuButton variant='simple' text='More actions' icon='more' iconOnly portal menu={{ items: actions }}/>
795
+ </Flex>),
796
+ subject: 'Pause service'
797
+ }
798
+ : undefined} autoCollapse={args.autoCollapse} conversations={args.singleConversation ? singleEmailConversation : emailConversations}/>
764
799
  <>
765
800
  {Object.keys(composersData).map(guid => {
766
801
  return <EmailComposer key={guid} {...composersData[guid]}/>;
@@ -771,12 +806,14 @@ export const EmailShellDemo = (args) => {
771
806
  EmailShellDemo.args = {
772
807
  autoCollapse: true,
773
808
  hideSuggestions: false,
774
- singleConversation: true
809
+ singleConversation: false,
810
+ showHeader: true
775
811
  };
776
812
  EmailShellDemo.argTypes = {
777
813
  autoCollapse: { control: { type: 'boolean' } },
778
814
  hideSuggestions: { control: { type: 'boolean' } },
779
- singleConversation: { control: { type: 'boolean' } }
815
+ singleConversation: { control: { type: 'boolean' } },
816
+ showHeader: { control: { type: 'boolean' } }
780
817
  };
781
818
  export const EntityListDemo = (args) => {
782
819
  const itemCounter = useRef(3);
@@ -884,15 +921,61 @@ export const EmailSummaryListDemo = (args) => {
884
921
  }, [loading]);
885
922
  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.'/>);
886
923
  };
924
+ export const EmailCaseViewDemo = (args) => {
925
+ const content = <EmailShellDemo />;
926
+ const utilities = (<Grid container={{ rowGap: 2 }}>
927
+ <EntityListDemo />
928
+ <Card>
929
+ <CardHeader container={{ alignItems: 'center', gap: 1 }}>
930
+ <Icon name='document-doc'/>
931
+ <Text variant='h3'>Email header</Text>
932
+ </CardHeader>
933
+ <CardContent>
934
+ <FieldValueList fields={viewAnalysisEmailHeaderMock} variant='stacked'/>
935
+ </CardContent>
936
+ </Card>
937
+ <SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
938
+ ...items,
939
+ primary: <StyledLabel>{items.primary}</StyledLabel>,
940
+ secondary: (<Flex container={{ direction: 'row', justify: 'between' }}>
941
+ <Text variant='primary'>{items.secondary.indicator}</Text>
942
+ <StyledLabel>{items.secondary.value}</StyledLabel>
943
+ </Flex>)
944
+ }))} noItemsText='No items'/>
945
+ </Grid>);
946
+ return (<AppShellDemo appHeader main={<EmailCaseView header={args.showHeader
947
+ ? {
948
+ icon: 'mail',
949
+ title: 'ET-5432'
950
+ }
951
+ : 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
952
+ ? [
953
+ { iconName: 'list-number', count: 7 },
954
+ { iconName: 'document-doc', count: 1 },
955
+ { iconName: 'headline', count: 4 }
956
+ ]
957
+ : undefined} defaultUtilitiesExpanded/>}/>);
958
+ };
959
+ EmailCaseViewDemo.args = {
960
+ showBanners: false,
961
+ noUtilityView: false,
962
+ showHeader: true
963
+ };
964
+ EmailCaseViewDemo.argTypes = {
965
+ showBanners: { control: { type: 'boolean' } },
966
+ noUtilityView: { control: { type: 'boolean' } },
967
+ showHeader: { control: { type: 'boolean' } }
968
+ };
969
+ EmailCaseViewDemo.parameters = {
970
+ layout: 'fullscreen'
971
+ };
887
972
  export const EmailManagerAppShell = (args) => {
888
973
  const INITIAL_CHUNK_SIZE = 9;
889
974
  const APPEND_CHUNK_SIZE = 1;
890
- const [activeItemId, setActiveItemId] = useState();
891
975
  const [emailList, setEmailList] = useState(emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
892
976
  const [loading, setLoading] = useState(false);
893
977
  const [hasMore, setHasMore] = useState(true);
894
978
  const handleEmailItemClick = (id) => {
895
- setActiveItemId(id);
896
979
  const index = emailList.findIndex(emailItem => {
897
980
  return emailItem.id === id;
898
981
  });
@@ -916,44 +999,55 @@ export const EmailManagerAppShell = (args) => {
916
999
  }, 1500);
917
1000
  }
918
1001
  }, [loading]);
919
- const activeItemIndex = useMemo(() => emailList.findIndex(emailItem => emailItem.id === activeItemId), [activeItemId, emailList]);
920
- const content = activeItemId === undefined ? (<EmptyState message='No item selected!'/>) : (<EmailShellDemo singleConversation={activeItemIndex % 2 !== 0}/>);
921
- const utilities = activeItemId === undefined ? null : (<Grid container={{ rowGap: 2 }}>
922
- <EntityListDemo onContextMenu={args.onContextMenu} enableContextMenu={args.enableContextMenu}/>
923
- <Card>
924
- <CardHeader container={{ alignItems: 'center', gap: 1 }}>
925
- <Icon name='document-doc'/>
926
- <Text variant='h3'>Email header</Text>
927
- </CardHeader>
928
- <CardContent>
929
- <FieldValueList fields={viewAnalysisEmailHeaderMock} variant='stacked'/>
930
- </CardContent>
931
- </Card>
932
- <SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
1002
+ const utilities = (<Grid container={{ rowGap: 2 }}>
1003
+ <EntityListDemo />
1004
+ <Card>
1005
+ <CardHeader container={{ alignItems: 'center', gap: 1 }}>
1006
+ <Icon name='document-doc'/>
1007
+ <Text variant='h3'>Email header</Text>
1008
+ </CardHeader>
1009
+ <CardContent>
1010
+ <FieldValueList fields={viewAnalysisEmailHeaderMock} variant='stacked'/>
1011
+ </CardContent>
1012
+ </Card>
1013
+ <SummaryList name='Topics' icon='headline' items={topicListMock.map(items => ({
933
1014
  ...items,
934
1015
  primary: <StyledLabel>{items.primary}</StyledLabel>,
935
1016
  secondary: (<Flex container={{ direction: 'row', justify: 'between' }}>
936
- <Text variant='primary'>{items.secondary.indicator}</Text>
937
- <StyledLabel>{items.secondary.value}</StyledLabel>
938
- </Flex>)
1017
+ <Text variant='primary'>{items.secondary.indicator}</Text>
1018
+ <StyledLabel>{items.secondary.value}</StyledLabel>
1019
+ </Flex>)
939
1020
  }))} noItemsText='No items'/>
940
- </Grid>);
941
- return (<AppShellDemo appHeader main={<EmailManager header={{
942
- icon: 'mail',
943
- title: 'Inbox'
944
- }} list={<EmailSummaryListDemo onItemClick={handleEmailItemClick} items={emailList} onLoadMore={hasMore ? onLoadMore : undefined} loading={loading}/>} content={content} utilities={utilities} utilitiesSummaryItems={utilities
945
- ? [
946
- { iconName: 'list-number', count: 7 },
947
- { iconName: 'document-doc', count: 1 },
948
- { iconName: 'headline', count: 4 }
949
- ]
950
- : undefined} defaultCollapsedUtilities={!!utilities}/>}/>);
1021
+ </Grid>);
1022
+ const content = <EmailShellDemo showHeader={false}/>;
1023
+ return (<AppShellDemo appHeader main={<EmailManager header={args.showHeader
1024
+ ? {
1025
+ icon: 'mail',
1026
+ title: 'Inbox'
1027
+ }
1028
+ : 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={[
1029
+ 'Your email could not be delivered due to poor network connection.'
1030
+ ]}/>)} content={content} utilities={args.showUtilities && utilities} utilitiesSummaryItems={args.showUtilities
1031
+ ? [
1032
+ { iconName: 'list-number', count: 7 },
1033
+ { iconName: 'document-doc', count: 1 },
1034
+ { iconName: 'headline', count: 4 }
1035
+ ]
1036
+ : undefined} defaultUtilitiesExpanded={false}/>)}/>}/>);
951
1037
  };
952
1038
  EmailManagerAppShell.args = {
953
- enableContextMenu: true
1039
+ enableContextMenu: true,
1040
+ showEmptyView: false,
1041
+ showHeader: true,
1042
+ showCaseViewBanners: false,
1043
+ showUtilities: true
954
1044
  };
955
1045
  EmailManagerAppShell.argTypes = {
956
- enableContextMenu: { control: { type: 'boolean' } }
1046
+ enableContextMenu: { control: { type: 'boolean' } },
1047
+ showEmptyView: { control: { type: 'boolean' } },
1048
+ showHeader: { control: { type: 'boolean' } },
1049
+ showCaseViewBanners: { control: { type: 'boolean' } },
1050
+ showUtilities: { control: { type: 'boolean' } }
957
1051
  };
958
1052
  EmailManagerAppShell.parameters = {
959
1053
  layout: 'fullscreen'