@pega/cosmos-react-social 4.0.0-dev.2.0 → 4.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.d.ts +11 -13
- package/lib/components/Chat/Chat.d.ts.map +1 -1
- package/lib/components/Chat/Chat.js +9 -12
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/Chat.types.d.ts +115 -2
- package/lib/components/Chat/Chat.types.d.ts.map +1 -1
- package/lib/components/Chat/Chat.types.js +9 -1
- package/lib/components/Chat/Chat.types.js.map +1 -1
- package/lib/components/Chat/ChatBody.d.ts +3 -8
- package/lib/components/Chat/ChatBody.d.ts.map +1 -1
- package/lib/components/Chat/ChatBody.js +288 -14
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts +3 -4
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +39 -29
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +17 -5
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +30 -14
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.d.ts +7 -0
- package/lib/components/Chat/ChatSettingsPanel.d.ts.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.js +15 -0
- package/lib/components/Chat/ChatSettingsPanel.js.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +16 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.js +47 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -0
- package/lib/components/Chat/Message.d.ts +3 -43
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +67 -27
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +32 -21
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +92 -20
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +18 -3
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +90 -51
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.d.ts +4 -15
- package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
- package/lib/components/Chat/SystemMessage.js +32 -22
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.d.ts +3 -10
- package/lib/components/Chat/TypeIndicator.d.ts.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +5 -2
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Chat/index.d.ts +14 -13
- package/lib/components/Chat/index.d.ts.map +1 -1
- package/lib/components/Chat/index.js +2 -5
- package/lib/components/Chat/index.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +15 -4
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +51 -4
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +32 -14
- 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.d.ts.map +1 -1
- package/lib/components/Email/EmailCaseView.js +2 -2
- package/lib/components/Email/EmailCaseView.js.map +1 -1
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +91 -44
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +76 -81
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailManager.js +2 -2
- package/lib/components/Email/EmailManager.js.map +1 -1
- package/lib/components/Email/EmailNotificationPanel.d.ts +7 -0
- package/lib/components/Email/EmailNotificationPanel.d.ts.map +1 -0
- package/lib/components/Email/EmailNotificationPanel.js +15 -0
- package/lib/components/Email/EmailNotificationPanel.js.map +1 -0
- package/lib/components/Email/EmailSelector.d.ts +1 -0
- package/lib/components/Email/EmailSelector.d.ts.map +1 -1
- package/lib/components/Email/EmailSelector.js +16 -4
- package/lib/components/Email/EmailSelector.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +2 -1
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +35 -26
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +17 -33
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/EntityList.js +1 -1
- package/lib/components/Email/EntityList.js.map +1 -1
- package/lib/components/Email/index.d.ts +3 -1
- package/lib/components/Email/index.d.ts.map +1 -1
- package/lib/components/Email/index.js +2 -0
- package/lib/components/Email/index.js.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.js +4 -10
- package/lib/components/Email/utils/EntityHighlighter.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +3 -0
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +18 -5
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +5 -10
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +32 -34
- package/lib/components/Feed/FeedLikeButton.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.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +3 -3
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +4 -7
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +37 -49
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +16 -26
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.types.d.ts +1 -3
- package/lib/components/Feed/FeedPost.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.types.js.map +1 -1
- package/lib/components/Feed/FeedReply.types.d.ts +1 -3
- package/lib/components/Feed/FeedReply.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.types.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +4 -0
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/index.d.ts +10 -7
- package/lib/components/Feed/index.d.ts.map +1 -1
- package/lib/components/Feed/index.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.d.ts.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 +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +11 -13
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/package.json +17 -19
- package/lib/components/Chat/ChatTranscript.d.ts +0 -23
- package/lib/components/Chat/ChatTranscript.d.ts.map +0 -1
- package/lib/components/Chat/ChatTranscript.js +0 -45
- package/lib/components/Chat/ChatTranscript.js.map +0 -1
- package/lib/components/Chat/MessageList.d.ts +0 -35
- package/lib/components/Chat/MessageList.d.ts.map +0 -1
- package/lib/components/Chat/MessageList.js +0 -134
- package/lib/components/Chat/MessageList.js.map +0 -1
- package/lib/components/Chat/RepeatingView.d.ts +0 -31
- package/lib/components/Chat/RepeatingView.d.ts.map +0 -1
- package/lib/components/Chat/RepeatingView.js +0 -47
- package/lib/components/Chat/RepeatingView.js.map +0 -1
- package/lib/components/Chat/TranscriptMessage.d.ts +0 -25
- package/lib/components/Chat/TranscriptMessage.d.ts.map +0 -1
- package/lib/components/Chat/TranscriptMessage.js +0 -48
- package/lib/components/Chat/TranscriptMessage.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;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,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,iBAAiB,GAAG,MAAM,CAAC,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AC,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,CAC/C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,MAAM,EAAE,EACpB,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;eAEC,MAAM;KAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledText,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nexport const StyledMessageBubbleContent = styled.div``;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledSummaryItem = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img``;\n\nexport const StyledMediaLink = styled.a``;\n\nexport const StyledMediaButton = styled(BareButton)``;\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\ninterface StyledMessageContainerProps {\n variant: 'sender' | 'receiver' | 'other';\n messageDirection: 'in' | 'out' | string;\n typing: boolean;\n hasMessage: boolean;\n status: string;\n}\n\nexport const StyledMessageContainer = styled.div<StyledMessageContainerProps>(\n ({\n messageDirection,\n variant,\n hasMessage,\n typing,\n status,\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 messageHeaderTheme = theme.components.chat.messageBubble[variant].header;\n const messageContentTheme = theme.components.chat.messageBubble[variant].content;\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n const statusForegroundColor = status === 'undelivered' ? urgent : metaForegroundColor;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n return css`\n ${messageDirection === '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 ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n background: ${messageContentTheme['background-color']};\n border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})\n calc(3 * ${borderRadius});\n overflow: hidden;\n color: ${messageContentTheme['foreground-color']};\n display: inline-block;\n width: auto;\n margin-block-end: calc(0.5 * ${spacing});\n\n label {\n color: inherit;\n }\n\n ${messageDirection === '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: ${messageContentTheme['foreground-color']};\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 ${StyledSummaryItem} {\n padding: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledSummaryItem}::before {\n content: '';\n padding: ${spacing} 0;\n border-top: 0.0625rem solid ${messageContentTheme['foreground-color']};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledSummaryItem}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n ${StyledText} {\n color: ${foregroundColor};\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledSummaryItem}::before {\n border-top: none;\n }\n }\n `}\n }\n\n ${StyledMessageHeader} {\n padding: ${spacing} calc(2 * ${spacing});\n color: ${messageHeaderTheme['foreground-color']};\n background-color: ${messageHeaderTheme['background-color']};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${messageHeaderTheme['foreground-color']};\n margin-inline-end: ${spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${messageHeaderTheme['foreground-color']};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${messageContentTheme['foreground-color']};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n overflow-x: hidden;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n &:hover {\n color: ${messageContentTheme['foreground-color']};\n text-decoration: underline;\n }\n &:visited {\n color: ${messageContentTheme['foreground-color']};\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 }\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 ({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n }) => {\n return css`\n flex-shrink: 0;\n color: ${urgent};\n `;\n }\n);\n\nStyledUndeliveredIcon.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,EAAgB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,EAClB,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,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CA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xB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,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,CAC/C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,MAAM,EAAE,EACpB,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;eACC,MAAM;KAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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, DefaultTheme } from 'styled-components';\nimport { readableColor, rgba, transparentize } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledIcon,\n StyledText,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { 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 StyledSummaryItem = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img``;\n\nexport const StyledMediaLink = styled.a``;\n\nexport const StyledMediaButton = styled(BareButton)``;\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``;\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 ${StyledSummaryItem} {\n padding: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledSummaryItem}::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} + ${StyledSummaryItem}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n ${StyledText} {\n color: ${foregroundColor};\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledSummaryItem}::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 overflow-x: hidden;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\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 }\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 ({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n }) => {\n return css`\n color: ${urgent};\n `;\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"]}
|
|
@@ -2,7 +2,12 @@ import { FunctionComponent, Ref } from 'react';
|
|
|
2
2
|
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
3
|
export declare const StyledSuggestedReplyHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
4
|
export declare const StyledSuggestedReplyContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const StyledReply: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const StyledRepliesAction: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const StyledNotification: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledSuggestedReplyIcon: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, {
|
|
9
|
+
suggestedReplyCollapsed?: boolean | undefined;
|
|
10
|
+
}, never>;
|
|
6
11
|
export interface SuggestedReply {
|
|
7
12
|
/** Id for this suggested reply */
|
|
8
13
|
id: string;
|
|
@@ -16,10 +21,20 @@ export interface SuggestedReplyPickerProps {
|
|
|
16
21
|
ref?: Ref<HTMLDivElement>;
|
|
17
22
|
/** Suggested replies */
|
|
18
23
|
replies?: SuggestedReply[];
|
|
24
|
+
/** Id of the current reply */
|
|
25
|
+
currentReplyId?: SuggestedReply['id'];
|
|
26
|
+
/** Fired when user clicks on left or right buttons
|
|
27
|
+
* @param id Id of the new reply
|
|
28
|
+
*/
|
|
29
|
+
onReplyChange: (id: SuggestedReply['id']) => void;
|
|
30
|
+
/** Current state of the panel */
|
|
31
|
+
collapsed: boolean;
|
|
32
|
+
/** Callback for expand or collapse click */
|
|
33
|
+
onExpandCollapse: () => void;
|
|
19
34
|
/** Callback for the event when a suggested reply is selected */
|
|
20
35
|
onSelect: (suggestedReply: SuggestedReply) => void;
|
|
21
|
-
/**
|
|
22
|
-
|
|
36
|
+
/** Show notification on picker header */
|
|
37
|
+
showNotification?: boolean;
|
|
23
38
|
}
|
|
24
39
|
declare const SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps>;
|
|
25
40
|
export default SuggestedReplyPicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAa,MAAM,OAAO,CAAC;AAGvF,OAAO,EAQL,YAAY,EAMb,MAAM,yBAAyB,CAAC;AAQjC,eAAO,MAAM,0BAA0B,yGAAe,CAAC;AACvD,eAAO,MAAM,2BAA2B,yGAAe,CAAC;AACxD,eAAO,MAAM,WAAW,yGAAe,CAAC;AACxC,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAI/C,eAAO,MAAM,wBAAwB;;SAqBpC,CAAC;AAoCF,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,8BAA8B;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IACtC;;OAEG;IACH,aAAa,EAAE,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAClD,iCAAiC;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;AAED,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CA4KnF,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,78 +1,117 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { forwardRef, useEffect
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Icon, registerIcon, Button, Text, useI18n, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Flex, Icon, registerIcon, Button, Text, useI18n, defaultThemeProp, useLiveLog, ExpandCollapse, Alert, useDirection, EmptyState } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
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
|
+
import { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';
|
|
8
9
|
registerIcon(timesIcon, caretLeftIcon, caretRightIcon);
|
|
9
10
|
export const StyledSuggestedReplyHeader = styled.div ``;
|
|
10
11
|
export const StyledSuggestedReplyContent = styled.div ``;
|
|
11
|
-
export const
|
|
12
|
+
export const StyledReply = styled.div ``;
|
|
13
|
+
export const StyledRepliesAction = styled.div ``;
|
|
14
|
+
export const StyledNotification = styled.div ``;
|
|
15
|
+
const maxNumOfLines = 5;
|
|
16
|
+
const minNumOfLines = 2;
|
|
17
|
+
export const StyledSuggestedReplyIcon = styled.svg(({ suggestedReplyCollapsed, theme }) => {
|
|
18
|
+
const { rtl } = useDirection();
|
|
19
|
+
const { base: { animation: { speed, timing: { ease } } } } = theme;
|
|
20
|
+
return css `
|
|
21
|
+
transition-property: transform;
|
|
22
|
+
transition-duration: ${speed};
|
|
23
|
+
transition-timing-function: ${ease};
|
|
24
|
+
${suggestedReplyCollapsed &&
|
|
25
|
+
css `
|
|
26
|
+
transform: rotateZ(${rtl ? '0deg' : '-90deg'});
|
|
27
|
+
`}
|
|
28
|
+
`;
|
|
29
|
+
});
|
|
30
|
+
StyledSuggestedReplyIcon.defaultProps = defaultThemeProp;
|
|
12
31
|
const StyledSuggestedReplyContainer = styled.div(props => {
|
|
13
32
|
const { theme } = props;
|
|
14
33
|
return css `
|
|
15
34
|
border-top: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
16
35
|
background-color: ${theme.base.palette['primary-background']};
|
|
36
|
+
|
|
17
37
|
> ${StyledSuggestedReplyHeader} {
|
|
18
|
-
${
|
|
19
|
-
font-size: 1.2rem;
|
|
20
|
-
}
|
|
21
|
-
padding: 0.5rem;
|
|
38
|
+
padding: ${theme.base.spacing};
|
|
22
39
|
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
23
40
|
}
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
|
|
42
|
+
${StyledAlert} {
|
|
43
|
+
position: relative;
|
|
44
|
+
inset-block-start: calc(-0.25 * ${theme.base.spacing});
|
|
45
|
+
inset-inline-start: calc(-0.5 * ${theme.base.spacing});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
${StyledSuggestedReplyContent} {
|
|
49
|
+
padding: calc(2 * ${theme.base.spacing});
|
|
50
|
+
position: relative;
|
|
51
|
+
|
|
52
|
+
> ${StyledReply} {
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});
|
|
55
|
+
min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});
|
|
56
|
+
}
|
|
26
57
|
}
|
|
27
58
|
`;
|
|
28
59
|
});
|
|
29
60
|
StyledSuggestedReplyContainer.defaultProps = defaultThemeProp;
|
|
30
61
|
const SuggestedReplyPicker = forwardRef((props, ref) => {
|
|
31
|
-
const { replies = [], onSelect,
|
|
32
|
-
const
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
setCurrentReply(replies.length > 0 ? replies[0] : null);
|
|
35
|
-
}, [replies]);
|
|
62
|
+
const { replies = [], collapsed, onExpandCollapse, showNotification, onSelect, currentReplyId, onReplyChange, ...restProps } = props;
|
|
63
|
+
const { announcePolite } = useLiveLog();
|
|
36
64
|
const t = useI18n();
|
|
37
|
-
|
|
65
|
+
const { rtl, ltr } = useDirection();
|
|
66
|
+
// Allows suggested replies to cycle
|
|
67
|
+
const onSuggestedReplyChange = (mode) => {
|
|
68
|
+
const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
|
|
69
|
+
let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;
|
|
70
|
+
newReplyIndex = (newReplyIndex + replies.length) % replies.length;
|
|
71
|
+
onReplyChange(replies[newReplyIndex].id);
|
|
72
|
+
};
|
|
73
|
+
// SR announcement when current reply changes
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!replies || replies.length === 0 || !currentReplyId) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
|
|
79
|
+
announcePolite({
|
|
80
|
+
message: `${t('suggested_replies_current_of_total', [
|
|
81
|
+
currentReplyIndex + 1,
|
|
82
|
+
replies.length
|
|
83
|
+
])},
|
|
84
|
+
${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${replies[currentReplyIndex]?.message}`,
|
|
85
|
+
type: 'acknowledgement'
|
|
86
|
+
});
|
|
87
|
+
}, [currentReplyId]);
|
|
88
|
+
return (_jsxs(StyledSuggestedReplyContainer, { ref: ref, ...restProps, children: [_jsx(Flex, { as: StyledSuggestedReplyHeader, container: {
|
|
38
89
|
justify: 'between',
|
|
39
90
|
alignContent: 'center'
|
|
40
|
-
}, children:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
91
|
+
}, children: _jsxs(Flex, { container: {
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: 1
|
|
94
|
+
}, children: [ltr && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(Icon, { name: 'caret-down', suggestedReplyCollapsed: collapsed, as: StyledSuggestedReplyIcon }) })), _jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(Text, { variant: 'h3', children: t('suggested_replies') }), collapsed && showNotification && _jsx(Alert, { variant: 'urgent' })] }), rtl && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(Icon, { name: 'caret-down', suggestedReplyCollapsed: collapsed, as: StyledSuggestedReplyIcon }) }))] }) }), _jsx(ExpandCollapse, { dimension: 'height', collapsed: collapsed, nullWhenCollapsed: true, children: _jsxs(Flex, { container: {
|
|
95
|
+
direction: 'column',
|
|
96
|
+
gap: 1
|
|
97
|
+
}, as: StyledSuggestedReplyContent, children: [currentReplyId && replies.length ? (_jsx(Flex, { container: true, as: StyledReply, children: replies.find(reply => reply.id === currentReplyId)?.message })) : (_jsx(EmptyState, {})), _jsxs(Flex, { container: {
|
|
98
|
+
justify: 'center'
|
|
99
|
+
}, as: StyledRepliesAction, children: [replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('prev_suggested_reply'), variant: 'simple', disabled: currentReplyId === undefined || replies.length <= 1, onClick: () => {
|
|
100
|
+
onSuggestedReplyChange('prev');
|
|
101
|
+
}, children: _jsx(Icon, { name: 'caret-left' }) })), _jsx(Button, { disabled: currentReplyId === undefined || !replies || replies.length === 0, onClick: () => {
|
|
102
|
+
const selectedReply = replies.find(reply => reply.id === currentReplyId);
|
|
103
|
+
if (selectedReply)
|
|
104
|
+
onSelect(selectedReply);
|
|
105
|
+
}, "aria-label": replies.length > 0 && currentReplyId
|
|
106
|
+
? t('use_current_template', [
|
|
107
|
+
replies.length > 0 && currentReplyId
|
|
108
|
+
? replies.findIndex(reply => reply.id === currentReplyId) + 1
|
|
109
|
+
: 0,
|
|
45
110
|
replies.length
|
|
46
|
-
])
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
justify: 'center'
|
|
51
|
-
}, children: [_jsx(Button, { icon: true, "aria-label": t('prev_suggested_reply'), variant: 'simple', disabled: currentReply === null || replies.indexOf(currentReply) === 0, onClick: () => {
|
|
52
|
-
setCurrentReply(prevCurrentReply => {
|
|
53
|
-
if (prevCurrentReply) {
|
|
54
|
-
const prevCurrentReplyIndex = replies.indexOf(prevCurrentReply);
|
|
55
|
-
if (prevCurrentReplyIndex - 1 >= 0 && replies.length > 0) {
|
|
56
|
-
return replies[prevCurrentReplyIndex - 1];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
});
|
|
61
|
-
}, children: _jsx(Icon, { name: 'caret-left' }) }), _jsx(Button, { disabled: currentReply === null, onClick: () => {
|
|
62
|
-
if (currentReply) {
|
|
63
|
-
onSelect(currentReply);
|
|
64
|
-
}
|
|
65
|
-
}, children: t('use') }), _jsx(Button, { icon: true, "aria-label": t('next_suggested_reply'), variant: 'simple', disabled: currentReply === null || replies.indexOf(currentReply) === replies.length - 1, onClick: () => {
|
|
66
|
-
setCurrentReply(prevCurrentReply => {
|
|
67
|
-
if (prevCurrentReply) {
|
|
68
|
-
const prevCurrentReplyIndex = replies.indexOf(prevCurrentReply);
|
|
69
|
-
if (prevCurrentReplyIndex + 1 <= replies.length) {
|
|
70
|
-
return replies[prevCurrentReplyIndex + 1];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
});
|
|
75
|
-
}, children: _jsx(Icon, { name: 'caret-right' }) })] })] })] }));
|
|
111
|
+
])
|
|
112
|
+
: '', children: t('use') }), replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('next_suggested_reply'), variant: 'simple', onClick: () => {
|
|
113
|
+
onSuggestedReplyChange('next');
|
|
114
|
+
}, disabled: currentReplyId === undefined || replies.length <= 1, children: _jsx(Icon, { name: 'caret-right' }) }))] })] }) })] }));
|
|
76
115
|
});
|
|
77
116
|
export default SuggestedReplyPicker;
|
|
78
117
|
//# sourceMappingURL=SuggestedReplyPicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjG,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,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxD,MAAM,CAAC,M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AAG,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gDACxD,OAAO,OAAO,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;6CAC3C;yCACF;wCACD,OAAO,IAAI,CAAC;oCACd,CAAC,CAAC,CAAC;gCACL,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,GACnB,EACT,KAAC,MAAM,IACL,QAAQ,EAAE,YAAY,KAAK,IAAI,EAC/B,OAAO,EAAE,GAAG,EAAE;oCACZ,IAAI,YAAY,EAAE;wCAChB,QAAQ,CAAC,YAAY,CAAC,CAAC;qCACxB;gCACH,CAAC,YAEA,CAAC,CAAC,KAAK,CAAC,GACF,EACT,KAAC,MAAM,IACL,IAAI,sBACQ,CAAC,CAAC,sBAAsB,CAAC,EACrC,OAAO,EAAC,QAAQ,EAChB,QAAQ,EACN,YAAY,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,EAE/E,OAAO,EAAE,GAAG,EAAE;oCACZ,eAAe,CAAC,gBAAgB,CAAC,EAAE;wCACjC,IAAI,gBAAgB,EAAE;4CACpB,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;4CAChE,IAAI,qBAAqB,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;gDAC/C,OAAO,OAAO,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;6CAC3C;yCACF;wCACD,OAAO,IAAI,CAAC;oCACd,CAAC,CAAC,CAAC;gCACL,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,GACpB,IACJ,IACF,IACuB,CACjC,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, useEffect, useState } 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 ForwardProps\n} 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';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledSuggestedReplyIcon = styled.svg``;\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 > ${StyledSuggestedReplyHeader} {\n ${StyledSuggestedReplyIcon} {\n font-size: 1.2rem;\n }\n padding: 0.5rem;\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n > ${StyledSuggestedReplyContent} {\n padding: 1rem;\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReply {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** Confidence of this suggested reply */\n confidence: number;\n}\n\nexport interface SuggestedReplyPickerProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Callback for the event close button is clicked */\n onDismiss: () => void;\n}\n\nconst SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(\n (props: PropsWithoutRef<SuggestedReplyPickerProps>, ref: SuggestedReplyPickerProps['ref']) => {\n const { replies = [], onSelect, onDismiss, ...restProps } = props;\n const [currentReply, setCurrentReply] = useState<SuggestedReply | null>(null);\n\n useEffect(() => {\n setCurrentReply(replies.length > 0 ? replies[0] : null);\n }, [replies]);\n\n const t = useI18n();\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 <Icon name='bulb-solid' as={StyledSuggestedReplyIcon} />\n {currentReply && (\n <>\n <Text variant='h3'>\n {t('suggested_replies_current_of_total', [\n replies.indexOf(currentReply) + 1,\n replies.length\n ])}\n </Text>\n <Text variant='secondary'>\n {t('confidence_percentage', [currentReply.confidence])}\n </Text>\n </>\n )}\n </Flex>\n <Button\n icon\n variant='simple'\n onClick={onDismiss}\n aria-label={t('dismiss_suggested_replies')}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReply && <div>{currentReply.message}</div>}\n <Flex\n container={{\n justify: 'center'\n }}\n >\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReply === null || replies.indexOf(currentReply) === 0}\n onClick={() => {\n setCurrentReply(prevCurrentReply => {\n if (prevCurrentReply) {\n const prevCurrentReplyIndex = replies.indexOf(prevCurrentReply);\n if (prevCurrentReplyIndex - 1 >= 0 && replies.length > 0) {\n return replies[prevCurrentReplyIndex - 1];\n }\n }\n return null;\n });\n }}\n >\n <Icon name='caret-left' />\n </Button>\n <Button\n disabled={currentReply === null}\n onClick={() => {\n if (currentReply) {\n onSelect(currentReply);\n }\n }}\n >\n {t('use')}\n </Button>\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n disabled={\n currentReply === null || replies.indexOf(currentReply) === replies.length - 1\n }\n onClick={() => {\n setCurrentReply(prevCurrentReply => {\n if (prevCurrentReply) {\n const prevCurrentReplyIndex = replies.indexOf(prevCurrentReply);\n if (prevCurrentReplyIndex + 1 <= replies.length) {\n return replies[prevCurrentReplyIndex + 1];\n }\n }\n return null;\n });\n }}\n >\n <Icon name='caret-right' />\n </Button>\n </Flex>\n </Flex>\n </StyledSuggestedReplyContainer>\n );\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,EAA2C,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,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,EAEhB,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,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;AAElF,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAC/C,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,M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WithoutRef, Ref, useEffect } 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 ForwardProps,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState\n} 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\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.svg<{ suggestedReplyCollapsed?: boolean }>(\n ({ suggestedReplyCollapsed, theme }) => {\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);\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 SuggestedReply {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** Confidence of this suggested reply */\n confidence: number;\n}\n\nexport interface SuggestedReplyPickerProps {\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 SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(\n (props: PropsWithoutRef<SuggestedReplyPickerProps>, ref: SuggestedReplyPickerProps['ref']) => {\n const {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n currentReplyId,\n onReplyChange,\n ...restProps\n } = props;\n const { announcePolite } = useLiveLog();\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n // Allows suggested replies to cycle\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\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 const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n currentReplyIndex + 1,\n replies.length\n ])},\n ${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${\n replies[currentReplyIndex]?.message\n }`,\n type: 'acknowledgement'\n });\n }, [currentReplyId]);\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 <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\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 {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 <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\n </Button>\n )}\n </Flex>\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 {currentReplyId && replies.length ? (\n <Flex container as={StyledReply}>\n {replies.find(reply => reply.id === currentReplyId)?.message}\n </Flex>\n ) : (\n <EmptyState />\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={currentReplyId === undefined || !replies || replies.length === 0}\n onClick={() => {\n const selectedReply = replies.find(reply => reply.id === currentReplyId);\n if (selectedReply) onSelect(selectedReply);\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('use_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : ''\n }\n >\n {t('use')}\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,19 +1,8 @@
|
|
|
1
|
-
import { FunctionComponent
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps, PropsWithDefaults } from '@pega/cosmos-react-core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** System message to be displayed */
|
|
7
|
-
message: ReactNode;
|
|
8
|
-
/** timestamp of the message(Formatted) */
|
|
9
|
-
timeStamp?: string;
|
|
10
|
-
/** variant of this system message
|
|
11
|
-
* @default "secondary"
|
|
12
|
-
*/
|
|
13
|
-
variant?: 'primary' | 'secondary';
|
|
14
|
-
}
|
|
15
|
-
declare type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
|
|
16
|
-
export declare const StyledSystemMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<SystemMessagePropsWithDefaults, "variant">, never>;
|
|
3
|
+
import { SystemMessageProps } from './Chat.types';
|
|
4
|
+
type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
|
|
5
|
+
export declare const StyledSystemMessage: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, Pick<SystemMessagePropsWithDefaults, "variant">, never>;
|
|
17
6
|
declare const SystemMessage: FunctionComponent<SystemMessageProps & ForwardProps>;
|
|
18
7
|
export default SystemMessage;
|
|
19
8
|
//# sourceMappingURL=SystemMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,
|
|
1
|
+
{"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAIvE,OAAO,EAIL,YAAY,EACZ,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,KAAK,8BAA8B,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAEvF,eAAO,MAAM,mBAAmB,qJA6C/B,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA2BvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -2,39 +2,49 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { rgba } from 'polished';
|
|
5
|
-
import { Flex, tryCatch, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
6
|
-
export const StyledSystemMessage = styled.
|
|
7
|
-
const systemMessageForeGroundColor = variant === 'primary'
|
|
8
|
-
? primarySystemMessageColor
|
|
9
|
-
: tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
5
|
+
import { Flex, tryCatch, defaultThemeProp, useI18n } from '@pega/cosmos-react-core';
|
|
6
|
+
export const StyledSystemMessage = styled.li(({ theme: { base: { palette: { 'foreground-color': foregroundColor }, transparency: { 'transparent-3': foregroundAlpha }, colors: { blue: { medium } }, spacing } }, variant }) => {
|
|
7
|
+
const systemMessageForeGroundColor = variant === 'primary' ? medium : tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
10
8
|
return css `
|
|
11
9
|
color: ${systemMessageForeGroundColor};
|
|
12
10
|
font-size: 0.75rem;
|
|
13
|
-
padding: 0 0
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
content: '';
|
|
18
|
-
border-top: 0.0625rem solid ${systemMessageForeGroundColor};
|
|
19
|
-
flex-grow: 1;
|
|
20
|
-
min-width: 1.5rem;
|
|
21
|
-
}
|
|
22
|
-
::before {
|
|
23
|
-
margin: 0 0.5rem 0 0;
|
|
24
|
-
}
|
|
25
|
-
::after {
|
|
26
|
-
margin: 0 0 0 0.5rem;
|
|
11
|
+
padding: 0 0 calc(2 * ${spacing});
|
|
12
|
+
|
|
13
|
+
:last-child {
|
|
14
|
+
padding: 0;
|
|
27
15
|
}
|
|
16
|
+
${variant === 'primary' &&
|
|
17
|
+
css `
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
::before,
|
|
21
|
+
::after {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
content: '';
|
|
24
|
+
border-top: 0.0625rem solid ${systemMessageForeGroundColor};
|
|
25
|
+
flex-grow: 1;
|
|
26
|
+
min-width: 1.5rem;
|
|
27
|
+
}
|
|
28
|
+
::before {
|
|
29
|
+
margin-inline-end: ${spacing};
|
|
30
|
+
}
|
|
31
|
+
::after {
|
|
32
|
+
margin-inline-start: ${spacing};
|
|
33
|
+
}
|
|
34
|
+
`}
|
|
28
35
|
`;
|
|
29
36
|
});
|
|
30
37
|
StyledSystemMessage.defaultProps = defaultThemeProp;
|
|
31
38
|
const SystemMessage = forwardRef((props, ref) => {
|
|
32
|
-
const { message,
|
|
39
|
+
const { message, timestamp, variant = 'secondary', ...restProps } = props;
|
|
40
|
+
const t = useI18n();
|
|
41
|
+
const ariaLabel = timestamp === undefined ? `${message}` : t('chat_message_at_timestamp', [message, timestamp]);
|
|
33
42
|
return (_jsxs(Flex, { ref: ref, as: StyledSystemMessage, container: {
|
|
34
|
-
alignItems: 'center'
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justify: 'center'
|
|
35
45
|
}, item: {
|
|
36
46
|
shrink: 0
|
|
37
|
-
}, variant: variant, ...restProps, children: [
|
|
47
|
+
}, variant: variant, "aria-label": ariaLabel, ...restProps, children: [timestamp && `${timestamp}: `, " ", message] }));
|
|
38
48
|
});
|
|
39
49
|
export default SystemMessage;
|
|
40
50
|
//# sourceMappingURL=SystemMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,
|
|
1
|
+
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AACvE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAGhB,OAAO,EACR,MAAM,yBAAyB,CAAC;AAMjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAC1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAA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SAAS,aAEZ,SAAS,IAAI,GAAG,SAAS,IAAI,OAAG,OAAO,IACnC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport {\n Flex,\n tryCatch,\n defaultThemeProp,\n ForwardProps,\n PropsWithDefaults,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport { 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: FunctionComponent<SystemMessageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SystemMessageProps>, ref: SystemMessageProps['ref']) => {\n const { message, timestamp, variant = 'secondary', ...restProps } = props;\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,13 +1,6 @@
|
|
|
1
|
-
import { FunctionComponent
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** ref to the element */
|
|
5
|
-
ref?: Ref<HTMLDivElement>;
|
|
6
|
-
/** Avatar information, can be image and name */
|
|
7
|
-
avatarInfo: Pick<AvatarProps, 'name' | 'imageSrc'>;
|
|
8
|
-
/** Type ahead message */
|
|
9
|
-
message?: string;
|
|
10
|
-
}
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { TypeIndicatorProps } from './Chat.types';
|
|
11
4
|
declare const TypeIndicator: FunctionComponent<TypeIndicatorProps & ForwardProps>;
|
|
12
5
|
export default TypeIndicator;
|
|
13
6
|
//# sourceMappingURL=TypeIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,
|
|
1
|
+
{"version":3,"file":"TypeIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAW,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAqBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
+
import { useI18n } from '@pega/cosmos-react-core';
|
|
3
4
|
import Message from './Message';
|
|
4
5
|
const TypeIndicator = forwardRef((props, ref) => {
|
|
5
|
-
const { avatarInfo, message, ...restProps } = props;
|
|
6
|
-
|
|
6
|
+
const { avatarInfo, message, senderId, senderType, agentVariant, ...restProps } = props;
|
|
7
|
+
const t = useI18n();
|
|
8
|
+
const ariaLabel = t('is_typing', [avatarInfo.name, message || '']);
|
|
9
|
+
return (_jsx(Message, { ...restProps, senderType: senderType, senderId: senderId, direction: 'in', avatarInfo: avatarInfo, agentVariant: agentVariant, typing: true, ref: ref, message: message, "aria-label": ariaLabel }));
|
|
7
10
|
});
|
|
8
11
|
export default TypeIndicator;
|
|
9
12
|
//# sourceMappingURL=TypeIndicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeIndicator.js","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,
|
|
1
|
+
{"version":3,"file":"TypeIndicator.js","sourceRoot":"","sources":["../../../src/components/Chat/TypeIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAgB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,MAAM,aAAa,GAAyD,UAAU,CACpF,CAAC,KAA0C,EAAE,GAA8B,EAAE,EAAE;IAC7E,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACxF,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 { FunctionComponent, forwardRef, PropsWithoutRef } from 'react';\n\nimport { ForwardProps, useI18n } from '@pega/cosmos-react-core';\n\nimport Message from './Message';\nimport { TypeIndicatorProps } from './Chat.types';\n\nconst TypeIndicator: FunctionComponent<TypeIndicatorProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TypeIndicatorProps>, ref: TypeIndicatorProps['ref']) => {\n const { avatarInfo, message, senderId, senderType, agentVariant, ...restProps } = props;\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,14 +1,15 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export {
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
1
|
+
export { default } from './Chat';
|
|
2
|
+
export type { ChatProps } from './Chat';
|
|
3
|
+
export { default as ChatHeader } from './ChatHeader';
|
|
4
|
+
export type { ChatHeaderProps } from './ChatHeader';
|
|
5
|
+
export { default as ChatBody, NewMessageSeparatorId } from './ChatBody';
|
|
6
|
+
export { default as ChatComposer } from './ChatComposer';
|
|
7
|
+
export type { ChatComposerProps, ChatComposerImperativeHandleProps } from './ChatComposer';
|
|
8
|
+
export { default as SuggestedReplyPicker } from './SuggestedReplyPicker';
|
|
9
|
+
export type { SuggestedReplyPickerProps, SuggestedReply } from './SuggestedReplyPicker';
|
|
10
|
+
export type { AttachmentItemProps, ChatSettingsPanelProps, MediaPageLinks, MessageProps, MessageHeaderProps, ChatBodyProps, ChatBodyListItemProps, ChatBodyHandleValue, TypeIndicatorProps, SystemMessageProps } from './Chat.types';
|
|
11
|
+
export { default as Message } from './Message';
|
|
12
|
+
export { default as SystemMessage } from './SystemMessage';
|
|
13
|
+
export { default as TypeIndicator } from './TypeIndicator';
|
|
14
|
+
export { default as ChatSettingsPanel } from './ChatSettingsPanel';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,YAAY,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxF,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export { default } from './Chat';
|
|
2
2
|
export { default as ChatHeader } from './ChatHeader';
|
|
3
|
-
export { default as ChatBody } from './ChatBody';
|
|
3
|
+
export { default as ChatBody, NewMessageSeparatorId } from './ChatBody';
|
|
4
4
|
export { default as ChatComposer } from './ChatComposer';
|
|
5
|
-
export { default as ChatTranscript } from './ChatTranscript';
|
|
6
|
-
export { default as MessageList, NewMessageSeparatorId } from './MessageList';
|
|
7
5
|
export { default as SuggestedReplyPicker } from './SuggestedReplyPicker';
|
|
8
6
|
export { default as Message } from './Message';
|
|
9
7
|
export { default as SystemMessage } from './SystemMessage';
|
|
10
8
|
export { default as TypeIndicator } from './TypeIndicator';
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as RepeatingView, StyledRepeatingViewItem, StyledRepeatingView } from './RepeatingView';
|
|
9
|
+
export { default as ChatSettingsPanel } from './ChatSettingsPanel';
|
|
13
10
|
//# sourceMappingURL=index.js.map
|