@pega/cosmos-react-demos 3.0.0-dev.20.0 → 3.0.0-dev.21.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 (265) hide show
  1. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +11 -0
  2. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -0
  3. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js +135 -0
  4. package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -0
  5. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +18 -0
  6. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -0
  7. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx +72 -0
  8. package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx.map +1 -0
  9. package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
  10. package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx +3 -2
  11. package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx.map +1 -1
  12. package/jsx/core/AdditionalInfo/AdditionalInfo.stories.d.ts +9 -0
  13. package/jsx/core/AdditionalInfo/AdditionalInfo.stories.d.ts.map +1 -0
  14. package/jsx/core/AdditionalInfo/AdditionalInfo.stories.jsx +25 -0
  15. package/jsx/core/AdditionalInfo/AdditionalInfo.stories.jsx.map +1 -0
  16. package/jsx/core/AppShell/AppShell.stories.d.ts.map +1 -1
  17. package/jsx/core/AppShell/AppShell.stories.jsx +11 -1
  18. package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
  19. package/jsx/core/Checkbox/Checkbox.stories.d.ts +6 -2
  20. package/jsx/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
  21. package/jsx/core/Checkbox/Checkbox.stories.jsx +26 -7
  22. package/jsx/core/Checkbox/Checkbox.stories.jsx.map +1 -1
  23. package/jsx/core/CheckboxGroup/CheckboxGroup.stories.d.ts +6 -2
  24. package/jsx/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
  25. package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx +46 -5
  26. package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx.map +1 -1
  27. package/jsx/core/ColorPicker/ColorPicker.stories.d.ts +4 -1
  28. package/jsx/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
  29. package/jsx/core/ColorPicker/ColorPicker.stories.jsx +10 -3
  30. package/jsx/core/ColorPicker/ColorPicker.stories.jsx.map +1 -1
  31. package/jsx/core/ComboBox/ComboBox.stories.d.ts +1 -0
  32. package/jsx/core/ComboBox/ComboBox.stories.d.ts.map +1 -1
  33. package/jsx/core/ComboBox/ComboBox.stories.jsx +40 -8
  34. package/jsx/core/ComboBox/ComboBox.stories.jsx.map +1 -1
  35. package/jsx/core/CompositeInput/CompositeInput.stories.d.ts +4 -1
  36. package/jsx/core/CompositeInput/CompositeInput.stories.d.ts.map +1 -1
  37. package/jsx/core/CompositeInput/CompositeInput.stories.jsx +7 -3
  38. package/jsx/core/CompositeInput/CompositeInput.stories.jsx.map +1 -1
  39. package/jsx/core/CreditCard/CreditCard.stories.d.ts +4 -1
  40. package/jsx/core/CreditCard/CreditCard.stories.d.ts.map +1 -1
  41. package/jsx/core/CreditCard/CreditCard.stories.jsx +10 -3
  42. package/jsx/core/CreditCard/CreditCard.stories.jsx.map +1 -1
  43. package/jsx/core/Currency/Currency.stories.d.ts +4 -1
  44. package/jsx/core/Currency/Currency.stories.d.ts.map +1 -1
  45. package/jsx/core/Currency/Currency.stories.jsx +10 -3
  46. package/jsx/core/Currency/Currency.stories.jsx.map +1 -1
  47. package/jsx/core/DateTime/DateTime.stories.d.ts +39 -9
  48. package/jsx/core/DateTime/DateTime.stories.d.ts.map +1 -1
  49. package/jsx/core/DateTime/DateTime.stories.jsx +83 -14
  50. package/jsx/core/DateTime/DateTime.stories.jsx.map +1 -1
  51. package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts +3 -0
  52. package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts.map +1 -0
  53. package/jsx/core/FieldValueList/FieldValueList.mocks.js +9 -0
  54. package/jsx/core/FieldValueList/FieldValueList.mocks.js.map +1 -0
  55. package/jsx/core/FieldValueList/FieldValueList.stories.d.ts +1 -0
  56. package/jsx/core/FieldValueList/FieldValueList.stories.d.ts.map +1 -1
  57. package/jsx/core/FieldValueList/FieldValueList.stories.jsx +34 -2
  58. package/jsx/core/FieldValueList/FieldValueList.stories.jsx.map +1 -1
  59. package/jsx/core/Form/Form.mocks.jsx +2 -2
  60. package/jsx/core/Form/Form.mocks.jsx.map +1 -1
  61. package/jsx/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
  62. package/jsx/core/IconPicker/IconPicker.stories.jsx +6 -9
  63. package/jsx/core/IconPicker/IconPicker.stories.jsx.map +1 -1
  64. package/jsx/core/Input/Input.stories.d.ts +1 -0
  65. package/jsx/core/Input/Input.stories.d.ts.map +1 -1
  66. package/jsx/core/Input/Input.stories.jsx +8 -1
  67. package/jsx/core/Input/Input.stories.jsx.map +1 -1
  68. package/jsx/core/Location/Location.stories.d.ts +4 -1
  69. package/jsx/core/Location/Location.stories.d.ts.map +1 -1
  70. package/jsx/core/Location/Location.stories.jsx +10 -3
  71. package/jsx/core/Location/Location.stories.jsx.map +1 -1
  72. package/jsx/core/Number/Number.stories.d.ts +1 -0
  73. package/jsx/core/Number/Number.stories.d.ts.map +1 -1
  74. package/jsx/core/Number/Number.stories.jsx +15 -7
  75. package/jsx/core/Number/Number.stories.jsx.map +1 -1
  76. package/jsx/core/Phone/Phone.stories.d.ts +4 -1
  77. package/jsx/core/Phone/Phone.stories.d.ts.map +1 -1
  78. package/jsx/core/Phone/Phone.stories.jsx +10 -3
  79. package/jsx/core/Phone/Phone.stories.jsx.map +1 -1
  80. package/jsx/core/RadioButton/RadioButton.stories.d.ts +6 -2
  81. package/jsx/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
  82. package/jsx/core/RadioButton/RadioButton.stories.jsx +22 -5
  83. package/jsx/core/RadioButton/RadioButton.stories.jsx.map +1 -1
  84. package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts +6 -2
  85. package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
  86. package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx +46 -5
  87. package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx.map +1 -1
  88. package/jsx/core/Select/Select.stories.d.ts +1 -0
  89. package/jsx/core/Select/Select.stories.d.ts.map +1 -1
  90. package/jsx/core/Select/Select.stories.jsx +10 -3
  91. package/jsx/core/Select/Select.stories.jsx.map +1 -1
  92. package/jsx/core/TextArea/TextArea.stories.d.ts +4 -1
  93. package/jsx/core/TextArea/TextArea.stories.d.ts.map +1 -1
  94. package/jsx/core/TextArea/TextArea.stories.jsx +10 -3
  95. package/jsx/core/TextArea/TextArea.stories.jsx.map +1 -1
  96. package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts +4 -1
  97. package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
  98. package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx +10 -3
  99. package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx.map +1 -1
  100. package/jsx/social/Chat/Chat.mocks.d.ts +1 -1
  101. package/jsx/social/Chat/Chat.mocks.js +0 -1
  102. package/jsx/social/Chat/Chat.mocks.js.map +1 -1
  103. package/jsx/social/Email/Email.mocks.d.ts +39 -1
  104. package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
  105. package/jsx/social/Email/Email.mocks.jsx +78 -39
  106. package/jsx/social/Email/Email.mocks.jsx.map +1 -1
  107. package/jsx/social/Email/Email.stories.d.ts.map +1 -1
  108. package/jsx/social/Email/Email.stories.jsx +174 -87
  109. package/jsx/social/Email/Email.stories.jsx.map +1 -1
  110. package/jsx/tools/Clipboard/Clipboard.mocks.d.ts +6 -0
  111. package/jsx/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -0
  112. package/jsx/tools/Clipboard/Clipboard.mocks.jsx +82 -0
  113. package/jsx/tools/Clipboard/Clipboard.mocks.jsx.map +1 -0
  114. package/jsx/tools/Clipboard/Clipboard.stories.d.ts +6 -0
  115. package/jsx/tools/Clipboard/Clipboard.stories.d.ts.map +1 -0
  116. package/jsx/tools/Clipboard/Clipboard.stories.jsx +68 -0
  117. package/jsx/tools/Clipboard/Clipboard.stories.jsx.map +1 -0
  118. package/jsx/tools/PreviewShell/PreviewShell.mocks.d.ts +9 -0
  119. package/jsx/tools/PreviewShell/PreviewShell.mocks.d.ts.map +1 -0
  120. package/jsx/tools/PreviewShell/PreviewShell.mocks.jsx +58 -0
  121. package/jsx/tools/PreviewShell/PreviewShell.mocks.jsx.map +1 -0
  122. package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts +15 -0
  123. package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -0
  124. package/jsx/tools/PreviewShell/PreviewShell.stories.jsx +107 -0
  125. package/jsx/tools/PreviewShell/PreviewShell.stories.jsx.map +1 -0
  126. package/jsx/tools/PreviewShell/PreviewShell.styles.d.ts +3 -0
  127. package/jsx/tools/PreviewShell/PreviewShell.styles.d.ts.map +1 -0
  128. package/jsx/tools/PreviewShell/PreviewShell.styles.js +7 -0
  129. package/jsx/tools/PreviewShell/PreviewShell.styles.js.map +1 -0
  130. package/jsx/work/Details/Details.stories.d.ts.map +1 -1
  131. package/jsx/work/Details/Details.stories.jsx +9 -2
  132. package/jsx/work/Details/Details.stories.jsx.map +1 -1
  133. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +11 -0
  134. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -0
  135. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js +136 -0
  136. package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -0
  137. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +18 -0
  138. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -0
  139. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js +66 -0
  140. package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js.map +1 -0
  141. package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
  142. package/lib/build/ObjectSelect/ObjectSelect.stories.js +3 -2
  143. package/lib/build/ObjectSelect/ObjectSelect.stories.js.map +1 -1
  144. package/lib/core/AdditionalInfo/AdditionalInfo.stories.d.ts +9 -0
  145. package/lib/core/AdditionalInfo/AdditionalInfo.stories.d.ts.map +1 -0
  146. package/lib/core/AdditionalInfo/AdditionalInfo.stories.js +16 -0
  147. package/lib/core/AdditionalInfo/AdditionalInfo.stories.js.map +1 -0
  148. package/lib/core/AppShell/AppShell.stories.d.ts.map +1 -1
  149. package/lib/core/AppShell/AppShell.stories.js +11 -1
  150. package/lib/core/AppShell/AppShell.stories.js.map +1 -1
  151. package/lib/core/Checkbox/Checkbox.stories.d.ts +6 -2
  152. package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
  153. package/lib/core/Checkbox/Checkbox.stories.js +26 -7
  154. package/lib/core/Checkbox/Checkbox.stories.js.map +1 -1
  155. package/lib/core/CheckboxGroup/CheckboxGroup.stories.d.ts +6 -2
  156. package/lib/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
  157. package/lib/core/CheckboxGroup/CheckboxGroup.stories.js +40 -4
  158. package/lib/core/CheckboxGroup/CheckboxGroup.stories.js.map +1 -1
  159. package/lib/core/ColorPicker/ColorPicker.stories.d.ts +4 -1
  160. package/lib/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
  161. package/lib/core/ColorPicker/ColorPicker.stories.js +10 -3
  162. package/lib/core/ColorPicker/ColorPicker.stories.js.map +1 -1
  163. package/lib/core/ComboBox/ComboBox.stories.d.ts +1 -0
  164. package/lib/core/ComboBox/ComboBox.stories.d.ts.map +1 -1
  165. package/lib/core/ComboBox/ComboBox.stories.js +40 -8
  166. package/lib/core/ComboBox/ComboBox.stories.js.map +1 -1
  167. package/lib/core/CompositeInput/CompositeInput.stories.d.ts +4 -1
  168. package/lib/core/CompositeInput/CompositeInput.stories.d.ts.map +1 -1
  169. package/lib/core/CompositeInput/CompositeInput.stories.js +7 -3
  170. package/lib/core/CompositeInput/CompositeInput.stories.js.map +1 -1
  171. package/lib/core/CreditCard/CreditCard.stories.d.ts +4 -1
  172. package/lib/core/CreditCard/CreditCard.stories.d.ts.map +1 -1
  173. package/lib/core/CreditCard/CreditCard.stories.js +10 -3
  174. package/lib/core/CreditCard/CreditCard.stories.js.map +1 -1
  175. package/lib/core/Currency/Currency.stories.d.ts +4 -1
  176. package/lib/core/Currency/Currency.stories.d.ts.map +1 -1
  177. package/lib/core/Currency/Currency.stories.js +10 -3
  178. package/lib/core/Currency/Currency.stories.js.map +1 -1
  179. package/lib/core/DateTime/DateTime.stories.d.ts +39 -9
  180. package/lib/core/DateTime/DateTime.stories.d.ts.map +1 -1
  181. package/lib/core/DateTime/DateTime.stories.js +83 -14
  182. package/lib/core/DateTime/DateTime.stories.js.map +1 -1
  183. package/lib/core/FieldValueList/FieldValueList.mocks.d.ts +3 -0
  184. package/lib/core/FieldValueList/FieldValueList.mocks.d.ts.map +1 -0
  185. package/lib/core/FieldValueList/FieldValueList.mocks.js +9 -0
  186. package/lib/core/FieldValueList/FieldValueList.mocks.js.map +1 -0
  187. package/lib/core/FieldValueList/FieldValueList.stories.d.ts +1 -0
  188. package/lib/core/FieldValueList/FieldValueList.stories.d.ts.map +1 -1
  189. package/lib/core/FieldValueList/FieldValueList.stories.js +32 -2
  190. package/lib/core/FieldValueList/FieldValueList.stories.js.map +1 -1
  191. package/lib/core/Form/Form.mocks.js +2 -2
  192. package/lib/core/Form/Form.mocks.js.map +1 -1
  193. package/lib/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
  194. package/lib/core/IconPicker/IconPicker.stories.js +6 -9
  195. package/lib/core/IconPicker/IconPicker.stories.js.map +1 -1
  196. package/lib/core/Input/Input.stories.d.ts +1 -0
  197. package/lib/core/Input/Input.stories.d.ts.map +1 -1
  198. package/lib/core/Input/Input.stories.js +8 -1
  199. package/lib/core/Input/Input.stories.js.map +1 -1
  200. package/lib/core/Location/Location.stories.d.ts +4 -1
  201. package/lib/core/Location/Location.stories.d.ts.map +1 -1
  202. package/lib/core/Location/Location.stories.js +10 -3
  203. package/lib/core/Location/Location.stories.js.map +1 -1
  204. package/lib/core/Number/Number.stories.d.ts +1 -0
  205. package/lib/core/Number/Number.stories.d.ts.map +1 -1
  206. package/lib/core/Number/Number.stories.js +15 -7
  207. package/lib/core/Number/Number.stories.js.map +1 -1
  208. package/lib/core/Phone/Phone.stories.d.ts +4 -1
  209. package/lib/core/Phone/Phone.stories.d.ts.map +1 -1
  210. package/lib/core/Phone/Phone.stories.js +10 -3
  211. package/lib/core/Phone/Phone.stories.js.map +1 -1
  212. package/lib/core/RadioButton/RadioButton.stories.d.ts +6 -2
  213. package/lib/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
  214. package/lib/core/RadioButton/RadioButton.stories.js +22 -5
  215. package/lib/core/RadioButton/RadioButton.stories.js.map +1 -1
  216. package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts +6 -2
  217. package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
  218. package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js +40 -4
  219. package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js.map +1 -1
  220. package/lib/core/Select/Select.stories.d.ts +1 -0
  221. package/lib/core/Select/Select.stories.d.ts.map +1 -1
  222. package/lib/core/Select/Select.stories.js +10 -3
  223. package/lib/core/Select/Select.stories.js.map +1 -1
  224. package/lib/core/TextArea/TextArea.stories.d.ts +4 -1
  225. package/lib/core/TextArea/TextArea.stories.d.ts.map +1 -1
  226. package/lib/core/TextArea/TextArea.stories.js +10 -3
  227. package/lib/core/TextArea/TextArea.stories.js.map +1 -1
  228. package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts +4 -1
  229. package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
  230. package/lib/rte/RichTextEditor/RichTextEditor.stories.js +10 -3
  231. package/lib/rte/RichTextEditor/RichTextEditor.stories.js.map +1 -1
  232. package/lib/social/Chat/Chat.mocks.d.ts +1 -1
  233. package/lib/social/Chat/Chat.mocks.js +0 -1
  234. package/lib/social/Chat/Chat.mocks.js.map +1 -1
  235. package/lib/social/Email/Email.mocks.d.ts +39 -1
  236. package/lib/social/Email/Email.mocks.d.ts.map +1 -1
  237. package/lib/social/Email/Email.mocks.js +78 -39
  238. package/lib/social/Email/Email.mocks.js.map +1 -1
  239. package/lib/social/Email/Email.stories.d.ts.map +1 -1
  240. package/lib/social/Email/Email.stories.js +158 -87
  241. package/lib/social/Email/Email.stories.js.map +1 -1
  242. package/lib/tools/Clipboard/Clipboard.mocks.d.ts +6 -0
  243. package/lib/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -0
  244. package/lib/tools/Clipboard/Clipboard.mocks.js +80 -0
  245. package/lib/tools/Clipboard/Clipboard.mocks.js.map +1 -0
  246. package/lib/tools/Clipboard/Clipboard.stories.d.ts +6 -0
  247. package/lib/tools/Clipboard/Clipboard.stories.d.ts.map +1 -0
  248. package/lib/tools/Clipboard/Clipboard.stories.js +69 -0
  249. package/lib/tools/Clipboard/Clipboard.stories.js.map +1 -0
  250. package/lib/tools/PreviewShell/PreviewShell.mocks.d.ts +9 -0
  251. package/lib/tools/PreviewShell/PreviewShell.mocks.d.ts.map +1 -0
  252. package/lib/tools/PreviewShell/PreviewShell.mocks.js +57 -0
  253. package/lib/tools/PreviewShell/PreviewShell.mocks.js.map +1 -0
  254. package/lib/tools/PreviewShell/PreviewShell.stories.d.ts +15 -0
  255. package/lib/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -0
  256. package/lib/tools/PreviewShell/PreviewShell.stories.js +108 -0
  257. package/lib/tools/PreviewShell/PreviewShell.stories.js.map +1 -0
  258. package/lib/tools/PreviewShell/PreviewShell.styles.d.ts +3 -0
  259. package/lib/tools/PreviewShell/PreviewShell.styles.d.ts.map +1 -0
  260. package/lib/tools/PreviewShell/PreviewShell.styles.js +7 -0
  261. package/lib/tools/PreviewShell/PreviewShell.styles.js.map +1 -0
  262. package/lib/work/Details/Details.stories.d.ts.map +1 -1
  263. package/lib/work/Details/Details.stories.js +2 -2
  264. package/lib/work/Details/Details.stories.js.map +1 -1
  265. package/package.json +9 -9
@@ -1,11 +1,11 @@
1
- import { useState, useRef, useCallback, useEffect, createRef } from 'react';
1
+ import { useState, useRef, useCallback, useEffect, createRef, useContext } from 'react';
2
2
  import { action } from '@storybook/addon-actions';
3
3
  import { useMemo } from '@storybook/addons';
4
- import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel, EmptyState } from '@pega/cosmos-react-core';
4
+ import { Card, CardContent, createUID, MenuButton, Icon, registerIcon, Flex, Button, menuHelpers, CardHeader, Text, SummaryList, Grid, FieldValueList, StyledLabel, EmptyState, Modal, ModalManagerContext, ToasterContext } from '@pega/cosmos-react-core';
5
5
  import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
6
6
  import { Email as EmailComponent, EmailConversation, EmailComposer, EmailShell, EmailSummaryItem, EmailSummaryList, EntityList, EmailManager } from '@pega/cosmos-react-social';
7
7
  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 } from './Email.mocks';
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 } from './Email.mocks';
9
9
  import { StyledEmailCardContent } from './Email.styles';
10
10
  registerIcon(filterIcon);
11
11
  export default {
@@ -182,7 +182,19 @@ export const Composer = () => {
182
182
  };
183
183
  });
184
184
  };
185
- return (<EmailComposer handle={composerHandle} progress={composerProgress} onSend={handleOnSend} onCancel={action('On cancel')} externalValidator={handleExternalEntry} participants={participants} onChange={handleOnChange} data={data} templates={templates} onImageAdded={action('On Image added')}/>);
185
+ const onImageAdded = (image, id) => {
186
+ action('On Image added');
187
+ setComposerProgress({ message: 'Uploading image' });
188
+ mockUploadImage(image)
189
+ .then(({ src, alt }) => {
190
+ composerHandle.current?.updateImage({ src, alt }, id);
191
+ setComposerProgress(false);
192
+ })
193
+ .catch(() => {
194
+ setComposerProgress(false);
195
+ });
196
+ };
197
+ 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}/>);
186
198
  };
187
199
  export const Conversation = () => {
188
200
  const emailArr = [
@@ -218,12 +230,15 @@ export const Conversation = () => {
218
230
  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}/>);
219
231
  };
220
232
  export const EmailShellDemo = (args) => {
233
+ const { create } = useContext(ModalManagerContext);
234
+ const { push } = useContext(ToasterContext);
221
235
  const actions = ['Transfer', 'End conversation'].map(name => ({
222
236
  primary: name,
223
237
  id: name,
224
238
  onClick: action(`Clicked ${name}`)
225
239
  }));
226
240
  const [composersData, setComposersData] = useState({});
241
+ const [conversationEmails, setConversationEmails] = useState([]);
227
242
  const handleResponseTypeChange = (uid, responseType) => {
228
243
  if (responseType === 'reply') {
229
244
  setComposersData(prev => {
@@ -341,12 +356,58 @@ export const EmailShellDemo = (args) => {
341
356
  handleTemplateIdChange(uid, value);
342
357
  }
343
358
  };
359
+ const MyModal = ({ currentID }) => {
360
+ const { ModalContext } = useContext(ModalManagerContext);
361
+ const { dismiss } = useContext(ModalContext);
362
+ return (<Modal heading='Discard unsaved changes?' actions={<>
363
+ <Flex>
364
+ <Button onClick={() => {
365
+ dismiss();
366
+ setComposersData(prev => {
367
+ return {
368
+ ...prev,
369
+ [currentID]: {
370
+ ...prev[currentID],
371
+ progress: true
372
+ }
373
+ };
374
+ });
375
+ setTimeout(() => {
376
+ setComposersData(prev => {
377
+ const newComposersData = { ...prev };
378
+ delete newComposersData[currentID];
379
+ return newComposersData;
380
+ });
381
+ push({ content: 'Draft Saved' });
382
+ }, 1000);
383
+ }}>
384
+ Save as draft
385
+ </Button>
386
+
387
+ <Button onClick={() => {
388
+ dismiss();
389
+ setComposersData(prev => {
390
+ const newComposersData = { ...prev };
391
+ delete newComposersData[currentID];
392
+ return newComposersData;
393
+ });
394
+ }}>
395
+ Discard
396
+ </Button>
397
+ </Flex>
398
+ <Button variant='primary' onClick={() => {
399
+ dismiss();
400
+ }}>
401
+ Cancel
402
+ </Button>
403
+ </>} center>
404
+ <Text variant='primary'>
405
+ You have unsaved changes. You can discard them or go back to keep working.
406
+ </Text>
407
+ </Modal>);
408
+ };
344
409
  const handleCancel = (uid) => {
345
- setComposersData(prev => {
346
- const newComposersData = { ...prev };
347
- delete newComposersData[uid];
348
- return newComposersData;
349
- });
410
+ create(MyModal, { currentID: uid }, { alert: true });
350
411
  };
351
412
  const handleSend = (uid) => {
352
413
  action('Send')();
@@ -355,38 +416,38 @@ export const EmailShellDemo = (args) => {
355
416
  ...prev,
356
417
  [uid]: {
357
418
  ...prev[uid],
358
- data: {
359
- ...prev[uid].data,
360
- to: {
361
- value: prev[uid].data.to?.value || [],
362
- error: !prev[uid].data.to?.value.length
363
- ? emptyFieldErrorMessage
364
- : fieldValidation(prev[uid].data.to?.value)
365
- },
366
- cc: {
367
- value: prev[uid].data.cc?.value || [],
368
- error: !prev[uid].data.cc?.value.length
369
- ? undefined
370
- : fieldValidation(prev[uid].data.cc?.value)
371
- },
372
- bcc: {
373
- value: prev[uid].data.bcc?.value || [],
374
- error: !prev[uid].data.bcc?.value.length
375
- ? undefined
376
- : fieldValidation(prev[uid].data.bcc?.value)
377
- },
378
- subject: {
379
- value: prev[uid].data.subject.value || '',
380
- error: prev[uid].data.subject.value === '' ? emptyFieldErrorMessage : undefined
381
- },
382
- bodyContent: {
383
- defaultValue: prev[uid].data.bodyContent.defaultValue || '',
384
- error: prev[uid].bodyContentCurrentValue === '' ? emptyFieldErrorMessage : undefined
385
- }
386
- }
419
+ progress: true
387
420
  }
388
421
  };
389
422
  });
423
+ setTimeout(() => {
424
+ setComposersData(prev => {
425
+ const newComposersData = { ...prev };
426
+ delete newComposersData[uid];
427
+ return newComposersData;
428
+ });
429
+ push({ content: 'Email Send' });
430
+ }, 1000);
431
+ };
432
+ const handleSave = (uid) => {
433
+ action('Save')();
434
+ setComposersData(prev => {
435
+ return {
436
+ ...prev,
437
+ [uid]: {
438
+ ...prev[uid],
439
+ progress: true
440
+ }
441
+ };
442
+ });
443
+ setTimeout(() => {
444
+ setComposersData(prev => {
445
+ const newComposersData = { ...prev };
446
+ delete newComposersData[uid];
447
+ return newComposersData;
448
+ });
449
+ push({ content: 'Draft Saved' });
450
+ }, 1000);
390
451
  };
391
452
  const createOrActivateComposer = (id, launchAction, composerProps) => {
392
453
  const uid = getCompositeId(id, launchAction);
@@ -404,7 +465,8 @@ export const EmailShellDemo = (args) => {
404
465
  handle: composerHandle,
405
466
  onChange: (field, value) => handleChange(uid, field, value),
406
467
  onCancel: () => handleCancel(uid),
407
- onSend: () => handleSend(uid)
468
+ onSend: () => handleSend(uid),
469
+ onSave: () => handleSave(uid)
408
470
  }
409
471
  };
410
472
  });
@@ -412,7 +474,7 @@ export const EmailShellDemo = (args) => {
412
474
  };
413
475
  const emailsData = [
414
476
  {
415
- id: 'item_0',
477
+ id: 'item0',
416
478
  timeStamp: '2021-01-05T09:12',
417
479
  from: participants[0],
418
480
  to: participants.slice(0, 2),
@@ -440,7 +502,7 @@ export const EmailShellDemo = (args) => {
440
502
  })
441
503
  },
442
504
  {
443
- id: 'item_1',
505
+ id: 'item1',
444
506
  timeStamp: '2021-01-02T03:12',
445
507
  from: participants[3],
446
508
  to: participants.slice(2, 4),
@@ -449,7 +511,7 @@ export const EmailShellDemo = (args) => {
449
511
  subject: 'Pause service'
450
512
  }
451
513
  ].map(emailData => {
452
- const emailActionItems = emailDemoActions(emailData.id, emailData.subject, createOrActivateComposer);
514
+ const emailActionItems = emailDemoActions(emailData.id, emailData.subject, createOrActivateComposer, false, emailData.body);
453
515
  return {
454
516
  ...emailData,
455
517
  onReply: (id) => {
@@ -499,49 +561,72 @@ export const EmailShellDemo = (args) => {
499
561
  }
500
562
  };
501
563
  });
502
- const emailConversations = [
503
- [...emailsData],
504
- [
505
- {
506
- ...emailsData[0],
507
- timeStamp: '2021-01-03T17:15',
508
- from: mockEmails['Hugh Phillips'],
509
- to: [mockEmails['Mystery Rey'], ...emailsData[0].to],
510
- cc: [mockEmails['Adam Gillchrist']],
511
- bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
512
- body: '<div>Hi, <br /> <br /><div>Sure, Our executive will come and check your connection in 24hrs. </div> <br />Regards, <br />Hugh Phillips </div>'
513
- },
514
- {
515
- ...emailsData[1],
516
- unRead: false,
517
- timeStamp: '2021-01-02T14:16',
518
- from: mockEmails['Mystery Rey'],
519
- to: [mockEmails['Hugh Phillips']],
520
- body: '<div>Hi, <br /> <br /><div>Can you fix my internet connection. </div> <br /> <br />Regards, <br />Rey Mystery </div>'
521
- }
522
- ],
523
- [
524
- {
525
- ...emailsData[0],
526
- unRead: false,
527
- timeStamp: '2020-12-05T18:18',
528
- from: mockEmails['Laura Stevens'],
529
- to: [mockEmails['Sara Davis']],
530
- body: '<div>Hi, <br /> <br /><div>Sure, Our executive will call you shortly. </div> <br /> <br />Regards, <br />Laura Stevens </div>',
531
- sentiment: {
532
- variant: 'positive'
564
+ const deleteEmail = (id) => {
565
+ setConversationEmails(prev => {
566
+ const newEmailConversation = [];
567
+ prev.forEach(arr => {
568
+ const newArr = arr.filter(index => index.id !== id);
569
+ if (newArr.length !== 0)
570
+ newEmailConversation.push(newArr);
571
+ });
572
+ return newEmailConversation;
573
+ });
574
+ };
575
+ useEffect(() => {
576
+ setConversationEmails([
577
+ [{ ...emailsData[0] }, { ...emailsData[1], status: 'undelivered' }],
578
+ [
579
+ {
580
+ ...emailsData[0],
581
+ id: 'item2',
582
+ status: 'draft',
583
+ unRead: false,
584
+ 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),
585
+ timeStamp: '2021-01-03T17:15',
586
+ from: mockEmails['Hugh Phillips'],
587
+ to: [mockEmails['Mystery Rey'], ...emailsData[0].to],
588
+ cc: [mockEmails['Adam Gillchrist']],
589
+ bcc: [mockEmails['Anton, Randy'], mockEmails['Hugh Phillips']],
590
+ body: '<div>Hi, <br /> <br /><div>Sure, Our executive will come and check your connection in 24hrs. </div> <br />Regards, <br />Hugh Phillips </div>'
591
+ },
592
+ {
593
+ ...emailsData[1],
594
+ id: 'item3',
595
+ status: 'draft',
596
+ 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),
597
+ unRead: false,
598
+ timeStamp: '2021-01-02T14:16',
599
+ from: mockEmails['Mystery Rey'],
600
+ to: [mockEmails['Hugh Phillips']],
601
+ body: '<div>Hi, <br /> <br /><div>Can you fix my internet connection. </div> <br /> <br />Regards, <br />Rey Mystery </div>'
533
602
  }
534
- },
535
- {
536
- ...emailsData[1],
537
- unRead: false,
538
- timeStamp: '2021-01-04T08:30',
539
- from: mockEmails['Sara Davis'],
540
- to: [mockEmails['Laura Stevens']],
541
- body: '<div>Hi, <br /> <br /><div>Can you show please explain your new mobile plans. </div> <br /> <br />Regards, <br />Sara Davis </div>'
542
- }
543
- ]
544
- ].map((emails, i) => {
603
+ ],
604
+ [
605
+ {
606
+ ...emailsData[0],
607
+ id: 'item4',
608
+ unRead: true,
609
+ timeStamp: '2020-12-05T18:18',
610
+ from: mockEmails['Laura Stevens'],
611
+ to: [mockEmails['Sara Davis']],
612
+ body: '<div>Hi, <br /> <br /><div>Sure, Our executive will call you shortly. </div> <br /> <br />Regards, <br />Laura Stevens </div>',
613
+ sentiment: {
614
+ variant: 'positive'
615
+ }
616
+ },
617
+ {
618
+ ...emailsData[1],
619
+ id: 'item5',
620
+ unRead: true,
621
+ timeStamp: '2021-01-04T08:30',
622
+ from: mockEmails['Sara Davis'],
623
+ to: [mockEmails['Laura Stevens']],
624
+ body: '<div>Hi, <br /> <br /><div>Can you show please explain your new mobile plans. </div> <br /> <br />Regards, <br />Sara Davis </div>'
625
+ }
626
+ ]
627
+ ]);
628
+ }, []);
629
+ const emailConversations = conversationEmails.map((emails, i) => {
545
630
  return {
546
631
  from: generateEmailConversationParticipants(emails, ['from'])[0],
547
632
  to: emails[0].to,
@@ -551,7 +636,9 @@ export const EmailShellDemo = (args) => {
551
636
  emails,
552
637
  sentiment: emails[0].sentiment,
553
638
  isForwarded: i !== 2,
554
- isCollapsed: i !== 0
639
+ isCollapsed: i !== 0,
640
+ drafts: i === 1,
641
+ undelivered: i === 0
555
642
  };
556
643
  });
557
644
  const singleEmailConversation = [
@@ -561,7 +648,7 @@ export const EmailShellDemo = (args) => {
561
648
  id: 'item_0',
562
649
  timeStamp: new Date(emailsData[0].timeStamp),
563
650
  unReadEmailCount: emailsData.filter(item => item.unRead).length,
564
- emails: emailsData
651
+ emails: [{ ...emailsData[0], status: 'undelivered' }, { ...emailsData[1] }]
565
652
  }
566
653
  ];
567
654
  return (<>
@@ -719,7 +806,7 @@ export const EmailManagerAppShell = (args) => {
719
806
  }
720
807
  }, [loading]);
721
808
  const activeItemIndex = useMemo(() => emailList.findIndex(emailItem => emailItem.id === activeItemId), [activeItemId, emailList]);
722
- const content = activeItemId === undefined ? (<EmptyState message='No item selected!'/>) : (<EmailShellDemo singleConversation={activeItemIndex % 2 === 0}/>);
809
+ const content = activeItemId === undefined ? (<EmptyState message='No item selected!'/>) : (<EmailShellDemo singleConversation={activeItemIndex % 2 !== 0}/>);
723
810
  const utilities = activeItemId === undefined ? null : (<Grid container={{ rowGap: 2 }}>
724
811
  <EntityListDemo onContextMenu={args.onContextMenu} enableContextMenu={args.enableContextMenu}/>
725
812
  <Card>