@pega/cosmos-react-social 2.0.0-dev.19.0 → 2.0.0-dev.21.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/lib/components/Chat/Chat.js +4 -4
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/ChatBody.js +2 -2
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.js +12 -12
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.js +3 -3
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatTranscript.js +5 -5
- package/lib/components/Chat/ChatTranscript.js.map +1 -1
- package/lib/components/Chat/Message.js +13 -13
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/MessageList.js +7 -7
- package/lib/components/Chat/MessageList.js.map +1 -1
- package/lib/components/Chat/RepeatingView.js +5 -5
- package/lib/components/Chat/RepeatingView.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +9 -9
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.js +2 -2
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TranscriptMessage.js +3 -3
- package/lib/components/Chat/TranscriptMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +1 -1
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Email/Email.js +23 -23
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +1 -0
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +12 -0
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +41 -31
- package/lib/components/Email/Email.types.d.ts.map +1 -1
- package/lib/components/Email/Email.types.js.map +1 -1
- package/lib/components/Email/EmailComposer.d.ts +4 -4
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +132 -120
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.js +5 -5
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailEntity.d.ts.map +1 -1
- package/lib/components/Email/EmailEntity.js +4 -4
- package/lib/components/Email/EmailEntity.js.map +1 -1
- package/lib/components/Email/EmailSelector.d.ts +14 -0
- package/lib/components/Email/EmailSelector.d.ts.map +1 -0
- package/lib/components/Email/EmailSelector.js +62 -0
- package/lib/components/Email/EmailSelector.js.map +1 -0
- package/lib/components/Email/EmailShell.js +9 -9
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +4 -4
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +7 -7
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/ViewAnalysis.d.ts +6 -0
- package/lib/components/Email/ViewAnalysis.d.ts.map +1 -0
- package/lib/components/Email/ViewAnalysis.js +20 -0
- package/lib/components/Email/ViewAnalysis.js.map +1 -0
- package/lib/components/Feed/Feed.js +5 -5
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +4 -4
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedContent.js +1 -1
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedModalList.js +1 -1
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +4 -4
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +9 -9
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.js +11 -11
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedReply.js +9 -9
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +5 -5
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.js +2 -2
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.js +1 -1
- package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +1 -1
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.styles.js","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,QAAQ,EACR,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAIjC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;CAIrD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;uBACW,KAAK,CAAC,IAAI,CAAC,OAAO;qCACJ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,KAAK,CAAC,IAAI,CAAC,OAAO,cAAc,KAAK,CAAC,IAAI,CAAC,OAAO;MACxE,YAAY,IAAI,wBAAwB;;;MAGxC,eAAe;+BACU,KAAK,CAAC,IAAI,CAAC,OAAO;;GAE9C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GA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AAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,2BAA2B,CAAC,MAAM,CAC7F,EACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACzC,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IACjE,OAAO,GAAG,CAAA;0BACc,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;4BACzB,KAAK,CAAC,IAAI,CAAC,OAAO;wBACtB,eAAe;aAC1B,SAAS;GACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n EmailDisplay,\n FieldValueList,\n MenuButton,\n StyledFieldName,\n StyledFieldValue,\n StyledSecondary,\n StyledSummaryItemActions,\n StyledVisual,\n tryCatch,\n readableHue\n} from '@pega/cosmos-react-core';\n\nimport { EmailEntityProps } from './Email.types';\n\nexport const StyledEmailMoreInfoButton = styled.button`\n min-height: 0.5rem;\n min-width: 0.5rem;\n flex-shrink: 0;\n`;\n\nexport const StyledEmailHeader = styled.div(({ theme }) => {\n return css`\n grid-column-gap: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: 0 0 calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n ${StyledVisual},${StyledSummaryItemActions} {\n align-self: flex-start;\n }\n ${StyledSecondary} {\n margin-top: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailHeader.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesButton = styled(Button)(({ theme }) => {\n return css`\n & + & {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesButton.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesMenuButton = styled(MenuButton)(({ theme }) => {\n return css`\n &&& {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesMenuButton.defaultProps = defaultThemeProp;\n\nexport const StyledEmailBody = styled.div``;\n\nexport const StyledFromEmailDisplay = styled(EmailDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSize.m};\n `;\n});\n\nStyledFromEmailDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledEmailDisplay = styled.span`\n font-size: inherit;\n`;\n\nexport const StyledEmailPrimaryFieldValueList = styled(FieldValueList)`\n grid-template-columns: auto 1fr;\n`;\n\nexport const StyledEmailSecondaryFieldValueList = styled(FieldValueList)(({ theme }) => {\n return css`\n grid-template-columns: 1fr;\n gap: 0;\n padding: ${theme.base.spacing} 0;\n ${StyledFieldValue}:not(:last-child) {\n margin-bottom: calc(2 * ${theme.base.spacing});\n }\n ${StyledFieldName} {\n margin-bottom: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailSecondaryFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledEmailMoreInfoPopover = styled.div`\n max-width: 30rem;\n`;\n\nexport const StyledSecondarySeparator = styled.div(({ theme }) => {\n return css`\n margin: 0 calc(${theme.base.spacing} / 2);\n `;\n});\nexport const emailEntityBackgroundColors = [\n '#00428B',\n '#008C80',\n '#53336F',\n '#005FA7',\n '#7C421B',\n '#BC1513',\n '#DE4342',\n '#661D34',\n '#8B479E',\n '#4B3380',\n '#10A5AC',\n '#5F67B9',\n '#1D447A',\n '#988CC4',\n '#AC1361',\n '#1B6B2E',\n '#4064B3',\n '#4D4D4D',\n '#0F5F5D',\n '#7F375B'\n];\n\nexport const StyledEmail = styled.div``;\n\nexport const StyledEmailEntity = styled.mark<EmailEntityProps>(({ entity, theme }) => {\n const variant = entity.variant;\n const backgroundColor = readableHue(\n emailEntityBackgroundColors[\n (Number.isFinite(variant) && variant > 0 ? variant : 0) % emailEntityBackgroundColors.length\n ],\n theme.base.palette['primary-background']\n );\n const textColor = tryCatch(() => readableColor(backgroundColor));\n return css`\n border-radius: calc(${theme.base['border-radius']} / 3);\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${backgroundColor};\n color: ${textColor};\n `;\n});\n\nStyledEmailEntity.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Email.styles.js","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,QAAQ,EACR,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAIjC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;CAIrD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;uBACW,KAAK,CAAC,IAAI,CAAC,OAAO;qCACJ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,KAAK,CAAC,IAAI,CAAC,OAAO,cAAc,KAAK,CAAC,IAAI,CAAC,OAAO;MACx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AAE,KAAK,EAAE,EAAE,EAAE;IACnF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,MAAM,eAAe,GAAG,WAAW,CACjC,2BAA2B,CACzB,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,2BAA2B,CAAC,MAAM,CAC7F,EACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACzC,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IACjE,OAAO,GAAG,CAAA;0BACc,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;4BACzB,KAAK,CAAC,IAAI,CAAC,OAAO;wBACtB,eAAe;aAC1B,SAAS;GACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACnF,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1F,OAAO,GAAG,CAAA;MACN,eAAe;eACN,SAAS;;MAElB,iBAAiB;4BACK,KAAK,CAAC,IAAI,CAAC,OAAO;;GAE3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gCAAgC,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n EmailDisplay,\n FieldValueList,\n MenuButton,\n StyledFieldName,\n StyledFieldValue,\n StyledSecondary,\n StyledSummaryItemActions,\n StyledVisual,\n tryCatch,\n readableHue\n} from '@pega/cosmos-react-core';\n\nimport { EmailEntityProps } from './Email.types';\n\nexport const StyledEmailMoreInfoButton = styled.button`\n min-height: 0.5rem;\n min-width: 0.5rem;\n flex-shrink: 0;\n`;\n\nexport const StyledEmailHeader = styled.div(({ theme }) => {\n return css`\n grid-column-gap: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: 0 0 calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n ${StyledVisual},${StyledSummaryItemActions} {\n align-self: flex-start;\n }\n ${StyledSecondary} {\n margin-top: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailHeader.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesButton = styled(Button)(({ theme }) => {\n return css`\n & + & {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesButton.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesMenuButton = styled(MenuButton)(({ theme }) => {\n return css`\n &&& {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesMenuButton.defaultProps = defaultThemeProp;\n\nexport const StyledEmailBody = styled.div``;\n\nexport const StyledFromEmailDisplay = styled(EmailDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSize.m};\n `;\n});\n\nStyledFromEmailDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledEmailDisplay = styled.span`\n font-size: inherit;\n`;\n\nexport const StyledEmailPrimaryFieldValueList = styled(FieldValueList)`\n grid-template-columns: auto 1fr;\n`;\n\nexport const StyledEmailSecondaryFieldValueList = styled(FieldValueList)(({ theme }) => {\n return css`\n grid-template-columns: 1fr;\n gap: 0;\n padding: ${theme.base.spacing} 0;\n ${StyledFieldValue}:not(:last-child) {\n margin-bottom: calc(2 * ${theme.base.spacing});\n }\n ${StyledFieldName} {\n margin-bottom: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailSecondaryFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledEmailMoreInfoPopover = styled.div`\n max-width: 30rem;\n`;\n\nexport const StyledSecondarySeparator = styled.div(({ theme }) => {\n return css`\n margin: 0 calc(${theme.base.spacing} / 2);\n `;\n});\nexport const emailEntityBackgroundColors = [\n '#00428B',\n '#008C80',\n '#53336F',\n '#005FA7',\n '#7C421B',\n '#BC1513',\n '#DE4342',\n '#661D34',\n '#8B479E',\n '#4B3380',\n '#10A5AC',\n '#5F67B9',\n '#1D447A',\n '#988CC4',\n '#AC1361',\n '#1B6B2E',\n '#4064B3',\n '#4D4D4D',\n '#0F5F5D',\n '#7F375B'\n];\n\nexport const StyledEmail = styled.div``;\n\nexport const StyledEmailEntity = styled.mark<EmailEntityProps>(({ entity, theme }) => {\n const variant = entity.variant;\n const backgroundColor = readableHue(\n emailEntityBackgroundColors[\n (Number.isFinite(variant) && variant > 0 ? variant : 0) % emailEntityBackgroundColors.length\n ],\n theme.base.palette['primary-background']\n );\n const textColor = tryCatch(() => readableColor(backgroundColor));\n return css`\n border-radius: calc(${theme.base['border-radius']} / 3);\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${backgroundColor};\n color: ${textColor};\n `;\n});\n\nStyledEmailEntity.defaultProps = defaultThemeProp;\n\nexport const StyledViewAnalysisFieldValueList = styled(FieldValueList)(({ theme }) => {\n const textColor = tryCatch(() => readableColor(theme.base.palette['primary-background']));\n return css`\n ${StyledFieldName} {\n color: ${textColor};\n }\n ${StyledEmailEntity} {\n padding: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledViewAnalysisFieldValueList.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MouseEventHandler, ReactNode, Ref } from 'react';
|
|
2
|
-
import { BaseProps, AvatarProps, SentimentProps, FileDisplayProps, FileUploadItemProps,
|
|
3
|
-
import { SelectProps } from '@pega/cosmos-react-core/lib/components/Select/Select';
|
|
4
|
-
import { RichTextEditorProps } from '@pega/cosmos-react-rte';
|
|
2
|
+
import { BaseProps, AvatarProps, SentimentProps, FileDisplayProps, FileUploadItemProps, OmitStrict, MenuProps, MenuItemProps, TooltipProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
5
3
|
export interface Suggestion {
|
|
6
4
|
/** Suggestion title */
|
|
7
5
|
title: string;
|
|
6
|
+
/** Suggestion value */
|
|
7
|
+
content: string;
|
|
8
8
|
/** Suggestion id */
|
|
9
9
|
id: string;
|
|
10
10
|
}
|
|
@@ -23,7 +23,8 @@ export interface EntityHighlightMapping {
|
|
|
23
23
|
type: string;
|
|
24
24
|
name: string;
|
|
25
25
|
variant: number;
|
|
26
|
-
description
|
|
26
|
+
description?: TooltipProps['children'];
|
|
27
|
+
icon?: string;
|
|
27
28
|
}
|
|
28
29
|
export interface EmailProps extends BaseProps {
|
|
29
30
|
/** Ref to the element */
|
|
@@ -91,31 +92,34 @@ export interface EmailConversationProps extends BaseProps {
|
|
|
91
92
|
/** Callback when email conversation is expanded */
|
|
92
93
|
onExpand?: () => void;
|
|
93
94
|
}
|
|
94
|
-
export interface
|
|
95
|
-
/** Header of the email */
|
|
96
|
-
header?: string;
|
|
97
|
-
/** Object containing full list of email participants */
|
|
98
|
-
participants: EmailUser[];
|
|
99
|
-
/** Object containing the props to render the from drop down */
|
|
100
|
-
from: SelectProps;
|
|
95
|
+
export interface EmailComposerData extends Pick<EmailComposerProps, 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments'> {
|
|
101
96
|
/** Array to hold the initial participants that should be default initialized in To address. */
|
|
102
|
-
to
|
|
97
|
+
to: EmailUser['emailAddress'][];
|
|
98
|
+
}
|
|
99
|
+
export declare type EmailResponseType = 'reply' | 'replyAll' | 'forward';
|
|
100
|
+
export interface EmailDirectRecipients {
|
|
101
|
+
/** To address/addresses in case of reply response type on email. */
|
|
102
|
+
reply: EmailUser['emailAddress'][];
|
|
103
|
+
/** To address/addresses in case of replyAll response type on email. */
|
|
104
|
+
replyAll: EmailUser['emailAddress'][];
|
|
105
|
+
/** To address/addresses in case of forward response type on email. */
|
|
106
|
+
forward?: EmailUser['emailAddress'][];
|
|
107
|
+
}
|
|
108
|
+
export interface EmailComposerProps extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>, BaseProps, NoChildrenProp {
|
|
109
|
+
/** Object containing full list of email participants. */
|
|
110
|
+
participants: EmailUser[];
|
|
111
|
+
/** Object to hold initial to address/addresses based on different action types. */
|
|
112
|
+
to?: EmailDirectRecipients;
|
|
103
113
|
/** Array to hold the initial participants that should be default initialized in Cc address. */
|
|
104
114
|
cc?: EmailUser['emailAddress'][];
|
|
105
115
|
/** Array to hold the initial participants that should be default initialized in Bcc address. */
|
|
106
116
|
bcc?: EmailUser['emailAddress'][];
|
|
107
117
|
/** Object containing the props to render the subject input */
|
|
108
118
|
subject: string;
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
/** Region to hold secondary email composer fields */
|
|
112
|
-
secondaryMoreFields?: ReactNode;
|
|
113
|
-
/** Object containing the props to render the email body rte */
|
|
114
|
-
body: RichTextEditorProps & ForwardProps;
|
|
119
|
+
/** Body content of the email */
|
|
120
|
+
bodyContent: string;
|
|
115
121
|
/** Callback when email needs to be sent */
|
|
116
|
-
onSend: () => void;
|
|
117
|
-
/** Callback when attachment icon is clicked */
|
|
118
|
-
onAddAttachment?: () => void;
|
|
122
|
+
onSend: (data: EmailComposerData) => void;
|
|
119
123
|
/** List of attachments */
|
|
120
124
|
attachments?: FileUploadItemProps[];
|
|
121
125
|
/** Max number of attachments to be allowed in Email composer.
|
|
@@ -127,20 +131,12 @@ export interface EmailComposerProps extends Pick<EmailProps, 'attachments' | 'su
|
|
|
127
131
|
footerMoreActions?: ReactNode;
|
|
128
132
|
/** Templates for drafting email */
|
|
129
133
|
templates?: Record<string, string>;
|
|
130
|
-
/** Callback when replying to only from address */
|
|
131
|
-
onReply?: () => void;
|
|
132
|
-
/** Callback when replying to all participants */
|
|
133
|
-
onReplyAll?: () => void;
|
|
134
134
|
/** Callback when cancel composing */
|
|
135
135
|
onCancel: () => void;
|
|
136
|
-
/** Whether email composer opened after clicking reply or reply all */
|
|
137
|
-
isReplyAll: boolean;
|
|
138
136
|
/** Ref to the element */
|
|
139
137
|
ref?: Ref<HTMLDivElement>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
key: string;
|
|
143
|
-
value: EmailUser;
|
|
138
|
+
/** Email action types */
|
|
139
|
+
responseType?: EmailResponseType;
|
|
144
140
|
}
|
|
145
141
|
export interface EmailShellProps extends BaseProps {
|
|
146
142
|
/** ref to the element */
|
|
@@ -219,4 +215,18 @@ export interface EmailEntityProps extends BaseProps {
|
|
|
219
215
|
entity: EntityHighlightMapping;
|
|
220
216
|
ref?: Ref<HTMLElement>;
|
|
221
217
|
}
|
|
218
|
+
export interface ViewAnalysisProps extends BaseProps {
|
|
219
|
+
content: {
|
|
220
|
+
name: string;
|
|
221
|
+
value?: {
|
|
222
|
+
id: string;
|
|
223
|
+
entity: EntityHighlightMapping;
|
|
224
|
+
}[];
|
|
225
|
+
}[];
|
|
226
|
+
header: {
|
|
227
|
+
icon: string;
|
|
228
|
+
text: string;
|
|
229
|
+
};
|
|
230
|
+
ref?: Ref<HTMLDivElement>;
|
|
231
|
+
}
|
|
222
232
|
//# sourceMappingURL=Email.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.types.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"Email.types.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,SAAS;IACxB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,kFAAkF;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AC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,2BAA2B;IAC3B,WAAW,EAAE,CAAC,EAAE,EAAE,qBAAqB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IACvD,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,EAAE,EAAE,MAAM,CAAC;YACX,MAAM,EAAE,sBAAsB,CAAC;SAChC,EAAE,CAAC;KACL,EAAE,CAAC;IAEJ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.types.js","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n BaseProps,\n AvatarProps,\n SentimentProps,\n FileDisplayProps,\n FileUploadItemProps,\n
|
|
1
|
+
{"version":3,"file":"Email.types.js","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n BaseProps,\n AvatarProps,\n SentimentProps,\n FileDisplayProps,\n FileUploadItemProps,\n OmitStrict,\n MenuProps,\n MenuItemProps,\n TooltipProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nexport interface Suggestion {\n /** Suggestion title */\n title: string;\n /** Suggestion value */\n content: string;\n /** Suggestion id */\n id: string;\n}\n\nexport interface EmailUser {\n /** Short name of the User */\n shortName: string;\n /** Full name of the User */\n fullName: string;\n /** Email of the User */\n emailAddress: string;\n /** Avatar props of the User */\n avatarProps?: Partial<AvatarProps>;\n}\n\nexport interface EntityHighlightMapping {\n value: string;\n type: string;\n name: string;\n variant: number;\n description?: TooltipProps['children'];\n icon?: string;\n}\n\nexport interface EmailProps extends BaseProps {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Unique ID for this email record */\n id: string;\n /** Timestamp of this email as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | number | string;\n /** From email */\n from: EmailUser;\n /** To email */\n to: EmailUser[];\n /** Carbon copy of email users list */\n cc?: EmailUser[];\n /** Blind carbon copy of email users list */\n bcc?: EmailUser[];\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Subject of the email */\n subject?: string;\n /** Body */\n body?: ReactNode | string;\n /** Entity highlight mapping */\n entityHighlightMapping?: EntityHighlightMapping[];\n /** onReply callback */\n onReply: (id: EmailProps['id']) => void;\n /** onForward Callback */\n onForward: (id: EmailProps['id']) => void;\n /** onReply callback */\n onReplyAll?: (id: EmailProps['id']) => void;\n /** List of suggestions */\n suggestions?: Suggestion[];\n /** Callback that triggers on click of tag */\n onSuggestionClick?: (id: EmailProps['id'], suggestionId: Suggestion['id']) => void;\n /** Actions region */\n actions?: ReactNode;\n /** Flag that indicates if email is unread\n * @default false\n */\n unRead?: boolean;\n /** Attachments list */\n attachments?: FileDisplayProps[];\n}\n\nexport interface EmailConversationProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLLIElement>;\n /** Unique ID for this email conversation record */\n id: string;\n /** List of mails */\n emails: EmailProps[];\n /** Sender(s) of this email conversation */\n from: EmailUser;\n /** Recipient(s) of this email conversation */\n to: EmailUser[];\n /** Count of unread emails */\n unReadEmailCount?: number;\n /** Timestamp of this conversation as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | string | number;\n /** Flag that indicates if email conversation is expanded */\n isCollapsed?: boolean;\n /** Flag to set if conversation is spun off from forwarded email */\n isForwarded?: boolean;\n /** Callback when email conversation is collapsed */\n onCollapse?: () => void;\n /** Callback when email conversation is expanded */\n onExpand?: () => void;\n}\n\nexport interface EmailComposerData\n extends Pick<EmailComposerProps, 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments'> {\n /** Array to hold the initial participants that should be default initialized in To address. */\n to: EmailUser['emailAddress'][];\n}\n\nexport type EmailResponseType = 'reply' | 'replyAll' | 'forward';\n\nexport interface EmailDirectRecipients {\n /** To address/addresses in case of reply response type on email. */\n reply: EmailUser['emailAddress'][];\n /** To address/addresses in case of replyAll response type on email. */\n replyAll: EmailUser['emailAddress'][];\n /** To address/addresses in case of forward response type on email. */\n forward?: EmailUser['emailAddress'][];\n}\n\nexport interface EmailComposerProps\n extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>,\n BaseProps,\n NoChildrenProp {\n /** Object containing full list of email participants. */\n participants: EmailUser[];\n /** Object to hold initial to address/addresses based on different action types. */\n to?: EmailDirectRecipients;\n /** Array to hold the initial participants that should be default initialized in Cc address. */\n cc?: EmailUser['emailAddress'][];\n /** Array to hold the initial participants that should be default initialized in Bcc address. */\n bcc?: EmailUser['emailAddress'][];\n /** Object containing the props to render the subject input */\n subject: string;\n /** Body content of the email */\n bodyContent: string;\n /** Callback when email needs to be sent */\n onSend: (data: EmailComposerData) => void;\n /** List of attachments */\n attachments?: FileUploadItemProps[];\n /** Max number of attachments to be allowed in Email composer.\n * If zero is passed, add attachments icon will be hidden. same rule applies if prop is not passed.\n * If attachments added are >= maxAttachments, add attachments icon will be disabled.\n */\n maxAttachments?: number;\n /** Region to show more actions in footer */\n footerMoreActions?: ReactNode;\n /** Templates for drafting email */\n templates?: Record<string, string>;\n /** Callback when cancel composing */\n onCancel: () => void;\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Email action types */\n responseType?: EmailResponseType;\n}\nexport interface EmailShellProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Region for header */\n headerProps?: {\n /** Region for actions */\n actions?: ReactNode;\n /** Subject of the email conversations list */\n subject?: string;\n };\n /** Email conversations */\n conversations?: EmailConversationProps[];\n /** Shows only one conversation at a time */\n autoCollapse?: boolean;\n}\n\nexport interface EmailSummaryItemProps extends BaseProps {\n /** Id of each summary item */\n id: string;\n /** List of from participant names of the conversations */\n activeParticipants: EmailUser[];\n /** Email body of last email in the email */\n message: string;\n /** Timestamp of the latest email */\n timeStamp: Date | string | number;\n /** Top topic of an email */\n topic: string;\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Urgency of an email */\n urgency?: number;\n /** Total number of unread emails in the email */\n unreadEmailCount?: number;\n /** Is the email currently active */\n active?: boolean;\n /** On click of email item */\n onClick: MouseEventHandler;\n /** ref to the element */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport interface Filter {\n /** Sets DOM id for the control and associates label element via 'for' attribute. */\n id: string;\n /** Pass a string or a fragment with an Icon and string for the filter label. */\n label: ReactNode;\n /**\n * Disables the filter.\n * @default false\n */\n disabled?: boolean;\n /**\n * Sets on prop via onFilterChange.\n * @default false\n */\n on?: boolean;\n}\n\nexport interface EmailSummaryListProps extends BaseProps {\n /** List of email categories */\n categories: MenuProps['items'];\n /** Handles category change */\n onCategoryClick?: MenuItemProps['onClick'];\n /** List of EmailItems items */\n items: OmitStrict<EmailSummaryItemProps, 'onClick' | 'active'>[];\n /** Total number of unread email count */\n unreadEmailCount?: number;\n /** A set of filters to apply to the email inbox. */\n filters?: Filter[];\n /** A callback that runs when a filter is clicked. */\n onFilterChange?: (filterId: Filter['id'], on: boolean) => void;\n /** onClick of list item */\n onItemClick: (id: EmailSummaryItemProps['id']) => void;\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface EmailEntityProps extends BaseProps {\n entity: EntityHighlightMapping;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface ViewAnalysisProps extends BaseProps {\n content: {\n name: string;\n value?: {\n id: string;\n entity: EntityHighlightMapping;\n }[];\n }[];\n\n header: {\n icon: string;\n text: string;\n };\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import { Icon
|
|
2
|
+
import { Icon } from '@pega/cosmos-react-core';
|
|
3
3
|
import { EmailComposerProps } from './Email.types';
|
|
4
4
|
export declare const StyledEmailComposer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
declare const EmailComposer: FunctionComponent<EmailComposerProps
|
|
5
|
+
export declare const StyledResponseTypeIcon: typeof Icon;
|
|
6
|
+
export declare const StyledToggleButton: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
declare const EmailComposer: FunctionComponent<EmailComposerProps>;
|
|
8
8
|
export default EmailComposer;
|
|
9
9
|
//# sourceMappingURL=EmailComposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"EmailComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,IAAI,EAUL,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,kBAAkB,EAAa,MAAM,eAAe,CAAC;AAK9D,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAEhD,eAAO,MAAM,sBAAsB,EAAE,OAAO,IAI1C,CAAC;AAIH,eAAO,MAAM,kBAAkB,qNAK7B,CAAC;AAmBH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAmSxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,151 +1,163 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useState, useMemo } from 'react';
|
|
3
|
+
import { forwardRef, useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import Select from '@pega/cosmos-react-core
|
|
6
|
-
import { Button, ComboBox, Flex, Icon, registerIcon, Text, useI18n, Option, defaultThemeProp, FileUploadItem, MenuButton, useConsolidatedRef } from '@pega/cosmos-react-core';
|
|
7
|
-
import Input from '@pega/cosmos-react-core/lib/components/Input/Input';
|
|
5
|
+
import { Button, Flex, Icon, registerIcon, useI18n, Option, defaultThemeProp, FileUploadItem, MenuButton, Select, Input } from '@pega/cosmos-react-core';
|
|
8
6
|
import { RichTextEditor } from '@pega/cosmos-react-rte';
|
|
9
7
|
import * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
const [emailUsers, setEmailUsers] = useState(participants.map((participant) => {
|
|
17
|
-
return {
|
|
18
|
-
...participant,
|
|
19
|
-
selected: defaultSelected.includes(participant.emailAddress)
|
|
20
|
-
};
|
|
21
|
-
}));
|
|
22
|
-
const [emailFilterValue, setEmailFilterValue] = useState('');
|
|
23
|
-
const filterRegex = useMemo(() => getFilterRegex(emailFilterValue), [emailFilterValue]);
|
|
24
|
-
const emailsToRender = useMemo(() => {
|
|
25
|
-
return (emailFilterValue
|
|
26
|
-
? emailUsers.filter(({ emailAddress, fullName, shortName }) => {
|
|
27
|
-
return (filterRegex.test(emailAddress) ||
|
|
28
|
-
filterRegex.test(fullName) ||
|
|
29
|
-
filterRegex.test(shortName));
|
|
30
|
-
})
|
|
31
|
-
: emailUsers).map(({ emailAddress, fullName, selected }) => {
|
|
32
|
-
return {
|
|
33
|
-
id: emailAddress,
|
|
34
|
-
primary: fullName,
|
|
35
|
-
secondary: [emailAddress],
|
|
36
|
-
selected: !!selected
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
}, [emailUsers, filterRegex]);
|
|
40
|
-
const selectedEmailUsers = useMemo(() => {
|
|
41
|
-
return emailUsers
|
|
42
|
-
.filter(emailAddress => emailAddress.selected)
|
|
43
|
-
.map(({ emailAddress }) => {
|
|
44
|
-
return {
|
|
45
|
-
text: emailAddress,
|
|
46
|
-
id: emailAddress
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}, [emailUsers]);
|
|
50
|
-
const toggleSelectedEmailUser = (id) => {
|
|
51
|
-
setEmailUsers(prevEmailUsers => {
|
|
52
|
-
return prevEmailUsers.map(emailUser => {
|
|
53
|
-
if (emailUser.emailAddress === id) {
|
|
54
|
-
return {
|
|
55
|
-
...emailUser,
|
|
56
|
-
selected: !emailUser.selected
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return emailUser;
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
return {
|
|
64
|
-
value: emailFilterValue,
|
|
65
|
-
onChange: (e) => {
|
|
66
|
-
setEmailFilterValue(e.target.value);
|
|
67
|
-
},
|
|
68
|
-
onBlur: () => {
|
|
69
|
-
setEmailFilterValue('');
|
|
70
|
-
},
|
|
71
|
-
menu: {
|
|
72
|
-
items: emailsToRender,
|
|
73
|
-
accent: filterRegex,
|
|
74
|
-
onItemClick: toggleSelectedEmailUser
|
|
75
|
-
},
|
|
76
|
-
selected: {
|
|
77
|
-
items: selectedEmailUsers,
|
|
78
|
-
onRemove: toggleSelectedEmailUser
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
};
|
|
8
|
+
import * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';
|
|
9
|
+
import * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';
|
|
10
|
+
import * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';
|
|
11
|
+
import EmailSelector from './EmailSelector';
|
|
12
|
+
registerIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);
|
|
82
13
|
export const StyledEmailComposer = styled.div ``;
|
|
83
|
-
export const
|
|
14
|
+
export const StyledResponseTypeIcon = styled(Icon)(({ theme }) => {
|
|
84
15
|
return css `
|
|
85
16
|
color: ${theme.base.palette.interactive};
|
|
86
17
|
`;
|
|
87
18
|
});
|
|
88
|
-
|
|
89
|
-
export const
|
|
19
|
+
StyledResponseTypeIcon.defaultProps = defaultThemeProp;
|
|
20
|
+
export const StyledToggleButton = styled(Button)(({ theme }) => {
|
|
90
21
|
return css `
|
|
91
22
|
margin-block-start: calc(2 * ${theme.base.spacing});
|
|
92
23
|
color: ${theme.base.palette.interactive};
|
|
93
24
|
`;
|
|
94
25
|
});
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
26
|
+
StyledToggleButton.defaultProps = defaultThemeProp;
|
|
27
|
+
const responseTypeIcons = {
|
|
28
|
+
reply: 'reply',
|
|
29
|
+
replyAll: 'reply-all',
|
|
30
|
+
forward: 'forward'
|
|
31
|
+
};
|
|
32
|
+
const rteToolbar = [
|
|
33
|
+
'inline-styling',
|
|
34
|
+
'headers',
|
|
35
|
+
'lists',
|
|
36
|
+
'images',
|
|
37
|
+
'cut-copy-paste',
|
|
38
|
+
'indentation'
|
|
39
|
+
];
|
|
40
|
+
const EmailComposer = forwardRef(({ participants, cc, bcc, bodyContent, maxAttachments = 0, onCancel, onSend, to, footerMoreActions, templates, ...restProps }, ref) => {
|
|
41
|
+
const t = useI18n();
|
|
42
|
+
const [responseType, setResponseType] = useState(restProps.responseType);
|
|
43
|
+
const [showCC, setShowCC] = useState(restProps.responseType !== 'reply' && !!cc && cc.length > 0);
|
|
44
|
+
const [showBCC, setShowBCC] = useState(restProps.responseType !== 'reply' && !!bcc && bcc.length > 0);
|
|
45
|
+
const [subject, setSubject] = useState(restProps.subject);
|
|
46
|
+
const [autoReplyTemplate, setAutoReplyTemplate] = useState('');
|
|
47
|
+
const [attachments, setAttachments] = useState(restProps.attachments || []);
|
|
48
|
+
const rteEditorRef = useRef(null);
|
|
49
|
+
const fileUploadInputRef = useRef(null);
|
|
50
|
+
// inserts selected template in RTE
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (templates?.[autoReplyTemplate]) {
|
|
53
|
+
rteEditorRef?.current?.clear();
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
rteEditorRef?.current?.insertHtml(templates?.[autoReplyTemplate], false);
|
|
56
|
+
}, 0);
|
|
57
|
+
}
|
|
58
|
+
}, [autoReplyTemplate]);
|
|
59
|
+
// resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);
|
|
62
|
+
setShowBCC(responseType === 'replyAll' && !!bcc && bcc?.length > 0 ? !!bcc : false);
|
|
63
|
+
}, [responseType]);
|
|
64
|
+
const templateOptions = useMemo(() => templates && Object.keys(templates).map(option => _jsx(Option, { children: option }, option)), [templates]);
|
|
65
|
+
const responseTypeMenuData = useMemo(() => {
|
|
66
|
+
const menuItems = [
|
|
67
|
+
{
|
|
68
|
+
id: 'reply',
|
|
69
|
+
primary: t('reply'),
|
|
70
|
+
visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.reply }, void 0),
|
|
71
|
+
selected: responseType === 'reply',
|
|
72
|
+
onClick: () => {
|
|
73
|
+
setResponseType('reply');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'replyAll',
|
|
78
|
+
primary: t('reply_all'),
|
|
79
|
+
visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.replyAll }, void 0),
|
|
80
|
+
selected: responseType === 'replyAll',
|
|
81
|
+
onClick: () => {
|
|
82
|
+
setResponseType('replyAll');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
return {
|
|
87
|
+
menuItems,
|
|
88
|
+
selectedResponseType: menuItems.find(item => item.selected)?.primary || menuItems[0].primary,
|
|
89
|
+
selectedResponseTypeIcon: (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply
|
|
90
|
+
};
|
|
91
|
+
}, [responseType]);
|
|
92
|
+
const onImageAdded = (image, id) => {
|
|
93
|
+
const src = URL.createObjectURL(image);
|
|
94
|
+
rteEditorRef.current?.appendImage({ src, alt: image.name }, id);
|
|
109
95
|
};
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
const onSubjectChange = useCallback((e) => {
|
|
97
|
+
setSubject(e.target.value);
|
|
98
|
+
}, []);
|
|
99
|
+
const onTemplateChange = useCallback((e) => {
|
|
100
|
+
setAutoReplyTemplate(e.target.value);
|
|
101
|
+
}, []);
|
|
102
|
+
const onAttachmentDelete = useCallback((name) => {
|
|
103
|
+
setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));
|
|
104
|
+
}, []);
|
|
105
|
+
const onFileChange = useCallback((e) => {
|
|
106
|
+
if (e.target.files) {
|
|
107
|
+
setAttachments(prevAttachments => [
|
|
108
|
+
...prevAttachments,
|
|
109
|
+
...Array.from(e.target.files).map(file => ({
|
|
110
|
+
name: file.name,
|
|
111
|
+
file
|
|
112
|
+
}))
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
const [toAddresses, setToAddresses] = useState(to?.[responseType] || []);
|
|
117
|
+
const [ccAddresses, setCcAddresses] = useState(cc);
|
|
118
|
+
const [bccAddresses, setBccAddresses] = useState(bcc);
|
|
119
|
+
const selectedItems = (selections, label) => {
|
|
120
|
+
if (label === 'To') {
|
|
121
|
+
setToAddresses(selections);
|
|
122
|
+
}
|
|
123
|
+
if (label === 'Cc') {
|
|
124
|
+
setCcAddresses(selections);
|
|
125
|
+
}
|
|
126
|
+
if (label === 'Bcc') {
|
|
127
|
+
setBccAddresses(selections);
|
|
115
128
|
}
|
|
116
129
|
};
|
|
117
|
-
const
|
|
118
|
-
|
|
130
|
+
const handleSend = useCallback(() => {
|
|
131
|
+
onSend({
|
|
132
|
+
to: toAddresses,
|
|
133
|
+
cc: showCC ? ccAddresses : undefined,
|
|
134
|
+
bcc: showBCC ? bccAddresses : undefined,
|
|
135
|
+
subject,
|
|
136
|
+
bodyContent: rteEditorRef.current?.getHtml() || '',
|
|
137
|
+
attachments
|
|
138
|
+
});
|
|
139
|
+
}, [toAddresses, ccAddresses, bccAddresses, subject, attachments, showCC, showBCC]);
|
|
140
|
+
return (_jsxs(Flex, { as: StyledEmailComposer, ref: ref, ...restProps, container: {
|
|
119
141
|
gap: 2,
|
|
120
142
|
direction: 'column'
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
id: 'reply all',
|
|
126
|
-
visual: _jsx(StyledReplyIcon, { name: 'reply-all' }, void 0),
|
|
127
|
-
onClick: onReplyAll
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
primary: t('reply'),
|
|
131
|
-
id: 'reply',
|
|
132
|
-
visual: _jsx(StyledReplyIcon, { name: 'reply' }, void 0),
|
|
133
|
-
onClick: onReply
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
} }, void 0) }, void 0), _jsxs(Flex, Object.assign({ container: {
|
|
143
|
+
}, children: [_jsx("div", { children: responseType !== 'forward' && (_jsx(MenuButton, { text: responseTypeMenuData.selectedResponseType, variant: 'link', icon: responseTypeMenuData.selectedResponseTypeIcon, menu: {
|
|
144
|
+
mode: 'single-select',
|
|
145
|
+
items: responseTypeMenuData.menuItems
|
|
146
|
+
} }, void 0)) }, void 0), _jsxs(Flex, { container: {
|
|
137
147
|
alignItems: 'start',
|
|
138
148
|
gap: 0.5
|
|
139
|
-
}
|
|
149
|
+
}, children: [_jsx(Flex, { container: {
|
|
140
150
|
gap: 1,
|
|
141
151
|
direction: 'column'
|
|
142
152
|
}, item: {
|
|
143
153
|
grow: 1
|
|
144
|
-
}
|
|
154
|
+
}, children: _jsx(EmailSelector, { participants: participants, defaultSelections: to?.[responseType], label: t('to'), mode: 'multi-select', required: true, selections: selectedItems }, void 0) }, void 0), !showCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowCC(true), icon: true, children: t('cc') }, void 0)), !showBCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowBCC(true), icon: true, children: t('bcc') }, void 0))] }, void 0), showCC && (_jsx(EmailSelector, { participants: participants, defaultSelections: cc, label: t('cc'), mode: 'multi-select', selections: selectedItems }, void 0)), showBCC && (_jsx(EmailSelector, { selections: selectedItems, participants: participants, defaultSelections: bcc, label: t('bcc'), mode: 'multi-select' }, void 0)), _jsx(Input, { value: subject, onChange: onSubjectChange, label: t('subject') }, void 0), _jsx(Select, { onChange: onTemplateChange, label: t('auto_reply'), value: autoReplyTemplate, children: _jsxs(_Fragment, { children: [_jsx(Option, { children: t('insert') }, void 0), templateOptions] }, void 0) }, void 0), _jsx(RichTextEditor, { autoFocus: true, ref: rteEditorRef, toolbar: rteToolbar, onImageAdded: onImageAdded, labelHidden: true, label: t('email_message'), defaultValue: bodyContent }, void 0), attachments.length > 0 && (_jsx(Flex, { container: { gap: 1, wrap: 'wrap' }, children: attachments.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name, onDelete: onAttachmentDelete }))) }, void 0)), _jsxs(Flex, { container: {
|
|
145
155
|
gap: 1
|
|
146
|
-
}
|
|
156
|
+
}, children: [_jsxs(Flex, { container: true, item: { grow: 1 }, children: [_jsx(Button, { variant: 'secondary', onClick: onCancel, children: t('cancel') }, void 0), footerMoreActions] }, void 0), _jsxs(Flex, { container: true, children: [maxAttachments > 0 && (_jsx(Button, { onClick: attachments.length < maxAttachments
|
|
157
|
+
? () => fileUploadInputRef.current?.click()
|
|
158
|
+
: undefined, variant: 'link', label: attachments.length >= maxAttachments
|
|
147
159
|
? t('email_disable_attachment', [maxAttachments])
|
|
148
|
-
: t('email_add_attachment', [maxAttachments])
|
|
160
|
+
: t('email_add_attachment', [maxAttachments]), children: _jsx(Icon, { name: 'paper-clip' }, void 0) }, void 0)), _jsx(Button, { variant: 'primary', onClick: handleSend, children: t('send') }, void 0)] }, void 0)] }, void 0), _jsx("input", { type: 'file', style: { display: 'none' }, ref: fileUploadInputRef, onChange: onFileChange }, void 0)] }, void 0));
|
|
149
161
|
});
|
|
150
162
|
export default EmailComposer;
|
|
151
163
|
//# sourceMappingURL=EmailComposer.js.map
|