@pega/cosmos-react-social 8.0.0-build.9.0 → 8.0.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/Autopilot/Autopilot.d.ts.map +1 -1
- package/lib/components/Autopilot/Autopilot.js +2 -2
- package/lib/components/Autopilot/Autopilot.js.map +1 -1
- package/lib/components/Chat/Chat.d.ts +3 -3
- package/lib/components/Chat/Chat.d.ts.map +1 -1
- package/lib/components/Chat/Chat.js +1 -2
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/Chat.types.d.ts +3 -1
- package/lib/components/Chat/Chat.types.d.ts.map +1 -1
- package/lib/components/Chat/Chat.types.js.map +1 -1
- package/lib/components/Chat/ChatBody.d.ts +2 -3
- package/lib/components/Chat/ChatBody.d.ts.map +1 -1
- package/lib/components/Chat/ChatBody.js +6 -8
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts +4 -4
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +15 -25
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +4 -3
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +3 -4
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.js +5 -2
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -1
- package/lib/components/Chat/Message.d.ts +2 -3
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +6 -5
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +2 -2
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +11 -3
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +3 -3
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +3 -3
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.d.ts +2 -3
- package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
- package/lib/components/Chat/SystemMessage.js +1 -2
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.d.ts +2 -3
- package/lib/components/Chat/TypeIndicator.d.ts.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +1 -2
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Email/ContextMenuPopover.d.ts +1 -2
- package/lib/components/Email/ContextMenuPopover.d.ts.map +1 -1
- package/lib/components/Email/ContextMenuPopover.js.map +1 -1
- package/lib/components/Email/Email.d.ts +2 -3
- package/lib/components/Email/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +11 -4
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +4 -4
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +6 -3
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +16 -17
- 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/EmailCaseView.js +1 -1
- package/lib/components/Email/EmailCaseView.js.map +1 -1
- package/lib/components/Email/EmailComposer.d.ts +3 -4
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +29 -8
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts +6 -7
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +2 -2
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailEntity.d.ts +2 -3
- package/lib/components/Email/EmailEntity.d.ts.map +1 -1
- package/lib/components/Email/EmailEntity.js.map +1 -1
- package/lib/components/Email/EmailSelector.d.ts +6 -2
- package/lib/components/Email/EmailSelector.d.ts.map +1 -1
- package/lib/components/Email/EmailSelector.js +25 -29
- package/lib/components/Email/EmailSelector.js.map +1 -1
- package/lib/components/Email/EmailShell.d.ts +2 -3
- package/lib/components/Email/EmailShell.d.ts.map +1 -1
- package/lib/components/Email/EmailShell.js +1 -1
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +3 -7
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +26 -26
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts +2 -3
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +17 -9
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/EntityList.d.ts +1 -3
- package/lib/components/Email/EntityList.d.ts.map +1 -1
- package/lib/components/Email/EntityList.js.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.js +3 -5
- package/lib/components/Email/utils/EntityHighlighter.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +4 -49
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js +1 -5
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts +1 -3
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +15 -23
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/Feed.types.d.ts +190 -252
- package/lib/components/Feed/Feed.types.d.ts.map +1 -1
- package/lib/components/Feed/Feed.types.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts +2 -3
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +12 -19
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedContent.d.ts +2 -3
- package/lib/components/Feed/FeedContent.d.ts.map +1 -1
- package/lib/components/Feed/FeedContent.js +5 -43
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedContentFooter.d.ts.map +1 -1
- package/lib/components/Feed/FeedContentFooter.js +2 -15
- package/lib/components/Feed/FeedContentFooter.js.map +1 -1
- package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -1
- package/lib/components/Feed/FeedContentHeader.js +76 -44
- package/lib/components/Feed/FeedContentHeader.js.map +1 -1
- package/lib/components/Feed/FeedCustomEditRegion.d.ts +6 -0
- package/lib/components/Feed/FeedCustomEditRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedCustomEditRegion.js +20 -0
- package/lib/components/Feed/FeedCustomEditRegion.js.map +1 -0
- package/lib/components/Feed/FeedCustomInputRegion.d.ts +6 -0
- package/lib/components/Feed/FeedCustomInputRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedCustomInputRegion.js +38 -0
- package/lib/components/Feed/FeedCustomInputRegion.js.map +1 -0
- package/lib/components/Feed/FeedEditRegion.d.ts +1 -2
- package/lib/components/Feed/FeedEditRegion.d.ts.map +1 -1
- package/lib/components/Feed/FeedEditRegion.js +41 -14
- package/lib/components/Feed/FeedEditRegion.js.map +1 -1
- package/lib/components/Feed/FeedInputRegion.d.ts +0 -1
- package/lib/components/Feed/FeedInputRegion.d.ts.map +1 -1
- package/lib/components/Feed/FeedInputRegion.js +53 -40
- package/lib/components/Feed/FeedInputRegion.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +2 -2
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +5 -5
- package/lib/components/Feed/FeedLikeButton.js.map +1 -1
- package/lib/components/Feed/FeedModalList.d.ts.map +1 -1
- package/lib/components/Feed/FeedModalList.js +6 -7
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts +1 -2
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +44 -14
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts +2 -3
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +50 -28
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts +1 -2
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +24 -5
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +1 -2
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +4 -5
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts +3 -3
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +16 -8
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/components/Feed/FeedRichTextViewer.d.ts +10 -0
- package/lib/components/Feed/FeedRichTextViewer.d.ts.map +1 -0
- package/lib/components/Feed/FeedRichTextViewer.js +38 -0
- package/lib/components/Feed/FeedRichTextViewer.js.map +1 -0
- package/lib/components/Feed/FeedVisibilityControls.d.ts +4 -0
- package/lib/components/Feed/FeedVisibilityControls.d.ts.map +1 -0
- package/lib/components/Feed/FeedVisibilityControls.js +62 -0
- package/lib/components/Feed/FeedVisibilityControls.js.map +1 -0
- package/lib/components/Feed/MarkdownSyntax.d.ts +3 -0
- package/lib/components/Feed/MarkdownSyntax.d.ts.map +1 -0
- package/lib/components/Feed/MarkdownSyntax.js +66 -0
- package/lib/components/Feed/MarkdownSyntax.js.map +1 -0
- package/lib/components/Feed/index.d.ts +3 -1
- package/lib/components/Feed/index.d.ts.map +1 -1
- package/lib/components/Feed/index.js +2 -0
- package/lib/components/Feed/index.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.js +2 -2
- package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +2 -2
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/lib/components/OpenGraphPreview/OpenGraphPreview.d.ts +27 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.js +39 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.js.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.d.ts +13 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.js +79 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.js.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.d.ts +3 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.js +4 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.js.map +1 -0
- package/lib/components/OpenGraphPreview/index.d.ts +3 -0
- package/lib/components/OpenGraphPreview/index.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/index.js +2 -0
- package/lib/components/OpenGraphPreview/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +10 -10
- package/lib/components/Feed/FeedAnnouncer.d.ts +0 -6
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.js +0 -11
- package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -5
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -375
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAIlF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE7C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC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AgB,CAAC;AAKvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAyB,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;;;sBAGU,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;;;sBAG7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;;mCAGxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;kBAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;uBAEhC,KAAK;;;GAGzB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EACjD,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,MAAM,EAAE,EACpB,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;aACC,MAAM;GAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,OAAO,GAAG,CAAA;;oCAEwB,KAAK,CAAC,IAAI,CAAC,OAAO;GACnD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { rgba, transparentize } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledIcon,\n StyledText,\n calculateFontSize,\n Link,\n StyledLink,\n readableColor\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport type { MessageProps } from './Chat.types';\n\nexport const StyledMessageBubbleContent = styled.div``;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledMediaMessage = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img`\n cursor: pointer;\n`;\n\nexport const StyledMediaLink = styled(Link)``;\n\nexport const StyledMessageMain = styled.div``;\n\nexport const StyledMessageBubble = styled.div``;\n\nexport const StyledMetaInfoContainer = styled.div``;\n\nexport const StyledMetaInfo = styled.span``;\n\nexport const StyledStatusInfo = styled.span``;\n\nexport const StyledTypingIndicator = styled.div``;\n\nexport const StyledMessageHeader = styled.header``;\nexport const StyledMessageHeaderContent = styled.div``;\nexport const StyledMessageHeaderMeta = styled.div``;\n\nexport const StyledHeadsetIconBackground = styled.div``;\n\nexport const StyledMediaContent = styled.div``;\n\nexport const StyledMediaButton = styled(BareButton)`\n text-align: start;\n`;\n\ninterface StyledMessageContainerProps {\n senderType: 'customer' | 'agent' | 'bot';\n direction: 'in' | 'out';\n typing: boolean;\n hasMessage: boolean;\n status: string;\n agentVariant: number;\n}\n\nexport const StyledHeadset = styled.div(({ theme }) => {\n return css`\n position: relative;\n\n ${StyledHeadsetIconBackground} {\n position: relative;\n inset-block-start: calc(-5.25 * ${theme.base.spacing});\n inset-inline-start: calc(2 * ${theme.base.spacing});\n height: 1.375rem;\n width: 1.375rem;\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(\n (${theme.base['border-radius']}) * (${theme.components.button['border-radius']})\n );\n\n ${StyledIcon} {\n position: absolute;\n width: 2.875rem;\n height: 0.875rem;\n inset-inline-start: calc(-1.5 * ${theme.base.spacing});\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledHeadset.defaultProps = defaultThemeProp;\n\nexport interface MessageBubbleColor {\n header: string;\n content: string;\n}\n\nexport const getMessageColors: (\n theme: DefaultTheme,\n direction: MessageProps['direction'],\n senderType: MessageProps['senderType'],\n agentVariant: MessageProps['agentVariant']\n) => MessageBubbleColor = (theme, direction, senderType, agentVariant = 0) => {\n const { slate, blue, purple, orange, green, black } = theme.base.colors;\n const agentMessageColors = [\n purple['extra-light'],\n orange['extra-light'],\n '#C5D1DD',\n green['extra-light'],\n '#BBEAEA'\n ];\n const outMessageColor = blue.medium;\n const customerMessageColor = '#E6EEFA';\n const botMessageColor = slate['extra-dark'];\n\n if (direction === 'in') {\n const messageColors: MessageBubbleColor = {\n header: orange.medium,\n content: ''\n };\n if (senderType === 'agent') {\n messageColors.content = agentMessageColors[agentVariant % agentMessageColors.length];\n } else if (senderType === 'bot') {\n messageColors.content = botMessageColor;\n } else if (senderType === 'customer') {\n messageColors.content = customerMessageColor;\n }\n return messageColors;\n }\n return {\n header: black,\n content: outMessageColor\n };\n};\n\nexport const StyledMessageContainer = styled.li<StyledMessageContainerProps>(\n ({\n direction,\n senderType,\n hasMessage,\n typing,\n status,\n agentVariant,\n theme,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': borderRadius,\n spacing,\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground,\n urgent\n },\n transparency: { 'transparent-2': foregroundAlpha }\n }\n }\n }) => {\n const { header, content } = getMessageColors(theme, direction, senderType, agentVariant);\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n const statusForegroundColor = status === 'undeliverable' ? urgent : metaForegroundColor;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const contrastContentColor = readableColor(content);\n const contrastHeaderColor = readableColor(header);\n return css`\n ${direction === 'out'\n ? css`\n padding-inline-start: calc(4 * ${spacing});\n `\n : css`\n padding-inline-end: calc(4 * ${spacing});\n `}\n margin-block-end: ${typing ? spacing : '0'};\n\n :first-child {\n margin-block-start: ${spacing};\n }\n\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n background: ${content};\n border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})\n calc(3 * ${borderRadius});\n overflow: hidden;\n color: ${contrastContentColor};\n display: inline-block;\n width: auto;\n margin-block-end: calc(0.5 * ${spacing});\n\n label {\n color: inherit;\n }\n\n ${direction === 'in' &&\n css`\n border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: ${spacing} calc(2 * ${spacing});\n word-break: break-word;\n white-space: pre-wrap;\n position: relative;\n }\n\n > ${StyledMediaList} {\n color: ${contrastContentColor};\n max-width: 100%;\n\n > ${StyledMediaListItem} {\n position: relative;\n ${StyledMediaThumbNail} {\n max-height: 12rem;\n width: 100%;\n object-fit: contain;\n background-color: ${secondaryBackground};\n }\n ${StyledMediaMessage} {\n padding: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledMediaMessage}::before {\n content: '';\n padding: ${spacing} 0;\n border-top: 0.0625rem solid ${contrastContentColor};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledMediaMessage}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n ${StyledText} {\n color: ${foregroundColor};\n }\n ${StyledLink} {\n color: ${contrastContentColor};\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledMediaMessage}::before {\n border-top: none;\n }\n }\n `}\n }\n\n ${StyledMessageHeader} {\n padding: ${spacing} calc(2 * ${spacing});\n color: ${contrastHeaderColor};\n border-block-end: 0.0625rem solid ${transparentize(0.5, theme.base.colors.white)};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${contrastHeaderColor};\n margin-inline-end: ${spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${contrastHeaderColor};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${contrastContentColor};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n\n &:hover {\n color: ${contrastContentColor};\n text-decoration: underline;\n }\n &:visited {\n color: ${contrastContentColor};\n }\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n ${StyledMetaInfoContainer} {\n width: 100%;\n padding: 0 ${spacing};\n ${StyledMetaInfo}, ${StyledStatusInfo} {\n margin-block-end: ${spacing};\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n ${StyledStatusInfo} {\n color: ${statusForegroundColor};\n }\n }\n ${StyledTypingIndicator} {\n width: 4.5rem;\n position: relative;\n height: 2rem;\n }\n\n ${StyledMediaContent} {\n padding-block-end: calc(0.5 * ${spacing});\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n word-break: break-word;\n white-space: pre-wrap;\n }\n }\n `;\n }\n);\nStyledMessageContainer.defaultProps = defaultThemeProp;\ninterface StyledBlinkingDotProps {\n delay?: number;\n}\n\nexport const StyledBlinkingDot = styled.div<StyledBlinkingDotProps>(({ delay = 0, theme }) => {\n return css`\n @keyframes Blinking {\n 0% {\n background: ${theme.base.colors.gray.medium};\n }\n 100% {\n background: ${theme.base.colors.gray['extra-light']};\n }\n }\n animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;\n background: ${theme.base.colors.gray['extra-light']};\n border-radius: 50%;\n animation-delay: ${delay}s;\n height: 0.4rem;\n width: 0.4rem;\n `;\n});\nStyledBlinkingDot.defaultProps = defaultThemeProp;\n\nexport const StyledUndeliveredIcon = styled(Icon)(({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n}) => {\n return css`\n color: ${urgent};\n `;\n});\n\nStyledUndeliveredIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFlagIcon = styled(Icon)(({ theme }) => {\n return css`\n position: relative;\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledFlagIcon.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Message.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4EAA4E,CAAC;AAInH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA;IAChD,qBAAqB;;;;;;CAMxB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE7C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEpD,MAAM,CAAC,M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,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;;;sBAGU,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;;;sBAG7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;;mCAGxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;kBAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;uBAEhC,KAAK;;;GAGzB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EACjD,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,MAAM,EAAE,EACpB,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;aACC,MAAM;GAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,OAAO,GAAG,CAAA;;oCAEwB,KAAK,CAAC,IAAI,CAAC,OAAO;GACnD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { rgba, transparentize } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledIcon,\n StyledText,\n calculateFontSize,\n Link,\n StyledLink,\n readableColor\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';\n\nimport type { MessageProps } from './Chat.types';\n\nexport const StyledMessageBubbleContent = styled.div`\n ${StyledEditorContainer} {\n padding: 0;\n a {\n color: inherit;\n }\n }\n`;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledMediaMessage = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img`\n cursor: pointer;\n`;\n\nexport const StyledMediaLink = styled(Link)``;\n\nexport const StyledMessageMain = styled.div``;\n\nexport const StyledMessageBubble = styled.div``;\n\nexport const StyledMetaInfoContainer = styled.div``;\n\nexport const StyledMetaInfo = styled.span``;\n\nexport const StyledStatusInfo = styled.span``;\n\nexport const StyledTypingIndicator = styled.div``;\n\nexport const StyledMessageHeader = styled.header``;\nexport const StyledMessageHeaderContent = styled.div``;\nexport const StyledMessageHeaderMeta = styled.div``;\n\nexport const StyledHeadsetIconBackground = styled.div``;\n\nexport const StyledMediaContent = styled.div``;\n\nexport const StyledMediaButton = styled(BareButton)`\n text-align: start;\n`;\n\ninterface StyledMessageContainerProps {\n senderType: 'customer' | 'agent' | 'bot';\n direction: 'in' | 'out';\n typing: boolean;\n hasMessage: boolean;\n status: string;\n agentVariant: number;\n}\n\nexport const StyledHeadset = styled.div(({ theme }) => {\n return css`\n position: relative;\n\n ${StyledHeadsetIconBackground} {\n position: relative;\n inset-block-start: calc(-5.25 * ${theme.base.spacing});\n inset-inline-start: calc(2 * ${theme.base.spacing});\n height: 1.375rem;\n width: 1.375rem;\n background: ${theme.base.palette['primary-background']};\n border-radius: calc(\n (${theme.base['border-radius']}) * (${theme.components.button['border-radius']})\n );\n\n ${StyledIcon} {\n position: absolute;\n width: 2.875rem;\n height: 0.875rem;\n inset-inline-start: calc(-1.5 * ${theme.base.spacing});\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledHeadset.defaultProps = defaultThemeProp;\n\nexport interface MessageBubbleColor {\n header: string;\n content: string;\n}\n\nexport const getMessageColors: (\n theme: DefaultTheme,\n direction: MessageProps['direction'],\n senderType: MessageProps['senderType'],\n agentVariant: MessageProps['agentVariant']\n) => MessageBubbleColor = (theme, direction, senderType, agentVariant = 0) => {\n const { slate, blue, purple, orange, green, black } = theme.base.colors;\n const agentMessageColors = [\n purple['extra-light'],\n orange['extra-light'],\n '#C5D1DD',\n green['extra-light'],\n '#BBEAEA'\n ];\n const outMessageColor = blue.medium;\n const customerMessageColor = '#E6EEFA';\n const botMessageColor = slate['extra-dark'];\n\n if (direction === 'in') {\n const messageColors: MessageBubbleColor = {\n header: orange.medium,\n content: ''\n };\n if (senderType === 'agent') {\n messageColors.content = agentMessageColors[agentVariant % agentMessageColors.length];\n } else if (senderType === 'bot') {\n messageColors.content = botMessageColor;\n } else if (senderType === 'customer') {\n messageColors.content = customerMessageColor;\n }\n return messageColors;\n }\n return {\n header: black,\n content: outMessageColor\n };\n};\n\nexport const StyledMessageContainer = styled.li<StyledMessageContainerProps>(\n ({\n direction,\n senderType,\n hasMessage,\n typing,\n status,\n agentVariant,\n theme,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': borderRadius,\n spacing,\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground,\n urgent\n },\n transparency: { 'transparent-2': foregroundAlpha }\n }\n }\n }) => {\n const { header, content } = getMessageColors(theme, direction, senderType, agentVariant);\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n const statusForegroundColor = status === 'undeliverable' ? urgent : metaForegroundColor;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n const contrastContentColor = readableColor(content);\n const contrastHeaderColor = readableColor(header);\n return css`\n ${direction === 'out'\n ? css`\n padding-inline-start: calc(4 * ${spacing});\n `\n : css`\n padding-inline-end: calc(4 * ${spacing});\n `}\n margin-block-end: ${typing ? spacing : '0'};\n\n :first-child {\n margin-block-start: ${spacing};\n }\n\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n background: ${content};\n border-radius: min(calc(3 * ${borderRadius}), 1.5rem) min(${borderRadius}, 0.5rem)\n min(calc(3 * ${borderRadius}), 1.5rem) min(calc(3 * ${borderRadius}), 1.5rem);\n overflow: hidden;\n color: ${contrastContentColor};\n display: inline-block;\n width: auto;\n margin-block-end: calc(0.5 * ${spacing});\n\n label {\n color: inherit;\n }\n\n ${direction === 'in' &&\n css`\n border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: ${spacing} calc(2 * ${spacing});\n word-break: break-word;\n white-space: pre-wrap;\n position: relative;\n }\n\n > ${StyledMediaList} {\n color: ${contrastContentColor};\n max-width: 100%;\n\n > ${StyledMediaListItem} {\n position: relative;\n ${StyledMediaThumbNail} {\n max-height: 12rem;\n width: 100%;\n object-fit: contain;\n background-color: ${secondaryBackground};\n }\n ${StyledMediaMessage} {\n padding: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledMediaMessage}::before {\n content: '';\n padding: ${spacing} 0;\n border-top: 0.0625rem solid ${contrastContentColor};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledMediaMessage}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n ${StyledText} {\n color: ${foregroundColor};\n }\n ${StyledLink} {\n color: ${contrastContentColor};\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledMediaMessage}::before {\n border-top: none;\n }\n }\n `}\n }\n\n ${StyledMessageHeader} {\n padding: ${spacing} calc(2 * ${spacing});\n color: ${contrastHeaderColor};\n border-block-end: 0.0625rem solid ${transparentize(0.5, theme.base.colors.white)};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${contrastHeaderColor};\n margin-inline-end: ${spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${contrastHeaderColor};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${contrastContentColor};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n\n &:hover {\n color: ${contrastContentColor};\n text-decoration: underline;\n }\n &:visited {\n color: ${contrastContentColor};\n }\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n ${StyledMetaInfoContainer} {\n width: 100%;\n padding: 0 ${spacing};\n ${StyledMetaInfo}, ${StyledStatusInfo} {\n margin-block-end: ${spacing};\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n ${StyledStatusInfo} {\n color: ${statusForegroundColor};\n }\n }\n ${StyledTypingIndicator} {\n width: 4.5rem;\n position: relative;\n height: 2rem;\n }\n\n ${StyledMediaContent} {\n padding-block-end: calc(0.5 * ${spacing});\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n word-break: break-word;\n white-space: pre-wrap;\n }\n }\n `;\n }\n);\nStyledMessageContainer.defaultProps = defaultThemeProp;\ninterface StyledBlinkingDotProps {\n delay?: number;\n}\n\nexport const StyledBlinkingDot = styled.div<StyledBlinkingDotProps>(({ delay = 0, theme }) => {\n return css`\n @keyframes Blinking {\n 0% {\n background: ${theme.base.colors.gray.medium};\n }\n 100% {\n background: ${theme.base.colors.gray['extra-light']};\n }\n }\n animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;\n background: ${theme.base.colors.gray['extra-light']};\n border-radius: 50%;\n animation-delay: ${delay}s;\n height: 0.4rem;\n width: 0.4rem;\n `;\n});\nStyledBlinkingDot.defaultProps = defaultThemeProp;\n\nexport const StyledUndeliveredIcon = styled(Icon)(({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n}) => {\n return css`\n color: ${urgent};\n `;\n});\n\nStyledUndeliveredIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFlagIcon = styled(Icon)(({ theme }) => {\n return css`\n position: relative;\n inset-block-start: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledFlagIcon.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { ForwardRefForwardPropsComponent, OmitStrict } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { ChatComposerProps } from './ChatComposer';
|
|
4
4
|
export declare const StyledSuggestedReplyHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
5
|
export declare const StyledSuggestedReplyContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -48,6 +48,6 @@ export interface SuggestedReplyPickerProps extends Pick<ChatComposerProps, 'onSe
|
|
|
48
48
|
/** Show notification on picker header */
|
|
49
49
|
showNotification?: boolean;
|
|
50
50
|
}
|
|
51
|
-
declare const SuggestedReplyPicker:
|
|
51
|
+
declare const SuggestedReplyPicker: ForwardRefForwardPropsComponent<SuggestedReplyPickerProps>;
|
|
52
52
|
export default SuggestedReplyPicker;
|
|
53
53
|
//# sourceMappingURL=SuggestedReplyPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAoBlD,OAAO,KAAK,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAO3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,eAAO,MAAM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AAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAUD,QAAA,MAAM,oBAAoB,EAAE,+BAA+B,CAAC,yBAAyB,CA8RpF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/ti
|
|
|
6
6
|
import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
|
|
7
7
|
import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
|
|
8
8
|
import { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';
|
|
9
|
+
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
9
10
|
registerIcon(timesIcon, caretLeftIcon, caretRightIcon);
|
|
10
11
|
export const StyledSuggestedReplyHeader = styled.div ``;
|
|
11
12
|
export const StyledSuggestedReplyContent = styled.div ``;
|
|
@@ -70,8 +71,7 @@ const StyledReplyType = styled(Flex)(({ theme, type }) => {
|
|
|
70
71
|
`;
|
|
71
72
|
});
|
|
72
73
|
StyledReplyType.defaultProps = defaultThemeProp;
|
|
73
|
-
const SuggestedReplyPicker = forwardRef(function SuggestedReplyPicker(
|
|
74
|
-
const { replies = [], collapsed, onExpandCollapse, showNotification, onSelect, currentReplyId, onReplyChange, onSend, maxLength = 256, disabled = false, ...restProps } = props;
|
|
74
|
+
const SuggestedReplyPicker = forwardRef(function SuggestedReplyPicker({ replies = [], collapsed, onExpandCollapse, showNotification, onSelect, currentReplyId, onReplyChange, onSend, maxLength = 256, disabled = false, ...restProps }, ref) {
|
|
75
75
|
const { announcePolite } = useLiveLog();
|
|
76
76
|
const t = useI18n();
|
|
77
77
|
const { rtl, ltr } = useDirection();
|
|
@@ -127,7 +127,7 @@ const SuggestedReplyPicker = forwardRef(function SuggestedReplyPicker(props, ref
|
|
|
127
127
|
if (isReplyErrorState(currentReply)) {
|
|
128
128
|
return (_jsx(Flex, { container: { justify: 'center' }, children: currentReply.errorType === 'noSuggestions' ? (_jsx(EmptyState, { message: currentReply.message })) : (_jsx(ErrorState, { message: currentReply.message })) }));
|
|
129
129
|
}
|
|
130
|
-
return (_jsx(Flex, { container: true, as: StyledReply, children: currentReply.message }));
|
|
130
|
+
return (_jsx(Flex, { container: true, as: StyledReply, children: _jsx(RichTextViewer, { type: 'markdown', content: currentReply.message }) }));
|
|
131
131
|
}
|
|
132
132
|
return null;
|
|
133
133
|
}, [currentReply]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAIlF,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAA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AC,CAAC;4CACL,OAAO,CAAC,MAAM;yCACf,CAAC;wCACJ,CAAC,CAAC,SAAS,YAGd,CAAC,CAAC,MAAM,CAAC,GACH,EACR,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,KAAC,MAAM,IACL,IAAI,sBACQ,CAAC,CAAC,sBAAsB,CAAC,EACrC,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;wCACZ,sBAAsB,CAAC,MAAM,CAAC,CAAC;oCACjC,CAAC,EACD,QAAQ,EAAE,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,YAE7D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,GACpB,CACV,IACI,IACF,GACQ,IACa,CACjC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, useEffect, useMemo } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Icon,\n registerIcon,\n Button,\n Text,\n useI18n,\n defaultThemeProp,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState,\n Progress,\n hasProp,\n ErrorState\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, OmitStrict } from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\n\nimport type { ChatComposerProps } from './ChatComposer';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledReply = styled.div``;\nexport const StyledRepliesAction = styled.div``;\nexport const StyledNotification = styled.div``;\nconst maxNumOfLines = 5;\nconst minNumOfLines = 2;\n\nexport const StyledSuggestedReplyIcon = styled(Icon)<{ suggestedReplyCollapsed?: boolean }>(({\n suggestedReplyCollapsed,\n theme\n}) => {\n const { rtl } = useDirection();\n const {\n base: {\n animation: {\n speed,\n timing: { ease }\n }\n }\n } = theme;\n return css`\n transition-property: transform;\n transition-duration: ${speed};\n transition-timing-function: ${ease};\n ${suggestedReplyCollapsed &&\n css`\n transform: rotateZ(${rtl ? '0deg' : '-90deg'});\n `}\n `;\n});\n\nStyledSuggestedReplyIcon.defaultProps = defaultThemeProp;\n\nconst StyledSuggestedReplyContainer = styled.div(props => {\n const { theme } = props;\n return css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n\n > ${StyledSuggestedReplyHeader} {\n padding: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n ${StyledAlert} {\n position: relative;\n inset-block-start: calc(-0.25 * ${theme.base.spacing});\n inset-inline-start: calc(-0.5 * ${theme.base.spacing});\n }\n\n ${StyledSuggestedReplyContent} {\n padding: calc(2 * ${theme.base.spacing});\n position: relative;\n\n > ${StyledReply} {\n overflow-y: auto;\n max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});\n min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});\n }\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReplyItem {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** type of this suggested reply */\n type: 'dialog' | 'genAIReply';\n}\n\ninterface ReplyLoadingState extends OmitStrict<SuggestedReplyItem, 'message'> {\n /** loading until reply is retrieved */\n loading: boolean;\n}\n\ninterface ReplyErrorState extends SuggestedReplyItem {\n /** If there are no suggestions from GenAI or if there is an error */\n errorType: 'noSuggestions' | 'error';\n}\n\nexport type SuggestedReply = SuggestedReplyItem | ReplyLoadingState | ReplyErrorState;\n\nexport const isReplyLoadingState = (reply: SuggestedReply): reply is ReplyLoadingState => {\n return hasProp(reply, 'loading');\n};\n\nexport const isReplyErrorState = (reply: SuggestedReply): reply is ReplyErrorState => {\n return hasProp(reply, 'errorType');\n};\n\nexport interface SuggestedReplyPickerProps\n extends Pick<ChatComposerProps, 'onSend' | 'maxLength' | 'disabled'> {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Id of the current reply */\n currentReplyId?: SuggestedReply['id'];\n /** Fired when user clicks on left or right buttons\n * @param id Id of the new reply\n */\n onReplyChange: (id: SuggestedReply['id']) => void;\n /** Current state of the panel */\n collapsed: boolean;\n /** Callback for expand or collapse click */\n onExpandCollapse: () => void;\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Show notification on picker header */\n showNotification?: boolean;\n}\n\nconst StyledReplyType = styled(Flex)(({ theme, type }) => {\n return css`\n color: ${type === 'dialog' ? 'inherit' : theme.base.palette.ai};\n `;\n});\n\nStyledReplyType.defaultProps = defaultThemeProp;\n\nconst SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(function SuggestedReplyPicker(\n props: PropsWithoutRef<SuggestedReplyPickerProps>,\n ref: SuggestedReplyPickerProps['ref']\n ) {\n const {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n currentReplyId,\n onReplyChange,\n onSend,\n maxLength = 256,\n disabled = false,\n ...restProps\n } = props;\n const { announcePolite } = useLiveLog();\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n const currentReply = replies.find(reply => reply.id === currentReplyId);\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n\n // Allows suggested replies to cycle\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;\n newReplyIndex = (newReplyIndex + replies.length) % replies.length;\n onReplyChange(replies[newReplyIndex].id);\n };\n\n // SR announcement when current reply changes\n useEffect(() => {\n if (!replies || replies.length === 0 || !currentReplyId) {\n return;\n }\n if (currentReply && !isReplyLoadingState(currentReply))\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n currentReplyIndex + 1,\n replies.length\n ])},${currentReply?.message},${\n currentReply?.type === 'dialog' ? t('dialog') : t('pega_genAI')\n }`,\n type: 'acknowledgement'\n });\n }, [currentReply]);\n\n const onEditAnnouncement = () => {\n announcePolite({\n message: t('suggested_reply_copied_to_input_field'),\n type: 'acknowledgement'\n });\n };\n\n const suggestionType = useMemo(() => {\n if (currentReply && !collapsed) {\n let iconName = '';\n let label;\n if (currentReply.type === 'dialog') {\n iconName = 'script';\n label = t('dialog');\n } else {\n iconName = 'polaris-solid';\n label = t('pega_genAI');\n }\n\n return (\n <StyledReplyType\n container={{ alignItems: 'center', pad: 1, gap: 0.5 }}\n type={currentReply.type}\n >\n <Icon name={iconName} size='s' />\n {label}\n </StyledReplyType>\n );\n }\n\n return null;\n }, [currentReply, collapsed]);\n\n const suggestion = useMemo(() => {\n if (currentReply) {\n if (isReplyLoadingState(currentReply)) {\n return (\n <Progress\n placement='block'\n message={t('loading')}\n liveConfig={{ contextualLabel: `${t('pega_genAI')} ${t('suggestion')}` }}\n />\n );\n }\n\n if (isReplyErrorState(currentReply)) {\n return (\n <Flex container={{ justify: 'center' }}>\n {currentReply.errorType === 'noSuggestions' ? (\n <EmptyState message={currentReply.message} />\n ) : (\n <ErrorState message={currentReply.message} />\n )}\n </Flex>\n );\n }\n\n return (\n <Flex container as={StyledReply}>\n {currentReply.message}\n </Flex>\n );\n }\n\n return null;\n }, [currentReply]);\n\n return (\n <StyledSuggestedReplyContainer ref={ref} {...restProps}>\n <Flex\n as={StyledSuggestedReplyHeader}\n container={{\n justify: 'between',\n alignContent: 'center'\n }}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n >\n {ltr && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n\n <Flex container={{ gap: 0.5 }}>\n <Text variant='h3'>{t('suggested_replies')}</Text>\n {collapsed && showNotification && <Alert variant='urgent' />}\n </Flex>\n\n {!collapsed && replies?.length > 0 && (\n <Text variant='secondary'>{`- ${currentReplyIndex + 1}/${replies.length}`}</Text>\n )}\n\n {rtl && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n </Flex>\n {suggestionType}\n </Flex>\n <ExpandCollapse dimension='height' collapsed={collapsed} nullWhenCollapsed>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReply && replies.length ? (\n suggestion\n ) : (\n <EmptyState message={t('no_suggestion')} />\n )}\n <Flex\n container={{\n justify: 'center'\n }}\n as={StyledRepliesAction}\n >\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReplyId === undefined || replies.length <= 1}\n onClick={() => {\n onSuggestedReplyChange('prev');\n }}\n >\n <Icon name='caret-left' />\n </Button>\n )}\n <Button\n disabled={\n disabled ||\n currentReplyId === undefined ||\n !replies ||\n replies.length === 0 ||\n (currentReply && isReplyLoadingState(currentReply) && currentReply.loading) ||\n (currentReply && isReplyErrorState(currentReply) && !!currentReply.errorType)\n }\n onClick={() => {\n if (\n currentReply &&\n !isReplyErrorState(currentReply) &&\n !isReplyLoadingState(currentReply)\n ) {\n onSelect(currentReply);\n onExpandCollapse();\n onEditAnnouncement();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('edit_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('edit')}\n </Button>\n <Button\n disabled={\n disabled ||\n currentReplyId === undefined ||\n !replies ||\n replies.length === 0 ||\n (!!maxLength && replies.length > maxLength) ||\n (currentReply && isReplyLoadingState(currentReply) && currentReply.loading) ||\n (currentReply && isReplyErrorState(currentReply) && !!currentReply.errorType)\n }\n onClick={() => {\n if (\n currentReply &&\n !isReplyErrorState(currentReply) &&\n !isReplyLoadingState(currentReply)\n ) {\n onSend(currentReply.message);\n onExpandCollapse();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('send_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('send')}\n </Button>\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n onClick={() => {\n onSuggestedReplyChange('next');\n }}\n disabled={currentReplyId === undefined || replies.length <= 1}\n >\n <Icon name='caret-right' />\n </Button>\n )}\n </Flex>\n </Flex>\n </ExpandCollapse>\n </StyledSuggestedReplyContainer>\n );\n });\n\nexport default SuggestedReplyPicker;\n"]}
|
|
1
|
+
{"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,UAAU,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AAiB,CAAC,YAAY,CAAC;4CAChC,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAClC,CAAC;4CACD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;4CAC7B,gBAAgB,EAAE,CAAC;wCACrB,CAAC;oCACH,CAAC,gBAEC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc;wCAClC,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE;4CACzB,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc;gDAClC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,cAAc,CAAC,GAAG,CAAC;gDAC7D,CAAC,CAAC,CAAC;4CACL,OAAO,CAAC,MAAM;yCACf,CAAC;wCACJ,CAAC,CAAC,SAAS,YAGd,CAAC,CAAC,MAAM,CAAC,GACH,EACR,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,KAAC,MAAM,IACL,IAAI,sBACQ,CAAC,CAAC,sBAAsB,CAAC,EACrC,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;wCACZ,sBAAsB,CAAC,MAAM,CAAC,CAAC;oCACjC,CAAC,EACD,QAAQ,EAAE,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,YAE7D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,GACpB,CACV,IACI,IACF,GACQ,IACa,CACjC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, useEffect, useMemo } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Icon,\n registerIcon,\n Button,\n Text,\n useI18n,\n defaultThemeProp,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState,\n Progress,\n hasProp,\n ErrorState\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, OmitStrict } from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\n\nimport type { ChatComposerProps } from './ChatComposer';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledReply = styled.div``;\nexport const StyledRepliesAction = styled.div``;\nexport const StyledNotification = styled.div``;\nconst maxNumOfLines = 5;\nconst minNumOfLines = 2;\n\nexport const StyledSuggestedReplyIcon = styled(Icon)<{ suggestedReplyCollapsed?: boolean }>(({\n suggestedReplyCollapsed,\n theme\n}) => {\n const { rtl } = useDirection();\n const {\n base: {\n animation: {\n speed,\n timing: { ease }\n }\n }\n } = theme;\n return css`\n transition-property: transform;\n transition-duration: ${speed};\n transition-timing-function: ${ease};\n ${suggestedReplyCollapsed &&\n css`\n transform: rotateZ(${rtl ? '0deg' : '-90deg'});\n `}\n `;\n});\n\nStyledSuggestedReplyIcon.defaultProps = defaultThemeProp;\n\nconst StyledSuggestedReplyContainer = styled.div(props => {\n const { theme } = props;\n return css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n\n > ${StyledSuggestedReplyHeader} {\n padding: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n ${StyledAlert} {\n position: relative;\n inset-block-start: calc(-0.25 * ${theme.base.spacing});\n inset-inline-start: calc(-0.5 * ${theme.base.spacing});\n }\n\n ${StyledSuggestedReplyContent} {\n padding: calc(2 * ${theme.base.spacing});\n position: relative;\n\n > ${StyledReply} {\n overflow-y: auto;\n max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});\n min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});\n }\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReplyItem {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** type of this suggested reply */\n type: 'dialog' | 'genAIReply';\n}\n\ninterface ReplyLoadingState extends OmitStrict<SuggestedReplyItem, 'message'> {\n /** loading until reply is retrieved */\n loading: boolean;\n}\n\ninterface ReplyErrorState extends SuggestedReplyItem {\n /** If there are no suggestions from GenAI or if there is an error */\n errorType: 'noSuggestions' | 'error';\n}\n\nexport type SuggestedReply = SuggestedReplyItem | ReplyLoadingState | ReplyErrorState;\n\nexport const isReplyLoadingState = (reply: SuggestedReply): reply is ReplyLoadingState => {\n return hasProp(reply, 'loading');\n};\n\nexport const isReplyErrorState = (reply: SuggestedReply): reply is ReplyErrorState => {\n return hasProp(reply, 'errorType');\n};\n\nexport interface SuggestedReplyPickerProps\n extends Pick<ChatComposerProps, 'onSend' | 'maxLength' | 'disabled'> {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Id of the current reply */\n currentReplyId?: SuggestedReply['id'];\n /** Fired when user clicks on left or right buttons\n * @param id Id of the new reply\n */\n onReplyChange: (id: SuggestedReply['id']) => void;\n /** Current state of the panel */\n collapsed: boolean;\n /** Callback for expand or collapse click */\n onExpandCollapse: () => void;\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Show notification on picker header */\n showNotification?: boolean;\n}\n\nconst StyledReplyType = styled(Flex)(({ theme, type }) => {\n return css`\n color: ${type === 'dialog' ? 'inherit' : theme.base.palette.ai};\n `;\n});\n\nStyledReplyType.defaultProps = defaultThemeProp;\n\nconst SuggestedReplyPicker: ForwardRefForwardPropsComponent<SuggestedReplyPickerProps> = forwardRef(\n function SuggestedReplyPicker(\n {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n currentReplyId,\n onReplyChange,\n onSend,\n maxLength = 256,\n disabled = false,\n ...restProps\n }: PropsWithoutRef<SuggestedReplyPickerProps>,\n ref: SuggestedReplyPickerProps['ref']\n ) {\n const { announcePolite } = useLiveLog();\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n const currentReply = replies.find(reply => reply.id === currentReplyId);\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n\n // Allows suggested replies to cycle\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;\n newReplyIndex = (newReplyIndex + replies.length) % replies.length;\n onReplyChange(replies[newReplyIndex].id);\n };\n\n // SR announcement when current reply changes\n useEffect(() => {\n if (!replies || replies.length === 0 || !currentReplyId) {\n return;\n }\n if (currentReply && !isReplyLoadingState(currentReply))\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n currentReplyIndex + 1,\n replies.length\n ])},${currentReply?.message},${\n currentReply?.type === 'dialog' ? t('dialog') : t('pega_genAI')\n }`,\n type: 'acknowledgement'\n });\n }, [currentReply]);\n\n const onEditAnnouncement = () => {\n announcePolite({\n message: t('suggested_reply_copied_to_input_field'),\n type: 'acknowledgement'\n });\n };\n\n const suggestionType = useMemo(() => {\n if (currentReply && !collapsed) {\n let iconName = '';\n let label;\n if (currentReply.type === 'dialog') {\n iconName = 'script';\n label = t('dialog');\n } else {\n iconName = 'polaris-solid';\n label = t('pega_genAI');\n }\n\n return (\n <StyledReplyType\n container={{ alignItems: 'center', pad: 1, gap: 0.5 }}\n type={currentReply.type}\n >\n <Icon name={iconName} size='s' />\n {label}\n </StyledReplyType>\n );\n }\n\n return null;\n }, [currentReply, collapsed]);\n\n const suggestion = useMemo(() => {\n if (currentReply) {\n if (isReplyLoadingState(currentReply)) {\n return (\n <Progress\n placement='block'\n message={t('loading')}\n liveConfig={{ contextualLabel: `${t('pega_genAI')} ${t('suggestion')}` }}\n />\n );\n }\n\n if (isReplyErrorState(currentReply)) {\n return (\n <Flex container={{ justify: 'center' }}>\n {currentReply.errorType === 'noSuggestions' ? (\n <EmptyState message={currentReply.message} />\n ) : (\n <ErrorState message={currentReply.message} />\n )}\n </Flex>\n );\n }\n\n return (\n <Flex container as={StyledReply}>\n <RichTextViewer type='markdown' content={currentReply.message} />\n </Flex>\n );\n }\n\n return null;\n }, [currentReply]);\n\n return (\n <StyledSuggestedReplyContainer ref={ref} {...restProps}>\n <Flex\n as={StyledSuggestedReplyHeader}\n container={{\n justify: 'between',\n alignContent: 'center'\n }}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n >\n {ltr && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n\n <Flex container={{ gap: 0.5 }}>\n <Text variant='h3'>{t('suggested_replies')}</Text>\n {collapsed && showNotification && <Alert variant='urgent' />}\n </Flex>\n\n {!collapsed && replies?.length > 0 && (\n <Text variant='secondary'>{`- ${currentReplyIndex + 1}/${replies.length}`}</Text>\n )}\n\n {rtl && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <StyledSuggestedReplyIcon name='caret-down' suggestedReplyCollapsed={collapsed} />\n </Button>\n )}\n </Flex>\n {suggestionType}\n </Flex>\n <ExpandCollapse dimension='height' collapsed={collapsed} nullWhenCollapsed>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReply && replies.length ? (\n suggestion\n ) : (\n <EmptyState message={t('no_suggestion')} />\n )}\n <Flex\n container={{\n justify: 'center'\n }}\n as={StyledRepliesAction}\n >\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReplyId === undefined || replies.length <= 1}\n onClick={() => {\n onSuggestedReplyChange('prev');\n }}\n >\n <Icon name='caret-left' />\n </Button>\n )}\n <Button\n disabled={\n disabled ||\n currentReplyId === undefined ||\n !replies ||\n replies.length === 0 ||\n (currentReply && isReplyLoadingState(currentReply) && currentReply.loading) ||\n (currentReply && isReplyErrorState(currentReply) && !!currentReply.errorType)\n }\n onClick={() => {\n if (\n currentReply &&\n !isReplyErrorState(currentReply) &&\n !isReplyLoadingState(currentReply)\n ) {\n onSelect(currentReply);\n onExpandCollapse();\n onEditAnnouncement();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('edit_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('edit')}\n </Button>\n <Button\n disabled={\n disabled ||\n currentReplyId === undefined ||\n !replies ||\n replies.length === 0 ||\n (!!maxLength && replies.length > maxLength) ||\n (currentReply && isReplyLoadingState(currentReply) && currentReply.loading) ||\n (currentReply && isReplyErrorState(currentReply) && !!currentReply.errorType)\n }\n onClick={() => {\n if (\n currentReply &&\n !isReplyErrorState(currentReply) &&\n !isReplyLoadingState(currentReply)\n ) {\n onSend(currentReply.message);\n onExpandCollapse();\n }\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('send_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : undefined\n }\n >\n {t('send')}\n </Button>\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n onClick={() => {\n onSuggestedReplyChange('next');\n }}\n disabled={currentReplyId === undefined || replies.length <= 1}\n >\n <Icon name='caret-right' />\n </Button>\n )}\n </Flex>\n </Flex>\n </ExpandCollapse>\n </StyledSuggestedReplyContainer>\n );\n }\n);\n\nexport default SuggestedReplyPicker;\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps, PropsWithDefaults } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent, PropsWithDefaults } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { SystemMessageProps } from './Chat.types';
|
|
4
3
|
type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
|
|
5
4
|
export declare const StyledSystemMessage: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, Pick<SystemMessagePropsWithDefaults, "variant">, never>;
|
|
6
|
-
declare const SystemMessage:
|
|
5
|
+
declare const SystemMessage: ForwardRefForwardPropsComponent<SystemMessageProps>;
|
|
7
6
|
export default SystemMessage;
|
|
8
7
|
//# sourceMappingURL=SystemMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,KAAK,8BAA8B,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAEvF,eAAO,MAAM,mBAAmB,qJA6C/B,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,CAkCtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -35,8 +35,7 @@ export const StyledSystemMessage = styled.li(({ theme: { base: { palette: { 'for
|
|
|
35
35
|
`;
|
|
36
36
|
});
|
|
37
37
|
StyledSystemMessage.defaultProps = defaultThemeProp;
|
|
38
|
-
const SystemMessage = forwardRef(function SystemMessage(
|
|
39
|
-
const { message, timestamp, variant = 'secondary', ...restProps } = props;
|
|
38
|
+
const SystemMessage = forwardRef(function SystemMessage({ message, timestamp, variant = 'secondary', ...restProps }, ref) {
|
|
40
39
|
const t = useI18n();
|
|
41
40
|
const ariaLabel = timestamp === undefined ? `${message}` : t('chat_message_at_timestamp', [message, timestamp]);
|
|
42
41
|
return (_jsxs(Flex, { ref: ref, as: StyledSystemMessage, container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAOpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAC1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAChD,YAAY,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,EAClD,MAAM,EAAE,EACN,IAAI,EAAE,EAAE,MAAM,EAAE,EACjB,EACD,OAAO,EACR,EACF,EACD,OAAO,EACR,EAAE,EAAE;IACH,MAAM,4BAA4B,GAChC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CA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G,CAAA;;;;;;;wCAO+B,4BAA4B;;;;;+BAKrC,OAAO;;;iCAGL,OAAO;;OAEjC;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,aAAa,GAAwD,UAAU,CACnF,SAAS,aAAa,CACpB,EACE,OAAO,EACP,SAAS,EACT,OAAO,GAAG,WAAW,EACrB,GAAG,SAAS,EACwB,EACtC,GAA8B;IAE9B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GACb,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAEhG,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,QAAQ;SAClB,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC;SACV,EACD,OAAO,EAAE,OAAO,gBACJ,SAAS,KACjB,SAAS,aAEZ,SAAS,IAAI,GAAG,SAAS,IAAI,OAAG,OAAO,IACnC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { Flex, tryCatch, defaultThemeProp, useI18n } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, PropsWithDefaults } from '@pega/cosmos-react-core';\n\nimport type { SystemMessageProps } from './Chat.types';\n\ntype SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;\n\nexport const StyledSystemMessage = styled.li<Pick<SystemMessagePropsWithDefaults, 'variant'>>(\n ({\n theme: {\n base: {\n palette: { 'foreground-color': foregroundColor },\n transparency: { 'transparent-3': foregroundAlpha },\n colors: {\n blue: { medium }\n },\n spacing\n }\n },\n variant\n }) => {\n const systemMessageForeGroundColor =\n variant === 'primary' ? medium : tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n return css`\n color: ${systemMessageForeGroundColor};\n font-size: 0.75rem;\n padding: 0 0 calc(2 * ${spacing});\n\n :last-child {\n padding: 0;\n }\n ${variant === 'primary' &&\n css`\n text-transform: uppercase;\n font-weight: bold;\n ::before,\n ::after {\n display: inline-flex;\n content: '';\n border-top: 0.0625rem solid ${systemMessageForeGroundColor};\n flex-grow: 1;\n min-width: 1.5rem;\n }\n ::before {\n margin-inline-end: ${spacing};\n }\n ::after {\n margin-inline-start: ${spacing};\n }\n `}\n `;\n }\n);\n\nStyledSystemMessage.defaultProps = defaultThemeProp;\n\nconst SystemMessage: ForwardRefForwardPropsComponent<SystemMessageProps> = forwardRef(\n function SystemMessage(\n {\n message,\n timestamp,\n variant = 'secondary',\n ...restProps\n }: PropsWithoutRef<SystemMessageProps>,\n ref: SystemMessageProps['ref']\n ) {\n const t = useI18n();\n\n const ariaLabel =\n timestamp === undefined ? `${message}` : t('chat_message_at_timestamp', [message, timestamp]);\n\n return (\n <Flex\n ref={ref}\n as={StyledSystemMessage}\n container={{\n alignItems: 'center',\n justify: 'center'\n }}\n item={{\n shrink: 0\n }}\n variant={variant}\n aria-label={ariaLabel}\n {...restProps}\n >\n {timestamp && `${timestamp}: `} {message}\n </Flex>\n );\n }\n);\n\nexport default SystemMessage;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { TypeIndicatorProps } from './Chat.types';
|
|
4
|
-
declare const TypeIndicator:
|
|
3
|
+
declare const TypeIndicator: ForwardRefForwardPropsComponent<TypeIndicatorProps>;
|
|
5
4
|
export default TypeIndicator;
|
|
6
5
|
//# sourceMappingURL=TypeIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TypeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,CA8BtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -2,8 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useI18n } from '@pega/cosmos-react-core';
|
|
4
4
|
import Message from './Message';
|
|
5
|
-
const TypeIndicator = forwardRef(function TypeIndicator(
|
|
6
|
-
const { avatarInfo, message, senderId, senderType, agentVariant, ...restProps } = props;
|
|
5
|
+
const TypeIndicator = forwardRef(function TypeIndicator({ avatarInfo, message, senderId, senderType, agentVariant, ...restProps }, ref) {
|
|
7
6
|
const t = useI18n();
|
|
8
7
|
const ariaLabel = t('is_typing', [avatarInfo.name, message || '']);
|
|
9
8
|
return (_jsx(Message, { ...restProps, senderType: senderType, senderId: senderId, direction: 'in', avatarInfo: avatarInfo, agentVariant: agentVariant, typing: true, ref: ref, message: message, "aria-label": ariaLabel }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeIndicator.js","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"TypeIndicator.js","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,MAAM,aAAa,GAAwD,UAAU,CACnF,SAAS,aAAa,CACpB,EACE,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,GAAG,SAAS,EACwB,EACtC,GAA8B;IAE9B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,CACL,KAAC,OAAO,OACF,SAAS,EACb,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,IAAI,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,MAAM,QACN,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,gBACJ,SAAS,GACrB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport { useI18n } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport Message from './Message';\nimport type { TypeIndicatorProps } from './Chat.types';\n\nconst TypeIndicator: ForwardRefForwardPropsComponent<TypeIndicatorProps> = forwardRef(\n function TypeIndicator(\n {\n avatarInfo,\n message,\n senderId,\n senderType,\n agentVariant,\n ...restProps\n }: PropsWithoutRef<TypeIndicatorProps>,\n ref: TypeIndicatorProps['ref']\n ) {\n const t = useI18n();\n\n const ariaLabel = t('is_typing', [avatarInfo.name, message || '']);\n return (\n <Message\n {...restProps}\n senderType={senderType}\n senderId={senderId}\n direction='in'\n avatarInfo={avatarInfo}\n agentVariant={agentVariant}\n typing\n ref={ref}\n message={message}\n aria-label={ariaLabel}\n />\n );\n }\n);\n\nexport default TypeIndicator;\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
1
|
import type { ContextMenuPopoverProps } from './Email.types';
|
|
3
|
-
declare const ContextMenuPopover:
|
|
2
|
+
declare const ContextMenuPopover: import("react").ForwardRefExoticComponent<Omit<ContextMenuPopoverProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
3
|
export default ContextMenuPopover;
|
|
5
4
|
//# sourceMappingURL=ContextMenuPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenuPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,QAAA,MAAM,kBAAkB,iIAsFtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuPopover.js","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC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EAAE,GAAE,CAAC;iBACjB,CAAC;YACJ,CAAC;YACD,cAAc,EAAE,UAAU,IAAI,SAAS;SACxC,EACD,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAE,GAAG,YAER,KAAC,iBAAiB,cAChB,KAAC,IAAI,OACC,WAAW,EACf,MAAM,EAAE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,SAAS,CAAC,GAAQ,EAChD,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,YAAY,GACzB,GACgB,GACZ,CACX,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\n\nimport { Popover, Menu, Text, useI18n } from '@pega/cosmos-react-core';\n\nimport {\n StyledEmailMoreInfoPopover,\n StyledContextMenuFieldSelector,\n StyledContextMenu\n} from './Email.styles';\nimport type { ContextMenuPopoverProps } from './Email.types';\n\nconst ContextMenuPopover = forwardRef(function ContextMenuPopover(\n { cursorPosition, contextMenu, targetNode, show }: PropsWithoutRef<ContextMenuPopoverProps>,\n ref: ContextMenuPopoverProps['ref']\n) {\n const t = useI18n();\n const selectedText = useRef<string>();\n\n const { onItemClick, items } = contextMenu;\n const onItemSelect = (contextMenuItemId: string, e: MouseEvent) => {\n e.stopPropagation();\n const selectedcontextMenuItem = items.find(({ id }) => id === contextMenuItemId);\n\n if (selectedcontextMenuItem && selectedText.current) {\n onItemClick({\n fieldName: selectedcontextMenuItem.primary,\n fieldValue: selectedText.current\n });\n }\n };\n\n useEffect(() => {\n const selection = document.getSelection();\n\n if (!selection || !targetNode) return;\n\n if (targetNode.tagName.toLowerCase() === 'mark') {\n selection.removeAllRanges();\n }\n\n if (!selection.toString()) {\n const range = document.createRange();\n range.selectNodeContents(targetNode);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n\n if (selection.toString()) {\n selectedText.current = selection.toString();\n }\n }, [show, targetNode]);\n\n const itemsToRender = items.map(item => {\n return {\n ...item,\n visual: item.selected ? (\n <StyledContextMenuFieldSelector selected />\n ) : (\n <StyledContextMenuFieldSelector />\n )\n };\n });\n\n return (\n <Popover\n as={StyledEmailMoreInfoPopover}\n target={{\n getBoundingClientRect: () => {\n const { x, y } = cursorPosition;\n return {\n width: 0,\n height: 0,\n top: y,\n right: x,\n bottom: y,\n left: x,\n x,\n y,\n toJSON: () => {}\n };\n },\n contextElement: targetNode ?? undefined\n }}\n show={show}\n placement='bottom'\n ref={ref}\n >\n <StyledContextMenu>\n <Menu\n {...contextMenu}\n header={<Text variant='h5'>{t('copy_to')}</Text>}\n items={itemsToRender}\n onItemClick={onItemSelect}\n />\n </StyledContextMenu>\n </Popover>\n );\n});\n\nexport default ContextMenuPopover;\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { EmailProps } from './Email.types';
|
|
4
3
|
import './EmailEntity';
|
|
5
|
-
declare const Email:
|
|
4
|
+
declare const Email: ForwardRefForwardPropsComponent<EmailProps>;
|
|
6
5
|
export default Email;
|
|
7
6
|
//# sourceMappingURL=Email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EACV,+BAA+B,EAGhC,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAa,UAAU,EAAiC,MAAM,eAAe,CAAC;AAiB1F,OAAO,eAAe,CAAC;AAmCvB,QAAA,MAAM,KAAK,EAAE,+BAA+B,CAAC,UAAU,CA+frD,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Fragment, useRef, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
3
|
-
import { Text, SummaryItem, Avatar, Flex, EmailDisplay, Button, Icon, Sentiment, useOuterEvent, Popover, useElement, CardContent, useI18n, useBreakpoint, DateTimeDisplay, useConfiguration, MetaList, useScrollToggle, Status, Banner, useTheme, useEscape, HTML, Progress, getIntlDateTimeFormatFromCache, FileDisplayList } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Text, SummaryItem, Avatar, Flex, EmailDisplay, Button, Icon, Sentiment, useOuterEvent, Popover, useElement, CardContent, useI18n, useBreakpoint, DateTimeDisplay, useConfiguration, MetaList, useScrollToggle, Status, Banner, useTheme, useEscape, HTML, Progress, getIntlDateTimeFormatFromCache, FileDisplayList, registerIcon } from '@pega/cosmos-react-core';
|
|
4
4
|
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
5
|
+
import * as ArrowMicroDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-down.icon';
|
|
6
|
+
import * as ArrowMicroUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-up.icon';
|
|
5
7
|
import ContextMenuPopover from './ContextMenuPopover';
|
|
6
8
|
import { StyledEmail, StyledEmailDisplay, StyledEmailHeader, StyledFromEmailDisplay, StyledEmailMoreInfoButton, StyledEmailMoreInfoPopover, StyledEmailPrimaryFieldValueList, StyledEmailBody, StyledEmailSecondaryFieldValueList, StyledSuggestedRepliesButton, StyledSuggestedRepliesMenuButton, StyledForwardedContentToggle, StyledEmailActions } from './Email.styles';
|
|
7
9
|
import highlightEntities from './utils/EntityHighlighter';
|
|
8
10
|
import './EmailEntity';
|
|
11
|
+
registerIcon(ArrowMicroUpIcon, ArrowMicroDownIcon);
|
|
9
12
|
const EmailDisplayList = ({ emailUsers, showEmailAddress, showShortName }) => {
|
|
10
13
|
return (_jsx(_Fragment, { children: emailUsers.map(({ emailAddress, fullName, shortName }, i) => (_jsxs(Fragment, { children: [i === 0 ? '' : '; ', _jsx(EmailDisplay, { value: emailAddress, displayText: `${showShortName ? shortName : fullName}${showEmailAddress ? ` <${emailAddress}>` : ''}`, variant: 'text', as: StyledEmailDisplay })] }, emailAddress))) }));
|
|
11
14
|
};
|
|
@@ -100,7 +103,7 @@ const Email = forwardRef(function Email(props, ref) {
|
|
|
100
103
|
emailMoreInfoFields.push({
|
|
101
104
|
id: 'date',
|
|
102
105
|
name: t('date'),
|
|
103
|
-
value: (_jsxs(Text, { children: [`${getIntlDateTimeFormatFromCache(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime',
|
|
106
|
+
value: (_jsxs(Text, { children: [`${getIntlDateTimeFormatFromCache(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', value: timeStamp })] }))
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
useOuterEvent('mousedown', [emailMoreInfoPopover, emailMoreInfoBtnRef], () => {
|
|
@@ -171,7 +174,7 @@ const Email = forwardRef(function Email(props, ref) {
|
|
|
171
174
|
const emailMetaListItems = [
|
|
172
175
|
_jsxs(Text, { variant: 'secondary', children: [`${t('to')}: `, _jsx(EmailDisplayList, { emailUsers: to.slice(0, OVERFLOW_TO_EMAIL_COUNT), showShortName: true }), to.length > OVERFLOW_TO_EMAIL_COUNT &&
|
|
173
176
|
`; +${t('more_count', [to.length - OVERFLOW_TO_EMAIL_COUNT])}`] }),
|
|
174
|
-
_jsxs(Text, { variant: 'secondary', children: [`${getIntlDateTimeFormatFromCache(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime',
|
|
177
|
+
_jsxs(Text, { variant: 'secondary', children: [`${getIntlDateTimeFormatFromCache(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', value: timeStamp })] })
|
|
175
178
|
];
|
|
176
179
|
useEffect(() => {
|
|
177
180
|
if (contextMenuPopoverOpen)
|
|
@@ -227,7 +230,11 @@ const Email = forwardRef(function Email(props, ref) {
|
|
|
227
230
|
alignItems: 'start'
|
|
228
231
|
}, children: [_jsx(MetaList, { items: isMediumOrAbove ? emailMetaListItems : [emailMetaListItems[0]] }), _jsx(Button, { icon: true, variant: 'simple', as: StyledEmailMoreInfoButton, ref: setEmailMoreInfoBtnRef, onClick: () => {
|
|
229
232
|
setShowEmailMoreInfo(prev => !prev);
|
|
230
|
-
},
|
|
233
|
+
}, onBlur: (e) => {
|
|
234
|
+
if (e.relatedTarget && !emailMoreInfoPopover?.contains(e.relatedTarget)) {
|
|
235
|
+
setShowEmailMoreInfo(false);
|
|
236
|
+
}
|
|
237
|
+
}, label: showEmailMoreInfo ? t('show_less') : t('show_more'), "aria-label": `${showEmailMoreInfo ? t('show_less') : t('show_more')} - ${t('mailing_details')}`, children: _jsx(Icon, { name: showEmailMoreInfo ? 'arrow-micro-up' : 'arrow-micro-down' }) }), _jsx(Popover, { as: StyledEmailMoreInfoPopover, show: showEmailMoreInfo, ref: setEmailMoreInfoPopover, target: emailMoreInfoBtnRef, placement: 'bottom', portal: false, children: _jsx(CardContent, { children: _jsx(StyledEmailPrimaryFieldValueList, { fields: emailMoreInfoFields }) }) })] }), !isMediumOrAbove && timeStamp && emailMetaListItems[1], status && !isSmallOrAbove && (_jsx(Flex, { container: { pad: [0.5, 0, 0] }, children: _jsx(Status, { variant: status === 'draft' ? 'pending' : 'urgent', children: status === 'draft' ? t('draft', [], { count: 1 }) : t(status) }) }))] }), actions: _jsxs(Flex, { as: StyledEmailActions, container: {
|
|
231
238
|
pad: 1,
|
|
232
239
|
alignItems: 'center'
|
|
233
240
|
}, children: [...actions] }) }), banner && _jsx(Banner, { variant: 'urgent', ...banner }), _jsxs(Flex, { container: {
|