@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.
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +11 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js +135 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +18 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx +72 -0
- package/jsx/build/ExpressionBuilder/ExpressionBuilder.stories.jsx.map +1 -0
- package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx +3 -2
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx.map +1 -1
- package/jsx/core/AdditionalInfo/AdditionalInfo.stories.d.ts +9 -0
- package/jsx/core/AdditionalInfo/AdditionalInfo.stories.d.ts.map +1 -0
- package/jsx/core/AdditionalInfo/AdditionalInfo.stories.jsx +25 -0
- package/jsx/core/AdditionalInfo/AdditionalInfo.stories.jsx.map +1 -0
- package/jsx/core/AppShell/AppShell.stories.d.ts.map +1 -1
- package/jsx/core/AppShell/AppShell.stories.jsx +11 -1
- package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.d.ts +6 -2
- package/jsx/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.jsx +26 -7
- package/jsx/core/Checkbox/Checkbox.stories.jsx.map +1 -1
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.d.ts +6 -2
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx +46 -5
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx.map +1 -1
- package/jsx/core/ColorPicker/ColorPicker.stories.d.ts +4 -1
- package/jsx/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
- package/jsx/core/ColorPicker/ColorPicker.stories.jsx +10 -3
- package/jsx/core/ColorPicker/ColorPicker.stories.jsx.map +1 -1
- package/jsx/core/ComboBox/ComboBox.stories.d.ts +1 -0
- package/jsx/core/ComboBox/ComboBox.stories.d.ts.map +1 -1
- package/jsx/core/ComboBox/ComboBox.stories.jsx +40 -8
- package/jsx/core/ComboBox/ComboBox.stories.jsx.map +1 -1
- package/jsx/core/CompositeInput/CompositeInput.stories.d.ts +4 -1
- package/jsx/core/CompositeInput/CompositeInput.stories.d.ts.map +1 -1
- package/jsx/core/CompositeInput/CompositeInput.stories.jsx +7 -3
- package/jsx/core/CompositeInput/CompositeInput.stories.jsx.map +1 -1
- package/jsx/core/CreditCard/CreditCard.stories.d.ts +4 -1
- package/jsx/core/CreditCard/CreditCard.stories.d.ts.map +1 -1
- package/jsx/core/CreditCard/CreditCard.stories.jsx +10 -3
- package/jsx/core/CreditCard/CreditCard.stories.jsx.map +1 -1
- package/jsx/core/Currency/Currency.stories.d.ts +4 -1
- package/jsx/core/Currency/Currency.stories.d.ts.map +1 -1
- package/jsx/core/Currency/Currency.stories.jsx +10 -3
- package/jsx/core/Currency/Currency.stories.jsx.map +1 -1
- package/jsx/core/DateTime/DateTime.stories.d.ts +39 -9
- package/jsx/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/jsx/core/DateTime/DateTime.stories.jsx +83 -14
- package/jsx/core/DateTime/DateTime.stories.jsx.map +1 -1
- package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts +3 -0
- package/jsx/core/FieldValueList/FieldValueList.mocks.d.ts.map +1 -0
- package/jsx/core/FieldValueList/FieldValueList.mocks.js +9 -0
- package/jsx/core/FieldValueList/FieldValueList.mocks.js.map +1 -0
- package/jsx/core/FieldValueList/FieldValueList.stories.d.ts +1 -0
- package/jsx/core/FieldValueList/FieldValueList.stories.d.ts.map +1 -1
- package/jsx/core/FieldValueList/FieldValueList.stories.jsx +34 -2
- package/jsx/core/FieldValueList/FieldValueList.stories.jsx.map +1 -1
- package/jsx/core/Form/Form.mocks.jsx +2 -2
- package/jsx/core/Form/Form.mocks.jsx.map +1 -1
- package/jsx/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
- package/jsx/core/IconPicker/IconPicker.stories.jsx +6 -9
- package/jsx/core/IconPicker/IconPicker.stories.jsx.map +1 -1
- package/jsx/core/Input/Input.stories.d.ts +1 -0
- package/jsx/core/Input/Input.stories.d.ts.map +1 -1
- package/jsx/core/Input/Input.stories.jsx +8 -1
- package/jsx/core/Input/Input.stories.jsx.map +1 -1
- package/jsx/core/Location/Location.stories.d.ts +4 -1
- package/jsx/core/Location/Location.stories.d.ts.map +1 -1
- package/jsx/core/Location/Location.stories.jsx +10 -3
- package/jsx/core/Location/Location.stories.jsx.map +1 -1
- package/jsx/core/Number/Number.stories.d.ts +1 -0
- package/jsx/core/Number/Number.stories.d.ts.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +15 -7
- package/jsx/core/Number/Number.stories.jsx.map +1 -1
- package/jsx/core/Phone/Phone.stories.d.ts +4 -1
- package/jsx/core/Phone/Phone.stories.d.ts.map +1 -1
- package/jsx/core/Phone/Phone.stories.jsx +10 -3
- package/jsx/core/Phone/Phone.stories.jsx.map +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.d.ts +6 -2
- package/jsx/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.jsx +22 -5
- package/jsx/core/RadioButton/RadioButton.stories.jsx.map +1 -1
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts +6 -2
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx +46 -5
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx.map +1 -1
- package/jsx/core/Select/Select.stories.d.ts +1 -0
- package/jsx/core/Select/Select.stories.d.ts.map +1 -1
- package/jsx/core/Select/Select.stories.jsx +10 -3
- package/jsx/core/Select/Select.stories.jsx.map +1 -1
- package/jsx/core/TextArea/TextArea.stories.d.ts +4 -1
- package/jsx/core/TextArea/TextArea.stories.d.ts.map +1 -1
- package/jsx/core/TextArea/TextArea.stories.jsx +10 -3
- package/jsx/core/TextArea/TextArea.stories.jsx.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts +4 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx +10 -3
- package/jsx/rte/RichTextEditor/RichTextEditor.stories.jsx.map +1 -1
- package/jsx/social/Chat/Chat.mocks.d.ts +1 -1
- package/jsx/social/Chat/Chat.mocks.js +0 -1
- package/jsx/social/Chat/Chat.mocks.js.map +1 -1
- package/jsx/social/Email/Email.mocks.d.ts +39 -1
- package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
- package/jsx/social/Email/Email.mocks.jsx +78 -39
- package/jsx/social/Email/Email.mocks.jsx.map +1 -1
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +174 -87
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/tools/Clipboard/Clipboard.mocks.d.ts +6 -0
- package/jsx/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -0
- package/jsx/tools/Clipboard/Clipboard.mocks.jsx +82 -0
- package/jsx/tools/Clipboard/Clipboard.mocks.jsx.map +1 -0
- package/jsx/tools/Clipboard/Clipboard.stories.d.ts +6 -0
- package/jsx/tools/Clipboard/Clipboard.stories.d.ts.map +1 -0
- package/jsx/tools/Clipboard/Clipboard.stories.jsx +68 -0
- package/jsx/tools/Clipboard/Clipboard.stories.jsx.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.mocks.d.ts +9 -0
- package/jsx/tools/PreviewShell/PreviewShell.mocks.d.ts.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.mocks.jsx +58 -0
- package/jsx/tools/PreviewShell/PreviewShell.mocks.jsx.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts +15 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.jsx +107 -0
- package/jsx/tools/PreviewShell/PreviewShell.stories.jsx.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.styles.d.ts +3 -0
- package/jsx/tools/PreviewShell/PreviewShell.styles.d.ts.map +1 -0
- package/jsx/tools/PreviewShell/PreviewShell.styles.js +7 -0
- package/jsx/tools/PreviewShell/PreviewShell.styles.js.map +1 -0
- package/jsx/work/Details/Details.stories.d.ts.map +1 -1
- package/jsx/work/Details/Details.stories.jsx +9 -2
- package/jsx/work/Details/Details.stories.jsx.map +1 -1
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts +11 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.d.ts.map +1 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js +136 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.mocks.js.map +1 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts +18 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.d.ts.map +1 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js +66 -0
- package/lib/build/ExpressionBuilder/ExpressionBuilder.stories.js.map +1 -0
- package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.js +3 -2
- package/lib/build/ObjectSelect/ObjectSelect.stories.js.map +1 -1
- package/lib/core/AdditionalInfo/AdditionalInfo.stories.d.ts +9 -0
- package/lib/core/AdditionalInfo/AdditionalInfo.stories.d.ts.map +1 -0
- package/lib/core/AdditionalInfo/AdditionalInfo.stories.js +16 -0
- package/lib/core/AdditionalInfo/AdditionalInfo.stories.js.map +1 -0
- package/lib/core/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/core/AppShell/AppShell.stories.js +11 -1
- package/lib/core/AppShell/AppShell.stories.js.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.d.ts +6 -2
- package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.js +26 -7
- package/lib/core/Checkbox/Checkbox.stories.js.map +1 -1
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.d.ts +6 -2
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.js +40 -4
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.js.map +1 -1
- package/lib/core/ColorPicker/ColorPicker.stories.d.ts +4 -1
- package/lib/core/ColorPicker/ColorPicker.stories.d.ts.map +1 -1
- package/lib/core/ColorPicker/ColorPicker.stories.js +10 -3
- package/lib/core/ColorPicker/ColorPicker.stories.js.map +1 -1
- package/lib/core/ComboBox/ComboBox.stories.d.ts +1 -0
- package/lib/core/ComboBox/ComboBox.stories.d.ts.map +1 -1
- package/lib/core/ComboBox/ComboBox.stories.js +40 -8
- package/lib/core/ComboBox/ComboBox.stories.js.map +1 -1
- package/lib/core/CompositeInput/CompositeInput.stories.d.ts +4 -1
- package/lib/core/CompositeInput/CompositeInput.stories.d.ts.map +1 -1
- package/lib/core/CompositeInput/CompositeInput.stories.js +7 -3
- package/lib/core/CompositeInput/CompositeInput.stories.js.map +1 -1
- package/lib/core/CreditCard/CreditCard.stories.d.ts +4 -1
- package/lib/core/CreditCard/CreditCard.stories.d.ts.map +1 -1
- package/lib/core/CreditCard/CreditCard.stories.js +10 -3
- package/lib/core/CreditCard/CreditCard.stories.js.map +1 -1
- package/lib/core/Currency/Currency.stories.d.ts +4 -1
- package/lib/core/Currency/Currency.stories.d.ts.map +1 -1
- package/lib/core/Currency/Currency.stories.js +10 -3
- package/lib/core/Currency/Currency.stories.js.map +1 -1
- package/lib/core/DateTime/DateTime.stories.d.ts +39 -9
- package/lib/core/DateTime/DateTime.stories.d.ts.map +1 -1
- package/lib/core/DateTime/DateTime.stories.js +83 -14
- package/lib/core/DateTime/DateTime.stories.js.map +1 -1
- package/lib/core/FieldValueList/FieldValueList.mocks.d.ts +3 -0
- package/lib/core/FieldValueList/FieldValueList.mocks.d.ts.map +1 -0
- package/lib/core/FieldValueList/FieldValueList.mocks.js +9 -0
- package/lib/core/FieldValueList/FieldValueList.mocks.js.map +1 -0
- package/lib/core/FieldValueList/FieldValueList.stories.d.ts +1 -0
- package/lib/core/FieldValueList/FieldValueList.stories.d.ts.map +1 -1
- package/lib/core/FieldValueList/FieldValueList.stories.js +32 -2
- package/lib/core/FieldValueList/FieldValueList.stories.js.map +1 -1
- package/lib/core/Form/Form.mocks.js +2 -2
- package/lib/core/Form/Form.mocks.js.map +1 -1
- package/lib/core/IconPicker/IconPicker.stories.d.ts.map +1 -1
- package/lib/core/IconPicker/IconPicker.stories.js +6 -9
- package/lib/core/IconPicker/IconPicker.stories.js.map +1 -1
- package/lib/core/Input/Input.stories.d.ts +1 -0
- package/lib/core/Input/Input.stories.d.ts.map +1 -1
- package/lib/core/Input/Input.stories.js +8 -1
- package/lib/core/Input/Input.stories.js.map +1 -1
- package/lib/core/Location/Location.stories.d.ts +4 -1
- package/lib/core/Location/Location.stories.d.ts.map +1 -1
- package/lib/core/Location/Location.stories.js +10 -3
- package/lib/core/Location/Location.stories.js.map +1 -1
- package/lib/core/Number/Number.stories.d.ts +1 -0
- package/lib/core/Number/Number.stories.d.ts.map +1 -1
- package/lib/core/Number/Number.stories.js +15 -7
- package/lib/core/Number/Number.stories.js.map +1 -1
- package/lib/core/Phone/Phone.stories.d.ts +4 -1
- package/lib/core/Phone/Phone.stories.d.ts.map +1 -1
- package/lib/core/Phone/Phone.stories.js +10 -3
- package/lib/core/Phone/Phone.stories.js.map +1 -1
- package/lib/core/RadioButton/RadioButton.stories.d.ts +6 -2
- package/lib/core/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/lib/core/RadioButton/RadioButton.stories.js +22 -5
- package/lib/core/RadioButton/RadioButton.stories.js.map +1 -1
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts +6 -2
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js +40 -4
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js.map +1 -1
- package/lib/core/Select/Select.stories.d.ts +1 -0
- package/lib/core/Select/Select.stories.d.ts.map +1 -1
- package/lib/core/Select/Select.stories.js +10 -3
- package/lib/core/Select/Select.stories.js.map +1 -1
- package/lib/core/TextArea/TextArea.stories.d.ts +4 -1
- package/lib/core/TextArea/TextArea.stories.d.ts.map +1 -1
- package/lib/core/TextArea/TextArea.stories.js +10 -3
- package/lib/core/TextArea/TextArea.stories.js.map +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts +4 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.d.ts.map +1 -1
- package/lib/rte/RichTextEditor/RichTextEditor.stories.js +10 -3
- package/lib/rte/RichTextEditor/RichTextEditor.stories.js.map +1 -1
- package/lib/social/Chat/Chat.mocks.d.ts +1 -1
- package/lib/social/Chat/Chat.mocks.js +0 -1
- package/lib/social/Chat/Chat.mocks.js.map +1 -1
- package/lib/social/Email/Email.mocks.d.ts +39 -1
- package/lib/social/Email/Email.mocks.d.ts.map +1 -1
- package/lib/social/Email/Email.mocks.js +78 -39
- package/lib/social/Email/Email.mocks.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +158 -87
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/tools/Clipboard/Clipboard.mocks.d.ts +6 -0
- package/lib/tools/Clipboard/Clipboard.mocks.d.ts.map +1 -0
- package/lib/tools/Clipboard/Clipboard.mocks.js +80 -0
- package/lib/tools/Clipboard/Clipboard.mocks.js.map +1 -0
- package/lib/tools/Clipboard/Clipboard.stories.d.ts +6 -0
- package/lib/tools/Clipboard/Clipboard.stories.d.ts.map +1 -0
- package/lib/tools/Clipboard/Clipboard.stories.js +69 -0
- package/lib/tools/Clipboard/Clipboard.stories.js.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.mocks.d.ts +9 -0
- package/lib/tools/PreviewShell/PreviewShell.mocks.d.ts.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.mocks.js +57 -0
- package/lib/tools/PreviewShell/PreviewShell.mocks.js.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.d.ts +15 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.d.ts.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.js +108 -0
- package/lib/tools/PreviewShell/PreviewShell.stories.js.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.styles.d.ts +3 -0
- package/lib/tools/PreviewShell/PreviewShell.styles.d.ts.map +1 -0
- package/lib/tools/PreviewShell/PreviewShell.styles.js +7 -0
- package/lib/tools/PreviewShell/PreviewShell.styles.js.map +1 -0
- package/lib/work/Details/Details.stories.d.ts.map +1 -1
- package/lib/work/Details/Details.stories.js +2 -2
- package/lib/work/Details/Details.stories.js.map +1 -1
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: '
|
|
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: '
|
|
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
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
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
|
|
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>
|