@pega/cosmos-react-social 4.0.0-dev.1.1 → 4.0.0-dev.10.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.
Files changed (81) hide show
  1. package/lib/components/Chat/Chat.d.ts +2 -2
  2. package/lib/components/Chat/Chat.d.ts.map +1 -1
  3. package/lib/components/Chat/Chat.js +1 -1
  4. package/lib/components/Chat/Chat.js.map +1 -1
  5. package/lib/components/Chat/Chat.types.d.ts +12 -1
  6. package/lib/components/Chat/Chat.types.d.ts.map +1 -1
  7. package/lib/components/Chat/Chat.types.js.map +1 -1
  8. package/lib/components/Chat/ChatComposer.d.ts +1 -1
  9. package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
  10. package/lib/components/Chat/ChatHeader.d.ts +17 -5
  11. package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
  12. package/lib/components/Chat/ChatHeader.js +30 -14
  13. package/lib/components/Chat/ChatHeader.js.map +1 -1
  14. package/lib/components/Chat/ChatSettingsPanel.d.ts +7 -0
  15. package/lib/components/Chat/ChatSettingsPanel.d.ts.map +1 -0
  16. package/lib/components/Chat/ChatSettingsPanel.js +15 -0
  17. package/lib/components/Chat/ChatSettingsPanel.js.map +1 -0
  18. package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +16 -0
  19. package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -0
  20. package/lib/components/Chat/ChatSettingsPanel.styles.js +47 -0
  21. package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -0
  22. package/lib/components/Chat/ChatTranscript.d.ts +1 -1
  23. package/lib/components/Chat/ChatTranscript.d.ts.map +1 -1
  24. package/lib/components/Chat/Message.d.ts +1 -1
  25. package/lib/components/Chat/Message.d.ts.map +1 -1
  26. package/lib/components/Chat/MessageList.d.ts +1 -1
  27. package/lib/components/Chat/MessageList.d.ts.map +1 -1
  28. package/lib/components/Chat/MessageList.js +13 -2
  29. package/lib/components/Chat/MessageList.js.map +1 -1
  30. package/lib/components/Chat/SystemMessage.d.ts +1 -1
  31. package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
  32. package/lib/components/Chat/TranscriptMessage.d.ts +1 -1
  33. package/lib/components/Chat/TranscriptMessage.d.ts.map +1 -1
  34. package/lib/components/Chat/index.d.ts +2 -1
  35. package/lib/components/Chat/index.d.ts.map +1 -1
  36. package/lib/components/Chat/index.js +1 -0
  37. package/lib/components/Chat/index.js.map +1 -1
  38. package/lib/components/Email/Email.styles.d.ts +3 -0
  39. package/lib/components/Email/Email.styles.d.ts.map +1 -1
  40. package/lib/components/Email/Email.styles.js +41 -1
  41. package/lib/components/Email/Email.styles.js.map +1 -1
  42. package/lib/components/Email/Email.types.d.ts +26 -10
  43. package/lib/components/Email/Email.types.d.ts.map +1 -1
  44. package/lib/components/Email/Email.types.js.map +1 -1
  45. package/lib/components/Email/EmailComposer.d.ts.map +1 -1
  46. package/lib/components/Email/EmailComposer.js +85 -16
  47. package/lib/components/Email/EmailComposer.js.map +1 -1
  48. package/lib/components/Email/EmailNotificationPanel.d.ts +7 -0
  49. package/lib/components/Email/EmailNotificationPanel.d.ts.map +1 -0
  50. package/lib/components/Email/EmailNotificationPanel.js +15 -0
  51. package/lib/components/Email/EmailNotificationPanel.js.map +1 -0
  52. package/lib/components/Email/EmailSelector.d.ts +1 -0
  53. package/lib/components/Email/EmailSelector.d.ts.map +1 -1
  54. package/lib/components/Email/EmailSelector.js +16 -4
  55. package/lib/components/Email/EmailSelector.js.map +1 -1
  56. package/lib/components/Email/EmailSummaryItem.d.ts +1 -1
  57. package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
  58. package/lib/components/Email/EmailSummaryItem.js +36 -26
  59. package/lib/components/Email/EmailSummaryItem.js.map +1 -1
  60. package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
  61. package/lib/components/Email/EmailSummaryList.js +16 -32
  62. package/lib/components/Email/EmailSummaryList.js.map +1 -1
  63. package/lib/components/Email/index.d.ts +3 -1
  64. package/lib/components/Email/index.d.ts.map +1 -1
  65. package/lib/components/Email/index.js +2 -0
  66. package/lib/components/Email/index.js.map +1 -1
  67. package/lib/components/Feed/FeedAttachments.d.ts +1 -1
  68. package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
  69. package/lib/components/Feed/FeedLikeButton.d.ts +1 -1
  70. package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
  71. package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
  72. package/lib/components/Feed/FeedNewPost.js +3 -3
  73. package/lib/components/Feed/FeedNewPost.js.map +1 -1
  74. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +1 -1
  75. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
  76. package/lib/components/Feed/FeedPost.js +1 -1
  77. package/lib/components/Feed/FeedPost.js.map +1 -1
  78. package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
  79. package/lib/components/Feed/FeedReplyInput.js +4 -0
  80. package/lib/components/Feed/FeedReplyInput.js.map +1 -1
  81. package/package.json +5 -5
@@ -4,7 +4,7 @@ import ChatBody from './ChatBody';
4
4
  import ChatComposer from './ChatComposer';
5
5
  import ChatHeader from './ChatHeader';
6
6
  import SuggestedReplyPicker from './SuggestedReplyPicker';
7
- export declare type ChatBannerProps = {
7
+ export type ChatBannerProps = {
8
8
  /** Content */
9
9
  content: string;
10
10
  /** Name of the icon */
@@ -22,7 +22,7 @@ export interface ChatProps extends NoChildrenProp {
22
22
  /** Wrapper of suggested replies */
23
23
  suggestedReplyPicker?: ReactElement<typeof SuggestedReplyPicker>;
24
24
  /** chat banner */
25
- banner?: BannerProps;
25
+ banner?: Pick<BannerProps, 'variant' | 'messages'>;
26
26
  /** Wrapper of conversation input, emojis, attachments */
27
27
  footer: ReactElement<typeof ChatComposer>;
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":"A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AW,EAEX,YAAY,EACZ,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IACxC,0IAA0I;IAC1I,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6DAA6D;IAC7D,IAAI,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAC;IACpC,mCAAmC;IACnC,oBAAoB,CAAC,EAAE,YAAY,CAAC,OAAO,oBAAoB,CAAC,CAAC;IACjE,kBAAkB;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;IACnD,yDAAyD;IACzD,MAAM,EAAE,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC;CAC3C;AA8DD,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CA8CrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -61,7 +61,7 @@ const Chat = forwardRef((props, ref) => {
61
61
  direction: 'column'
62
62
  }, as: StyledUtilityMerger, children: [utility && (_jsx(Flex, { tabIndex: 0, as: StyledUtilityContainer, container: {
63
63
  direction: 'column'
64
- }, children: _jsx(StyledUtilityContent, { ref: utilityContentRef, children: utility }) })), banner && (_jsx(Banner, { id: banner.id, variant: banner.variant, heading: banner.heading, messages: banner.messages })), body] }), suggestedReplyPicker, footer] }));
64
+ }, children: _jsx(StyledUtilityContent, { ref: utilityContentRef, children: utility }) })), banner && _jsx(Banner, { variant: banner.variant, messages: banner.messages }), body] }), suggestedReplyPicker, footer] }));
65
65
  });
66
66
  export default Chat;
67
67
  //# sourceMappingURL=Chat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAIV,MAAM,EACN,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,MAAM,EAEN,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AA+BpF,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAC5C,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACzC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE1C,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;IACjD,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAC5B,OAAO,EAAE,EACP,oBAAoB,EAAE,iBAAiB,EACvC,sBAAsB,EAAE,mBAAmB,EAC5C,EACF,EACF,EACF,GAAG,KAAK,CAAC;IACV,OAAO,GAAG,CAAA;;kBAEM,iBAAiB;;MAE7B,mBAAmB;;;;;;MAMnB,sBAAsB;;;;;;;0BAOF,mBAAmB;UACnC,oBAAoB;mBACX,OAAO;sBACJ,UAAU;;;;sCAIM,mBAAmB;oDACL,mBAAmB;;;;;;;;MAQjE,YA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e,IAAI,CAAC","sourcesContent":["import {\n ReactElement,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Banner,\n BannerProps,\n defaultThemeProp,\n ForwardProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { StyledBanner } from '@pega/cosmos-react-core/lib/components/Banner/Banner';\n\nimport ChatBody from './ChatBody';\nimport ChatComposer from './ChatComposer';\nimport ChatHeader from './ChatHeader';\nimport SuggestedReplyPicker from './SuggestedReplyPicker';\n\nexport type ChatBannerProps = {\n /** Content */\n content: string;\n /** Name of the icon */\n icon: string;\n};\n\nexport interface ChatProps extends NoChildrenProp {\n /** ref to the element */\n ref?: Ref<HTMLElement>;\n /** Header of conversation pane */\n header: ReactElement<typeof ChatHeader>;\n /** Utility - This is used by utility container internally. It has predefined styles and visible conditionally based on utility prop is */\n utility?: ReactNode;\n /** Wrapper of message groups, system messages, type ahead */\n body: ReactElement<typeof ChatBody>;\n /** Wrapper of suggested replies */\n suggestedReplyPicker?: ReactElement<typeof SuggestedReplyPicker>;\n /** chat banner */\n banner?: BannerProps;\n /** Wrapper of conversation input, emojis, attachments */\n footer: ReactElement<typeof ChatComposer>;\n}\n\nconst StyledUtilityContainer = styled.div``;\nconst StyledUtilityMerger = styled.div``;\nconst StyledUtilityContent = styled.div``;\n\nconst StyledChatContainer = styled.section(props => {\n const {\n theme: {\n base: {\n spacing,\n shadow: { high: shadowHigh },\n palette: {\n 'primary-background': primaryBackground,\n 'secondary-background': secondaryBackground\n }\n }\n }\n } = props;\n return css`\n height: 100%;\n background: ${primaryBackground};\n width: 100%;\n ${StyledUtilityMerger} {\n min-height: 15rem;\n position: relative;\n height: 100%;\n overflow-y: hidden;\n }\n ${StyledUtilityContainer} {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n max-height: 60%;\n width: 100%;\n background-color: ${secondaryBackground};\n > ${StyledUtilityContent} {\n padding: ${spacing} 0;\n box-shadow: ${shadowHigh};\n height: auto;\n width: 100%;\n overflow-y: auto;\n background: linear-gradient(${secondaryBackground} 10%, rgba(255, 255, 255, 0)),\n linear-gradient(rgba(255, 255, 255, 0), ${secondaryBackground} 10%) 0 100%,\n radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)),\n radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)) 0 100%;\n background-repeat: no-repeat;\n background-size: 100% 1rem, 100% 1rem, 100% 0.25rem, 100% 0.25rem;\n background-attachment: local, local, scroll, scroll;\n }\n }\n ${StyledBanner} {\n padding: calc(2 * ${spacing});\n margin-bottom: 0;\n flex-shrink: 0;\n }\n `;\n});\n\nStyledChatContainer.defaultProps = defaultThemeProp;\n\nconst Chat: FunctionComponent<ChatProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatProps>, ref: ChatProps['ref']) => {\n const { header, body, footer, utility, banner, suggestedReplyPicker, ...restProps } = props;\n\n const utilityContentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n utilityContentRef.current?.focus();\n }, [utility]);\n\n return (\n <Flex\n ref={ref}\n as={StyledChatContainer}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n {header}\n <Flex\n container={{\n direction: 'column'\n }}\n as={StyledUtilityMerger}\n >\n {utility && (\n <Flex\n tabIndex={0}\n as={StyledUtilityContainer}\n container={{\n direction: 'column'\n }}\n >\n <StyledUtilityContent ref={utilityContentRef}>{utility}</StyledUtilityContent>\n </Flex>\n )}\n\n {banner && (\n <Banner\n id={banner.id}\n variant={banner.variant}\n heading={banner.heading}\n messages={banner.messages}\n />\n )}\n {body}\n </Flex>\n {suggestedReplyPicker}\n {footer}\n </Flex>\n );\n }\n);\n\nexport default Chat;\n"]}
1
+ {"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings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AAG,KAAK,CAAC;IAE5F,MAAM,iBAAiB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE;YACT,SAAS,EAAE,QAAQ;SACpB,KACG,SAAS,aAEZ,MAAM,EACP,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,SAAS,EAAE,QAAQ;iBACpB,EACD,EAAE,EAAE,mBAAmB,aAEtB,OAAO,IAAI,CACV,KAAC,IAAI,IACH,QAAQ,EAAE,CAAC,EACX,EAAE,EAAE,sBAAsB,EAC1B,SAAS,EAAE;4BACT,SAAS,EAAE,QAAQ;yBACpB,YAED,KAAC,oBAAoB,IAAC,GAAG,EAAE,iBAAiB,YAAG,OAAO,GAAwB,GACzE,CACR,EAEA,MAAM,IAAI,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAI,EACxE,IAAI,IACA,EACN,oBAAoB,EACpB,MAAM,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n ReactElement,\n FunctionComponent,\n forwardRef,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Banner,\n BannerProps,\n defaultThemeProp,\n ForwardProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { StyledBanner } from '@pega/cosmos-react-core/lib/components/Banner/Banner';\n\nimport ChatBody from './ChatBody';\nimport ChatComposer from './ChatComposer';\nimport ChatHeader from './ChatHeader';\nimport SuggestedReplyPicker from './SuggestedReplyPicker';\n\nexport type ChatBannerProps = {\n /** Content */\n content: string;\n /** Name of the icon */\n icon: string;\n};\n\nexport interface ChatProps extends NoChildrenProp {\n /** ref to the element */\n ref?: Ref<HTMLElement>;\n /** Header of conversation pane */\n header: ReactElement<typeof ChatHeader>;\n /** Utility - This is used by utility container internally. It has predefined styles and visible conditionally based on utility prop is */\n utility?: ReactNode;\n /** Wrapper of message groups, system messages, type ahead */\n body: ReactElement<typeof ChatBody>;\n /** Wrapper of suggested replies */\n suggestedReplyPicker?: ReactElement<typeof SuggestedReplyPicker>;\n /** chat banner */\n banner?: Pick<BannerProps, 'variant' | 'messages'>;\n /** Wrapper of conversation input, emojis, attachments */\n footer: ReactElement<typeof ChatComposer>;\n}\n\nconst StyledUtilityContainer = styled.div``;\nconst StyledUtilityMerger = styled.div``;\nconst StyledUtilityContent = styled.div``;\n\nconst StyledChatContainer = styled.section(props => {\n const {\n theme: {\n base: {\n spacing,\n shadow: { high: shadowHigh },\n palette: {\n 'primary-background': primaryBackground,\n 'secondary-background': secondaryBackground\n }\n }\n }\n } = props;\n return css`\n height: 100%;\n background: ${primaryBackground};\n width: 100%;\n ${StyledUtilityMerger} {\n min-height: 15rem;\n position: relative;\n height: 100%;\n overflow-y: hidden;\n }\n ${StyledUtilityContainer} {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n max-height: 60%;\n width: 100%;\n background-color: ${secondaryBackground};\n > ${StyledUtilityContent} {\n padding: ${spacing} 0;\n box-shadow: ${shadowHigh};\n height: auto;\n width: 100%;\n overflow-y: auto;\n background: linear-gradient(${secondaryBackground} 10%, rgba(255, 255, 255, 0)),\n linear-gradient(rgba(255, 255, 255, 0), ${secondaryBackground} 10%) 0 100%,\n radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)),\n radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)) 0 100%;\n background-repeat: no-repeat;\n background-size: 100% 1rem, 100% 1rem, 100% 0.25rem, 100% 0.25rem;\n background-attachment: local, local, scroll, scroll;\n }\n }\n ${StyledBanner} {\n padding: calc(2 * ${spacing});\n margin-bottom: 0;\n flex-shrink: 0;\n }\n `;\n});\n\nStyledChatContainer.defaultProps = defaultThemeProp;\n\nconst Chat: FunctionComponent<ChatProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatProps>, ref: ChatProps['ref']) => {\n const { header, body, footer, utility, banner, suggestedReplyPicker, ...restProps } = props;\n\n const utilityContentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n utilityContentRef.current?.focus();\n }, [utility]);\n\n return (\n <Flex\n ref={ref}\n as={StyledChatContainer}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n {header}\n <Flex\n container={{\n direction: 'column'\n }}\n as={StyledUtilityMerger}\n >\n {utility && (\n <Flex\n tabIndex={0}\n as={StyledUtilityContainer}\n container={{\n direction: 'column'\n }}\n >\n <StyledUtilityContent ref={utilityContentRef}>{utility}</StyledUtilityContent>\n </Flex>\n )}\n\n {banner && <Banner variant={banner.variant} messages={banner.messages} />}\n {body}\n </Flex>\n {suggestedReplyPicker}\n {footer}\n </Flex>\n );\n }\n);\n\nexport default Chat;\n"]}
@@ -1,4 +1,5 @@
1
- import { BaseProps, Action } from '@pega/cosmos-react-core';
1
+ import { DefaultTheme } from 'styled-components';
2
+ import { BaseProps, Action, NoChildrenProp, OmitStrict } from '@pega/cosmos-react-core';
2
3
  export interface AttachmentItemProps extends BaseProps {
3
4
  /** Unique Id for this attachment */
4
5
  id: string;
@@ -20,4 +21,14 @@ export interface AttachmentItemProps extends BaseProps {
20
21
  /** When passed, this will render a single icon button or within a MenuButton if onDelete is defined. */
21
22
  onDelete?: (id: string) => void;
22
23
  }
24
+ export type UserAvailability = 'available' | 'unavailable' | 'temporarilyUnavailable';
25
+ export interface ChatSettingsPanelProps extends NoChildrenProp {
26
+ status?: UserAvailability;
27
+ label: string;
28
+ onClick: () => void;
29
+ }
30
+ export type ColorTheme = [
31
+ keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>,
32
+ 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark'
33
+ ];
23
34
  //# sourceMappingURL=Chat.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.types.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oIAAoI;IACpI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6KAA6K;IAC7K,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC"}
1
+ {"version":3,"file":"Chat.types.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAExF,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oIAAoI;IACpI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6KAA6K;IAC7K,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,aAAa,GAAG,wBAAwB,CAAC;AAEtF,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACnE,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY;CAC3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.types.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"","sourcesContent":["import { BaseProps, Action } from '@pega/cosmos-react-core';\n\nexport interface AttachmentItemProps extends BaseProps {\n /** Unique Id for this attachment */\n id: string;\n /** Name of the attachment. */\n name: string;\n /**\n * A Cosmos icon name identifier to use for a attachment. Will serve as a fallback to a broken thumbnail.\n * @default \"document-doc\"\n */\n icon?: string;\n /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */\n thumbnail?: string;\n /** Additional information about the attachment. If progress prop is passed and its value is less than 100, this region is instead used for the upload progress indicator. */\n meta?: string;\n /** When passed, previews the attachment on click */\n onPreview?: (id: string) => void;\n /** Actions list for the attachment */\n actions?: Action[];\n /** When passed, this will render a single icon button or within a MenuButton if onDelete is defined. */\n onDelete?: (id: string) => void;\n}\n"]}
1
+ {"version":3,"file":"Chat.types.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"","sourcesContent":["import { DefaultTheme } from 'styled-components';\n\nimport { BaseProps, Action, NoChildrenProp, OmitStrict } from '@pega/cosmos-react-core';\n\nexport interface AttachmentItemProps extends BaseProps {\n /** Unique Id for this attachment */\n id: string;\n /** Name of the attachment. */\n name: string;\n /**\n * A Cosmos icon name identifier to use for a attachment. Will serve as a fallback to a broken thumbnail.\n * @default \"document-doc\"\n */\n icon?: string;\n /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */\n thumbnail?: string;\n /** Additional information about the attachment. If progress prop is passed and its value is less than 100, this region is instead used for the upload progress indicator. */\n meta?: string;\n /** When passed, previews the attachment on click */\n onPreview?: (id: string) => void;\n /** Actions list for the attachment */\n actions?: Action[];\n /** When passed, this will render a single icon button or within a MenuButton if onDelete is defined. */\n onDelete?: (id: string) => void;\n}\n\nexport type UserAvailability = 'available' | 'unavailable' | 'temporarilyUnavailable';\n\nexport interface ChatSettingsPanelProps extends NoChildrenProp {\n status?: UserAvailability;\n label: string;\n onClick: () => void;\n}\n\nexport type ColorTheme = [\n keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>,\n 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark'\n];\n"]}
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent, Ref, ReactNode, RefObject, KeyboardEvent } from 'react';
2
2
  import { ForwardProps } from '@pega/cosmos-react-core';
3
3
  import { AttachmentItemProps } from './Chat.types';
4
- export declare type SpecialKeysConfig = {
4
+ export type SpecialKeysConfig = {
5
5
  /** Collection of specialKeys */
6
6
  keys: string[];
7
7
  /** onSpecialKey is fired when a special key is typed in Textarea */
@@ -1 +1 @@
1
- {"version":3,"file":"ChatComposer.d.ts","sourceRoot":"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AAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB;IACvB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,iCAAiC,CAAC,CAAC;CAC9C;AAsFD,eAAO,MAAM,8BAA8B,yGAG1C,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,mCAAmC;IACnC,eAAe,EAAE,CACf,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,YAAY,KACjD,IAAI,CAAC;IACV,4CAA4C;IAC5C,eAAe,EAAE,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACvD,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAyTrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,16 +1,28 @@
1
- import { FunctionComponent, Ref, ReactNode } from 'react';
2
- import { ForwardProps, NoChildrenProp, SentimentProps } from '@pega/cosmos-react-core';
1
+ import { FunctionComponent, Ref, MouseEvent } from 'react';
2
+ import { ForwardProps, NoChildrenProp, SentimentProps, Action, FieldValueListItemProps } from '@pega/cosmos-react-core';
3
3
  export interface ChatHeaderProps extends NoChildrenProp {
4
4
  /** ref to the element */
5
5
  ref?: Ref<HTMLElement>;
6
- /** Title: Used to show username || channel || group name */
6
+ /** Title: Used to show channel || group name */
7
7
  title: string;
8
8
  /** Icon: Used to show the channel icons, pass the icon name from the cosmos library to render */
9
9
  icon?: string;
10
- /** Primary actions: Used to show frequent user actions to be performed */
11
- actions?: ReactNode;
10
+ /** Used to show customer name || handle */
11
+ customer: string;
12
+ /** Authentication status of the customer
13
+ * @default false
14
+ */
15
+ authenticated?: boolean;
12
16
  /** Sentiment */
13
17
  sentiment?: SentimentProps;
18
+ /** Contextual information */
19
+ context?: {
20
+ loading?: boolean;
21
+ onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
22
+ items: FieldValueListItemProps[];
23
+ };
24
+ /** Used to show frequent user actions to be performed */
25
+ actions?: Action[];
14
26
  }
15
27
  declare const ChatHeader: FunctionComponent<ChatHeaderProps & ForwardProps>;
16
28
  export default ChatHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAmB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAKL,YAAY,EACZ,cAAc,EACd,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gBAAgB;IAChB,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAqBD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CA+BjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ChatHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAmB,UAAU,EAAE,MAAM,OAAO,CAAC;AAGxF,OAAO,EAKL,YAAY,EACZ,cAAc,EACd,cAAc,EAEd,MAAM,EACN,uBAAuB,EAQxB,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB;IAChB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,6BAA6B;IAC7B,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;QACrD,KAAK,EAAE,uBAAuB,EAAE,CAAC;KAClC,CAAC;IACF,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA2BD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CA0FjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,28 +1,44 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { Text, Flex, Icon, defaultThemeProp, Sentiment, calculateFontSize } from '@pega/cosmos-react-core';
5
- const StyledChatPrimaryInfoContainer = styled.div ``;
6
- const StyledChatHeader = styled.header(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, spacing } } }) => {
7
- const fontSizes = calculateFontSize(fontSize, fontScale);
4
+ import { Text, Flex, Icon, defaultThemeProp, Sentiment, Button, Actions, useElement, InfoDialog, FieldValueList, useI18n, registerIcon } from '@pega/cosmos-react-core';
5
+ import * as userCheckIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-check.icon';
6
+ import * as userQuestionMarkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-question-mark.icon';
7
+ registerIcon(userCheckIcon, userQuestionMarkIcon);
8
+ const StyledChatHeader = styled.header(({ theme: { base: { spacing, palette: { 'border-line': borderLine } } } }) => {
8
9
  return css `
9
- padding: ${spacing} calc(2 * ${spacing});
10
- ${StyledChatPrimaryInfoContainer} {
11
- font-size: ${fontSizes.l};
12
- }
10
+ padding: ${spacing};
11
+ border-block-end: 0.0625rem solid ${borderLine};
13
12
  `;
14
13
  });
15
14
  StyledChatHeader.defaultProps = defaultThemeProp;
15
+ const StyledContextContainer = styled.div `
16
+ min-height: 2rem;
17
+ `;
18
+ const StyledInfoDialog = styled(InfoDialog) `
19
+ min-width: 50ch;
20
+ `;
16
21
  const ChatHeader = forwardRef((props, ref) => {
17
- const { title, actions, icon, sentiment, ...restProps } = props;
18
- return (_jsxs(Flex, { ref: ref, as: StyledChatHeader, container: true, item: {
22
+ const { title, actions = [], icon, customer, authenticated = false, sentiment, context, ...restProps } = props;
23
+ const t = useI18n();
24
+ const [target, setTarget] = useElement(null);
25
+ return (_jsxs(Flex, { ...restProps, ref: ref, as: StyledChatHeader, container: { alignItems: 'start' }, item: {
19
26
  shrink: 0
20
- }, ...restProps, children: [_jsxs(Flex, { item: {
27
+ }, children: [_jsxs(Flex, { item: {
21
28
  grow: 1
22
29
  }, container: {
23
- gap: 2,
24
- alignItems: 'center'
25
- }, as: StyledChatPrimaryInfoContainer, children: [icon && _jsx(Icon, { name: icon }), _jsx(Text, { variant: 'h3', children: title }), sentiment && _jsx(Sentiment, { ...sentiment, labelHidden: true })] }), actions] }));
30
+ gap: 0.5,
31
+ alignItems: 'start',
32
+ direction: 'column'
33
+ }, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [icon && _jsx(Icon, { name: icon }), _jsx(Text, { variant: 'h2', children: title })] }), _jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Icon, { role: 'img', name: authenticated ? 'user-check' : 'user-question-mark', "aria-label": authenticated ? t('authenticated') : t('not_authenticated') }), _jsx(Text, { variant: 'secondary', children: customer }), sentiment && _jsx(Sentiment, { ...sentiment, labelHidden: true })] })] }), _jsxs(Flex, { item: {
34
+ grow: 1
35
+ }, container: {
36
+ alignItems: 'center',
37
+ justify: 'end'
38
+ }, children: [context && (_jsx(Button, { variant: 'simple', onClick: (e) => {
39
+ context.onClick?.(e);
40
+ setTarget(e.currentTarget);
41
+ }, children: t('context') })), _jsx(Actions, { items: actions })] }), target && context && (_jsx(StyledInfoDialog, { heading: t('chat_context'), target: target, onDismiss: () => setTarget(null), placement: 'bottom-end', progress: context.loading, children: _jsx(Flex, { as: StyledContextContainer, container: true, children: _jsx(FieldValueList, { fields: context.items }) }) }))] }));
26
42
  });
27
43
  export default ChatHeader;
28
44
  //# sourceMappingURL=ChatHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatHeader.js","sourceRoot":"","sources":["../../../src/components/Chat/ChatHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,gBAAgB,EAIhB,SAAS,EACT,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAejC,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEpD,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,EAClE,EACF,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzD,OAAO,GAAG,CAAA;iBACG,OAAO,aAAa,OAAO;QACpC,8BAA8B;qBACjB,SAAS,CAAC,CAAC;;KAE3B,CAAC;AACJ,CAAC,CACF,CAAC;AACF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,UAAU,GAAsD,UAAU,CAC9E,CAAC,KAAuC,EAAE,GAA2B,EAAE,EAAE;IACvE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAChE,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,gBAAgB,EACpB,SAAS,QACT,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC;SACV,KACG,SAAS,aAEb,MAAC,IAAI,IACH,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC;iBACR,EACD,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,UAAU,EAAE,QAAQ;iBACrB,EACD,EAAE,EAAE,8BAA8B,aAEjC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EAC7B,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EAChC,SAAS,IAAI,KAAC,SAAS,OAAK,SAAS,EAAE,WAAW,SAAG,IACjD,EACN,OAAO,IACH,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, Ref, PropsWithoutRef, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Text,\n Flex,\n Icon,\n defaultThemeProp,\n ForwardProps,\n NoChildrenProp,\n SentimentProps,\n Sentiment,\n calculateFontSize\n} from '@pega/cosmos-react-core';\n\nexport interface ChatHeaderProps extends NoChildrenProp {\n /** ref to the element */\n ref?: Ref<HTMLElement>;\n /** Title: Used to show username || channel || group name */\n title: string;\n /** Icon: Used to show the channel icons, pass the icon name from the cosmos library to render */\n icon?: string;\n /** Primary actions: Used to show frequent user actions to be performed */\n actions?: ReactNode;\n /** Sentiment */\n sentiment?: SentimentProps;\n}\n\nconst StyledChatPrimaryInfoContainer = styled.div``;\n\nconst StyledChatHeader = styled.header(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n return css`\n padding: ${spacing} calc(2 * ${spacing});\n ${StyledChatPrimaryInfoContainer} {\n font-size: ${fontSizes.l};\n }\n `;\n }\n);\nStyledChatHeader.defaultProps = defaultThemeProp;\n\nconst ChatHeader: FunctionComponent<ChatHeaderProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatHeaderProps>, ref: ChatHeaderProps['ref']) => {\n const { title, actions, icon, sentiment, ...restProps } = props;\n return (\n <Flex\n ref={ref}\n as={StyledChatHeader}\n container\n item={{\n shrink: 0\n }}\n {...restProps}\n >\n <Flex\n item={{\n grow: 1\n }}\n container={{\n gap: 2,\n alignItems: 'center'\n }}\n as={StyledChatPrimaryInfoContainer}\n >\n {icon && <Icon name={icon} />}\n <Text variant='h3'>{title}</Text>\n {sentiment && <Sentiment {...sentiment} labelHidden />}\n </Flex>\n {actions}\n </Flex>\n );\n }\n);\n\nexport default ChatHeader;\n"]}
1
+ {"version":3,"file":"ChatHeader.js","sourceRoot":"","sources":["../../../src/components/Chat/ChatHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuD,MAAM,OAAO,CAAC;AACxF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ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,CAAC,CAAC,SAAS,CAAC,GACN,CACV,EAED,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,GAAI,IACtB,EACN,MAAM,IAAI,OAAO,IAAI,CACpB,KAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,cAAc,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAChC,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAE,OAAO,CAAC,OAAO,YAEzB,KAAC,IAAI,IAAC,EAAE,EAAE,sBAAsB,EAAE,SAAS,kBACzC,KAAC,cAAc,IAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAI,GACpC,GACU,CACpB,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, Ref, PropsWithoutRef, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Text,\n Flex,\n Icon,\n defaultThemeProp,\n ForwardProps,\n NoChildrenProp,\n SentimentProps,\n Sentiment,\n Action,\n FieldValueListItemProps,\n Button,\n Actions,\n useElement,\n InfoDialog,\n FieldValueList,\n useI18n,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport * as userCheckIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-check.icon';\nimport * as userQuestionMarkIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/user-question-mark.icon';\n\nregisterIcon(userCheckIcon, userQuestionMarkIcon);\n\nexport interface ChatHeaderProps extends NoChildrenProp {\n /** ref to the element */\n ref?: Ref<HTMLElement>;\n /** Title: Used to show channel || group name */\n title: string;\n /** Icon: Used to show the channel icons, pass the icon name from the cosmos library to render */\n icon?: string;\n /** Used to show customer name || handle */\n customer: string;\n /** Authentication status of the customer\n * @default false\n */\n authenticated?: boolean;\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Contextual information */\n context?: {\n loading?: boolean;\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n items: FieldValueListItemProps[];\n };\n /** Used to show frequent user actions to be performed */\n actions?: Action[];\n}\n\nconst StyledChatHeader = styled.header(\n ({\n theme: {\n base: {\n spacing,\n palette: { 'border-line': borderLine }\n }\n }\n }) => {\n return css`\n padding: ${spacing};\n border-block-end: 0.0625rem solid ${borderLine};\n `;\n }\n);\nStyledChatHeader.defaultProps = defaultThemeProp;\n\nconst StyledContextContainer = styled.div`\n min-height: 2rem;\n`;\n\nconst StyledInfoDialog = styled(InfoDialog)`\n min-width: 50ch;\n`;\n\nconst ChatHeader: FunctionComponent<ChatHeaderProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatHeaderProps>, ref: ChatHeaderProps['ref']) => {\n const {\n title,\n actions = [],\n icon,\n customer,\n authenticated = false,\n sentiment,\n context,\n ...restProps\n } = props;\n\n const t = useI18n();\n const [target, setTarget] = useElement<HTMLButtonElement>(null);\n\n return (\n <Flex\n {...restProps}\n ref={ref}\n as={StyledChatHeader}\n container={{ alignItems: 'start' }}\n item={{\n shrink: 0\n }}\n >\n <Flex\n item={{\n grow: 1\n }}\n container={{\n gap: 0.5,\n alignItems: 'start',\n direction: 'column'\n }}\n >\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n {icon && <Icon name={icon} />}\n <Text variant='h2'>{title}</Text>\n </Flex>\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Icon\n role='img'\n name={authenticated ? 'user-check' : 'user-question-mark'}\n aria-label={authenticated ? t('authenticated') : t('not_authenticated')}\n />\n <Text variant='secondary'>{customer}</Text>\n {sentiment && <Sentiment {...sentiment} labelHidden />}\n </Flex>\n </Flex>\n\n <Flex\n item={{\n grow: 1\n }}\n container={{\n alignItems: 'center',\n justify: 'end'\n }}\n >\n {context && (\n <Button\n variant='simple'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n context.onClick?.(e);\n setTarget(e.currentTarget);\n }}\n >\n {t('context')}\n </Button>\n )}\n\n <Actions items={actions} />\n </Flex>\n {target && context && (\n <StyledInfoDialog\n heading={t('chat_context')}\n target={target}\n onDismiss={() => setTarget(null)}\n placement='bottom-end'\n progress={context.loading}\n >\n <Flex as={StyledContextContainer} container>\n <FieldValueList fields={context.items} />\n </Flex>\n </StyledInfoDialog>\n )}\n </Flex>\n );\n }\n);\n\nexport default ChatHeader;\n"]}
@@ -0,0 +1,7 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps, OmitStrict } from '@pega/cosmos-react-core';
3
+ import type { ChatSettingsPanelProps } from './Chat.types';
4
+ export declare const ChatControlPanelIcon: FunctionComponent<OmitStrict<ChatSettingsPanelProps, 'onClick'> & ForwardProps>;
5
+ declare const ChatSettingsPanel: FunctionComponent<ChatSettingsPanelProps & ForwardProps>;
6
+ export default ChatSettingsPanel;
7
+ //# sourceMappingURL=ChatSettingsPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatSettingsPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatSettingsPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EACL,YAAY,EAEZ,UAAU,EAKX,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAS3D,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAClD,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAAG,YAAY,CAa7D,CAAC;AAEF,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CAc/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon, registerIcon, StyledAvatar, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';
3
+ import * as chatIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chat.icon';
4
+ import { NavigationListItem } from '@pega/cosmos-react-core/lib/components/AppShell/NavigationList';
5
+ import { StyledChatControlPanelIcon, StyledUserStatusIcon, userAvailabilityTheme } from './ChatSettingsPanel.styles';
6
+ registerIcon(chatIcon);
7
+ export const ChatControlPanelIcon = ({ status, label, ...restProps }) => {
8
+ return (_jsxs(StyledChatControlPanelIcon, { as: StyledAvatar, ...restProps, size: 'm', userStatus: status, children: [_jsx(Icon, { name: 'chat' }), status && userAvailabilityTheme[status].icon && (_jsx(StyledUserStatusIcon, { userStatus: status, children: _jsx(Icon, { name: userAvailabilityTheme[status].icon }) })), _jsx(VisuallyHiddenText, { children: label })] }));
9
+ };
10
+ const ChatSettingsPanel = ({ status, label, onClick, ...restProps }) => {
11
+ const t = useI18n();
12
+ return (_jsx(NavigationListItem, { primary: status ? `${label} (${t(status)})` : label, visual: _jsx(ChatControlPanelIcon, { status: status, label: label, ...restProps }), onClick: onClick }));
13
+ };
14
+ export default ChatSettingsPanel;
15
+ //# sourceMappingURL=ChatSettingsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatSettingsPanel.js","sourceRoot":"","sources":["../../../src/components/Chat/ChatSettingsPanel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,IAAI,EAEJ,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAC;AAGpG,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,CAAC,MAAM,oBAAoB,GAE7B,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;IACtC,OAAO,CACL,MAAC,0BAA0B,IAAC,EAAE,EAAE,YAAY,KAAM,SAAS,EAAE,IAAI,EAAC,GAAG,EAAC,UAAU,EAAE,MAAM,aACtF,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,EACnB,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAC/C,KAAC,oBAAoB,IAAC,UAAU,EAAE,MAAM,YACtC,KAAC,IAAI,IAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAK,GAAI,GAC9B,CACxB,EACD,KAAC,kBAAkB,cAAE,KAAK,GAAsB,IACrB,CAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAA6D,CAAC,EACnF,MAAM,EACN,KAAK,EACL,OAAO,EACP,GAAG,SAAS,EACb,EAAE,EAAE;IACH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO,CACL,KAAC,kBAAkB,IACjB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EACnD,MAAM,EAAE,KAAC,oBAAoB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAM,SAAS,GAAI,EAC7E,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\n\nimport {\n ForwardProps,\n Icon,\n OmitStrict,\n registerIcon,\n StyledAvatar,\n useI18n,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport * as chatIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chat.icon';\nimport { NavigationListItem } from '@pega/cosmos-react-core/lib/components/AppShell/NavigationList';\n\nimport type { ChatSettingsPanelProps } from './Chat.types';\nimport {\n StyledChatControlPanelIcon,\n StyledUserStatusIcon,\n userAvailabilityTheme\n} from './ChatSettingsPanel.styles';\n\nregisterIcon(chatIcon);\n\nexport const ChatControlPanelIcon: FunctionComponent<\n OmitStrict<ChatSettingsPanelProps, 'onClick'> & ForwardProps\n> = ({ status, label, ...restProps }) => {\n return (\n <StyledChatControlPanelIcon as={StyledAvatar} {...restProps} size='m' userStatus={status}>\n <Icon name='chat' />\n {status && userAvailabilityTheme[status].icon && (\n <StyledUserStatusIcon userStatus={status}>\n <Icon name={userAvailabilityTheme[status].icon!} />\n </StyledUserStatusIcon>\n )}\n <VisuallyHiddenText>{label}</VisuallyHiddenText>\n </StyledChatControlPanelIcon>\n );\n};\n\nconst ChatSettingsPanel: FunctionComponent<ChatSettingsPanelProps & ForwardProps> = ({\n status,\n label,\n onClick,\n ...restProps\n}) => {\n const t = useI18n();\n return (\n <NavigationListItem\n primary={status ? `${label} (${t(status)})` : label}\n visual={<ChatControlPanelIcon status={status} label={label} {...restProps} />}\n onClick={onClick}\n />\n );\n};\n\nexport default ChatSettingsPanel;\n"]}
@@ -0,0 +1,16 @@
1
+ import { IconName } from '@pega/cosmos-react-core';
2
+ import { ColorTheme, UserAvailability } from './Chat.types';
3
+ export declare const userAvailabilityTheme: Record<UserAvailability, {
4
+ icon?: IconName;
5
+ color: ColorTheme;
6
+ }>;
7
+ export declare const StyledStatusIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
8
+ userStatus: UserAvailability;
9
+ }, never>;
10
+ export declare const StyledUserStatusIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
11
+ userStatus: UserAvailability;
12
+ }, never>;
13
+ export declare const StyledChatControlPanelIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
14
+ userStatus: UserAvailability;
15
+ }, never>;
16
+ //# sourceMappingURL=ChatSettingsPanel.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatSettingsPanel.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatSettingsPanel.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,QAAQ,EAA4B,MAAM,yBAAyB,CAAC;AAI/F,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAI5D,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,gBAAgB,EAChB;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAKvC,CAAC;AAEF,eAAO,MAAM,gBAAgB;gBACf,gBAAgB;SAkB7B,CAAC;AAIF,eAAO,MAAM,oBAAoB;gBAtBnB,gBAAgB;SAiC5B,CAAC;AAIH,eAAO,MAAM,0BAA0B;gBArCzB,gBAAgB;SA8C7B,CAAC"}
@@ -0,0 +1,47 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { readableColor } from 'polished';
3
+ import { defaultThemeProp, registerIcon, StyledIcon } from '@pega/cosmos-react-core';
4
+ import * as minus from '@pega/cosmos-react-core/lib/components/Icon/icons/minus.icon';
5
+ import * as clock from '@pega/cosmos-react-core/lib/components/Icon/icons/clock.icon';
6
+ registerIcon(minus, clock);
7
+ export const userAvailabilityTheme = {
8
+ available: { color: ['green', 'light'] },
9
+ unavailable: { icon: 'minus', color: ['red', 'medium'] },
10
+ temporarilyUnavailable: { icon: 'clock', color: ['orange', 'light'] }
11
+ };
12
+ export const StyledStatusIcon = styled.div(({ theme: { base: { colors } }, userStatus }) => {
13
+ const [colorName, colorVariant] = userStatus
14
+ ? userAvailabilityTheme[userStatus]?.color
15
+ : ['slate', 'light'];
16
+ const bgColor = colors[colorName][colorVariant];
17
+ const fgColor = readableColor(bgColor);
18
+ return css `
19
+ background-color: ${bgColor};
20
+ color: ${fgColor};
21
+ `;
22
+ });
23
+ StyledStatusIcon.defaultProps = defaultThemeProp;
24
+ export const StyledUserStatusIcon = styled(StyledStatusIcon)(({ theme }) => {
25
+ return css `
26
+ border-radius: 50%;
27
+ border: 0.0625rem solid ${theme.components['app-shell'].nav['background-color']};
28
+
29
+ ${StyledIcon} {
30
+ display: block;
31
+ width: 100%;
32
+ margin: 0 auto;
33
+ }
34
+ `;
35
+ });
36
+ StyledUserStatusIcon.defaultProps = defaultThemeProp;
37
+ export const StyledChatControlPanelIcon = styled(StyledStatusIcon) `
38
+ ${StyledUserStatusIcon} {
39
+ position: absolute;
40
+ width: 0.875rem;
41
+ height: 0.875rem;
42
+ z-index: 1;
43
+ inset-block-start: -0.25rem;
44
+ inset-inline-end: -0.25rem;
45
+ }
46
+ `;
47
+ //# sourceMappingURL=ChatSettingsPanel.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatSettingsPanel.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/ChatSettingsPanel.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAY,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,KAAK,KAAK,MAAM,8DAA8D,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,8DAA8D,CAAC;AAItF,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;IACxC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;IACxD,sBAAsB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAGxC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,MAAM,EAAE,EACjB,EACD,UAAU,EACX,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAe,UAAU;QACtD,CAAC,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,KAAK;QAC1C,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,GAAG,CAAA;0BACY,OAAO;eAClB,OAAO;KACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzE,OAAO,GAAG,CAAA;;8BAEkB,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;;MAE7E,UAAU;;;;;GAKb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAC9D,oBAAoB;;;;;;;;CAQvB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp, IconName, registerIcon, StyledIcon } from '@pega/cosmos-react-core';\nimport * as minus from '@pega/cosmos-react-core/lib/components/Icon/icons/minus.icon';\nimport * as clock from '@pega/cosmos-react-core/lib/components/Icon/icons/clock.icon';\n\nimport { ColorTheme, UserAvailability } from './Chat.types';\n\nregisterIcon(minus, clock);\n\nexport const userAvailabilityTheme: Record<\n UserAvailability,\n { icon?: IconName; color: ColorTheme }\n> = {\n available: { color: ['green', 'light'] },\n unavailable: { icon: 'minus', color: ['red', 'medium'] },\n temporarilyUnavailable: { icon: 'clock', color: ['orange', 'light'] }\n};\n\nexport const StyledStatusIcon = styled.div<{\n userStatus: UserAvailability;\n}>(\n ({\n theme: {\n base: { colors }\n },\n userStatus\n }) => {\n const [colorName, colorVariant]: ColorTheme = userStatus\n ? userAvailabilityTheme[userStatus]?.color\n : ['slate', 'light'];\n const bgColor = colors[colorName][colorVariant];\n const fgColor = readableColor(bgColor);\n return css`\n background-color: ${bgColor};\n color: ${fgColor};\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledUserStatusIcon = styled(StyledStatusIcon)(({ theme }) => {\n return css`\n border-radius: 50%;\n border: 0.0625rem solid ${theme.components['app-shell'].nav['background-color']};\n\n ${StyledIcon} {\n display: block;\n width: 100%;\n margin: 0 auto;\n }\n `;\n});\n\nStyledUserStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledChatControlPanelIcon = styled(StyledStatusIcon)`\n ${StyledUserStatusIcon} {\n position: absolute;\n width: 0.875rem;\n height: 0.875rem;\n z-index: 1;\n inset-block-start: -0.25rem;\n inset-inline-end: -0.25rem;\n }\n`;\n"]}
@@ -3,7 +3,7 @@ import { ForwardProps } from '@pega/cosmos-react-core';
3
3
  import { RepeatingViewRow } from './RepeatingView';
4
4
  import { TranscriptMessageProps } from './TranscriptMessage';
5
5
  import { SystemMessageProps } from './SystemMessage';
6
- export declare type ChatTranscriptItem = (TranscriptMessageProps & {
6
+ export type ChatTranscriptItem = (TranscriptMessageProps & {
7
7
  type: 'transcript';
8
8
  id: RepeatingViewRow['id'];
9
9
  }) | (SystemMessageProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"ChatTranscript.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatTranscript.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAA0B,YAAY,EAAQ,MAAM,yBAAyB,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,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAC7E,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,mBAAmB;IAClC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAgCD,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAwCzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -9,7 +9,7 @@ export interface MediaPageLinks extends Pick<LinkProps, 'href'> {
9
9
  /** Additional information about the linked resource. */
10
10
  title?: string;
11
11
  }
12
- export declare type MessageHeaderProps = {
12
+ export type MessageHeaderProps = {
13
13
  /** message header content */
14
14
  content?: ReactNode;
15
15
  /** meta data */
@@ -1 +1 @@
1
- {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,SAAS,EAET,GAAG,EAGJ,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,WAAW,EAKX,SAAS,EAMT,YAAY,EAGb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwBnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IAC7D,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oBAAY,kBAAk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AA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAgM3D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -9,7 +9,7 @@ export interface MessageListImperativeHandleProps {
9
9
  scrollToLatestMessage: () => void;
10
10
  scrollToNewMessage: () => void;
11
11
  }
12
- export declare type MessageListItemProps = (MessageProps & {
12
+ export type MessageListItemProps = (MessageProps & {
13
13
  type: 'message';
14
14
  id: RepeatingViewRow['id'];
15
15
  }) | (SystemMessageProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,GAAG,EAOJ,MAAM,OAAO,CAAC;AAGf,OAAO,EASL,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AAGjC,OAAsB,EACpB,kBAAkB,EAClB,gBAAgB,EAIjB,MAAM,iBAAiB,CAAC;AACzB,OAAgB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIpE,MAAM,WAAW,gCAAgC;IAC/C,kBAAkB,EAAE,MAAM,OAAO,CAAC;IAClC,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,oBAAY,oBAAoB,GAC5B,CAAC,YAAY,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAChE,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GACrE,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;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,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAChE,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GACrE,CAAC,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,gBACf,SAAQ,UAAU,CAAC,kBAAkB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;IACnE,0BAA0B;IAC1B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC5C,4BAA4B;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0BAA0B;IAC1B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAID,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAsD7D,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CA4InE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -54,6 +54,7 @@ const MessageList = forwardRef((props, ref) => {
54
54
  const { messages, unReadMessageCount = 0, onScrollToButtonClick, ...restProps } = props;
55
55
  const t = useI18n();
56
56
  const conversationRef = useRef(null);
57
+ const scrollRef = useRef(false);
57
58
  const isScrolledToLatest = useCallback(() => {
58
59
  return conversationRef.current
59
60
  ? conversationRef.current.scrollHeight -
@@ -69,8 +70,18 @@ const MessageList = forwardRef((props, ref) => {
69
70
  }, [conversationRef.current]);
70
71
  const [displayScrollLatest, setDisplayScrollToLatest] = useState(false);
71
72
  const onMessageListScroll = useCallback(() => {
72
- setDisplayScrollToLatest(!isScrolledToLatest());
73
- }, [isScrolledToLatest()]);
73
+ const isScrolled = isScrolledToLatest();
74
+ if (scrollRef.current && isScrolled) {
75
+ scrollRef.current = false;
76
+ if (unReadMessageCount) {
77
+ onScrollToButtonClick?.();
78
+ }
79
+ }
80
+ if (!scrollRef.current && !isScrolled) {
81
+ scrollRef.current = true;
82
+ }
83
+ setDisplayScrollToLatest(!isScrolled);
84
+ }, [isScrolledToLatest(), unReadMessageCount]);
74
85
  const scrollToNewMessage = useCallback(() => {
75
86
  if (conversationRef.current) {
76
87
  setDisplayScrollToLatest(false);
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../../src/components/Chat/MessageList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAEV,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EAEhB,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAEnG,OAAO,aAAa,EAAE,EAGpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,OAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AACpE,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AAEpE,YAAY,CAAC,aAAa,CAAC,CAAC;AAyB5B,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE7D,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;IACpD,MAAM,EACJ,KAAK,EAAE,EACL,IA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KAAK,qBAAqB,EAAE;oCAChC,UAAU,CAAC,4BAA4B,CAAC,GAAG,qBAAqB,CAAC;iCAClE;gCACD,OAAO,CACL,KAAC,aAAa,OAEP,wBAA+C,KAChD,UAAU,IAFT,EAAE,CAGP,CACH,CAAC;6BACH;4BACD,IAAI,IAAI,KAAK,QAAQ,EAAE;gCACrB,OAAO,CACL,KAAC,aAAa,OAAe,wBAA+C,IAAxD,EAAE,CAA0D,CACjF,CAAC;6BACH;wBACH,CAAC,GACa,IACX,EACN,kBAAkB,EAAE,IAAI,KAAC,cAAc,IAAC,kBAAkB,EAAE,eAAe,GAAI,IAC/E,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n useCallback,\n useState,\n useLayoutEffect,\n RefObject\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n StyledButton,\n useI18n,\n debounce,\n defaultThemeProp,\n ForwardProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\n\nimport RepeatingView, {\n RepeatingViewProps,\n RepeatingViewRow,\n StyledRepeatingView,\n StyledRepeatingViewItem,\n StyledRepeatingViewUL\n} from './RepeatingView';\nimport Message, { MessageProps } from './Message';\nimport SystemMessage, { SystemMessageProps } from './SystemMessage';\nimport TypeIndicator, { TypeIndicatorProps } from './TypeIndicator';\n\nregisterIcon(caretDownIcon);\n\nexport interface MessageListImperativeHandleProps {\n isScrolledToLatest: () => boolean;\n scrollToLatestMessage: () => void;\n scrollToNewMessage: () => void;\n}\n\nexport type MessageListItemProps =\n | (MessageProps & { type: 'message'; id: RepeatingViewRow['id'] })\n | (SystemMessageProps & { type: 'system'; id: RepeatingViewRow['id'] })\n | (TypeIndicatorProps & { type: 'typing'; id: RepeatingViewRow['id'] });\n\nexport interface MessageListProps\n extends OmitStrict<RepeatingViewProps, 'children' | 'rows' | 'ref'> {\n /** Messages Data array */\n messages: MessageListItemProps[];\n /** ref to the message list */\n ref?: Ref<MessageListImperativeHandleProps>;\n /** Total unread messages */\n unReadMessageCount?: number;\n /** on scroll to button */\n onScrollToButtonClick?: () => void;\n}\n\nconst StyledMessageList = styled.div``;\n\nexport const NewMessageSeparatorId = 'new-message-separator';\n\nconst StyledMessageListContainer = styled.div(props => {\n const {\n theme: {\n base: {\n shadow: { high: shadowHigh },\n colors: { white }\n }\n }\n } = props;\n return css`\n position: relative;\n overflow-y: hidden;\n > ${StyledMessageList} {\n overflow-y: auto;\n }\n > ${StyledButton} {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n box-shadow: ${shadowHigh};\n z-index: 1;\n background-color: ${white};\n }\n ${StyledRepeatingView} {\n overflow-y: hidden;\n }\n ${StyledRepeatingViewUL} {\n padding: 1rem;\n }\n\n ${StyledRepeatingViewItem} {\n padding: 0.125rem 0;\n }\n `;\n});\n\nStyledMessageListContainer.defaultProps = defaultThemeProp;\n\nconst ScrollToLatest: FunctionComponent<{\n scrollContainerRef: RefObject<HTMLUListElement>;\n}> = props => {\n const { scrollContainerRef } = props;\n useLayoutEffect(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTop =\n scrollContainerRef.current.scrollHeight - scrollContainerRef.current.offsetHeight;\n }\n });\n return <></>;\n};\n\nconst MessageList: FunctionComponent<MessageListProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MessageListProps>, ref: MessageListProps['ref']) => {\n const { messages, unReadMessageCount = 0, onScrollToButtonClick, ...restProps } = props;\n\n const t = useI18n();\n\n const conversationRef = useRef<HTMLUListElement>(null);\n\n const isScrolledToLatest: MessageListImperativeHandleProps['isScrolledToLatest'] =\n useCallback(() => {\n return conversationRef.current\n ? conversationRef.current.scrollHeight -\n conversationRef.current.scrollTop -\n conversationRef.current.offsetHeight <=\n 30\n : true;\n }, [conversationRef.current]);\n\n const scrollToLatestMessage: MessageListImperativeHandleProps['scrollToLatestMessage'] =\n useCallback(() => {\n if (conversationRef.current) {\n conversationRef.current.scrollTop = conversationRef.current.scrollHeight;\n }\n }, [conversationRef.current]);\n\n const [displayScrollLatest, setDisplayScrollToLatest] = useState(false);\n\n const onMessageListScroll = useCallback(() => {\n setDisplayScrollToLatest(!isScrolledToLatest());\n }, [isScrolledToLatest()]);\n\n const scrollToNewMessage: MessageListImperativeHandleProps['scrollToNewMessage'] =\n useCallback(() => {\n if (conversationRef.current) {\n setDisplayScrollToLatest(false);\n const newMessageIndicatorEle = conversationRef.current.querySelector<HTMLElement>(\n '[data-new-message-separator]'\n );\n if (newMessageIndicatorEle) {\n conversationRef.current.scrollTop = newMessageIndicatorEle.offsetTop;\n } else {\n conversationRef.current.scrollTop = conversationRef.current.scrollHeight;\n }\n }\n }, [conversationRef.current]);\n\n useImperativeHandle<MessageListImperativeHandleProps, MessageListImperativeHandleProps>(\n ref,\n () => ({\n isScrolledToLatest,\n scrollToLatestMessage,\n scrollToNewMessage\n }),\n [isScrolledToLatest, scrollToLatestMessage, scrollToNewMessage]\n );\n\n return (\n <>\n <Flex\n as={StyledMessageListContainer}\n item={{\n grow: 1\n }}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n {(unReadMessageCount > 0 || displayScrollLatest) && (\n <Button\n aria-label={\n unReadMessageCount > 0\n ? t('scroll_to_unread_messages')\n : t('scroll_to_latest_message')\n }\n onClick={() => {\n if (unReadMessageCount > 0) {\n scrollToNewMessage();\n } else {\n scrollToLatestMessage();\n }\n onScrollToButtonClick?.();\n }}\n icon={unReadMessageCount === 0}\n >\n <Icon name='caret-down' />\n {unReadMessageCount > 0 && <>&nbsp; {t('new_messages')}</>}\n </Button>\n )}\n <RepeatingView\n as={StyledMessageList}\n container={{ direction: 'column' }}\n ref={conversationRef}\n rows={messages}\n onScroll={debounce(onMessageListScroll, 100)}\n {...restProps}\n >\n {(item: RepeatingViewRow) => {\n const { id, type, ...messageListItemRestProps } = item as MessageListItemProps;\n if (type === 'message') {\n return <Message key={id} {...(messageListItemRestProps as MessageProps)} />;\n }\n\n if (type === 'system') {\n const extraProps: Record<string, string> = {};\n if (id === NewMessageSeparatorId) {\n extraProps['data-new-message-separator'] = NewMessageSeparatorId;\n }\n return (\n <SystemMessage\n key={id}\n {...(messageListItemRestProps as SystemMessageProps)}\n {...extraProps}\n />\n );\n }\n if (type === 'typing') {\n return (\n <TypeIndicator key={id} {...(messageListItemRestProps as TypeIndicatorProps)} />\n );\n }\n }}\n </RepeatingView>\n </Flex>\n {isScrolledToLatest() && <ScrollToLatest scrollContainerRef={conversationRef} />}\n </>\n );\n }\n);\n\nexport default MessageList;\n"]}
1
+ {"version":3,"file":"MessageList.js","sourceRoot":"","sources":["../../../src/components/Chat/MessageList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EAEV,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EAEhB,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAEnG,OAAO,aAAa,EAAE,EAGpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,OAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AACpE,OAAO,aAAqC,MAAM,iBAAiB,CAAC;AAEpE,YAAY,CAAC,aAAa,CAAC,CAAC;AAyB5B,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AA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KAAC,aAAa,IACZ,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,CAAC,KACxC,SAAS,YAEZ,CAAC,IAAsB,EAAE,EAAE;4BAC1B,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,wBAAwB,EAAE,GAAG,IAA4B,CAAC;4BAC/E,IAAI,IAAI,KAAK,SAAS,EAAE;gCACtB,OAAO,KAAC,OAAO,OAAe,wBAAyC,IAAlD,EAAE,CAAoD,CAAC;6BAC7E;4BAED,IAAI,IAAI,KAAK,QAAQ,EAAE;gCACrB,MAAM,UAAU,GAA2B,EAAE,CAAC;gCAC9C,IAAI,EAAE,KAAK,qBAAqB,EAAE;oCAChC,UAAU,CAAC,4BAA4B,CAAC,GAAG,qBAAqB,CAAC;iCAClE;gCACD,OAAO,CACL,KAAC,aAAa,OAEP,wBAA+C,KAChD,UAAU,IAFT,EAAE,CAGP,CACH,CAAC;6BACH;4BACD,IAAI,IAAI,KAAK,QAAQ,EAAE;gCACrB,OAAO,CACL,KAAC,aAAa,OAAe,wBAA+C,IAAxD,EAAE,CAA0D,CACjF,CAAC;6BACH;wBACH,CAAC,GACa,IACX,EACN,kBAAkB,EAAE,IAAI,KAAC,cAAc,IAAC,kBAAkB,EAAE,eAAe,GAAI,IAC/E,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n useCallback,\n useState,\n useLayoutEffect,\n RefObject\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n StyledButton,\n useI18n,\n debounce,\n defaultThemeProp,\n ForwardProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\n\nimport RepeatingView, {\n RepeatingViewProps,\n RepeatingViewRow,\n StyledRepeatingView,\n StyledRepeatingViewItem,\n StyledRepeatingViewUL\n} from './RepeatingView';\nimport Message, { MessageProps } from './Message';\nimport SystemMessage, { SystemMessageProps } from './SystemMessage';\nimport TypeIndicator, { TypeIndicatorProps } from './TypeIndicator';\n\nregisterIcon(caretDownIcon);\n\nexport interface MessageListImperativeHandleProps {\n isScrolledToLatest: () => boolean;\n scrollToLatestMessage: () => void;\n scrollToNewMessage: () => void;\n}\n\nexport type MessageListItemProps =\n | (MessageProps & { type: 'message'; id: RepeatingViewRow['id'] })\n | (SystemMessageProps & { type: 'system'; id: RepeatingViewRow['id'] })\n | (TypeIndicatorProps & { type: 'typing'; id: RepeatingViewRow['id'] });\n\nexport interface MessageListProps\n extends OmitStrict<RepeatingViewProps, 'children' | 'rows' | 'ref'> {\n /** Messages Data array */\n messages: MessageListItemProps[];\n /** ref to the message list */\n ref?: Ref<MessageListImperativeHandleProps>;\n /** Total unread messages */\n unReadMessageCount?: number;\n /** on scroll to button */\n onScrollToButtonClick?: () => void;\n}\n\nconst StyledMessageList = styled.div``;\n\nexport const NewMessageSeparatorId = 'new-message-separator';\n\nconst StyledMessageListContainer = styled.div(props => {\n const {\n theme: {\n base: {\n shadow: { high: shadowHigh },\n colors: { white }\n }\n }\n } = props;\n return css`\n position: relative;\n overflow-y: hidden;\n > ${StyledMessageList} {\n overflow-y: auto;\n }\n > ${StyledButton} {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n box-shadow: ${shadowHigh};\n z-index: 1;\n background-color: ${white};\n }\n ${StyledRepeatingView} {\n overflow-y: hidden;\n }\n ${StyledRepeatingViewUL} {\n padding: 1rem;\n }\n\n ${StyledRepeatingViewItem} {\n padding: 0.125rem 0;\n }\n `;\n});\n\nStyledMessageListContainer.defaultProps = defaultThemeProp;\n\nconst ScrollToLatest: FunctionComponent<{\n scrollContainerRef: RefObject<HTMLUListElement>;\n}> = props => {\n const { scrollContainerRef } = props;\n useLayoutEffect(() => {\n if (scrollContainerRef.current) {\n scrollContainerRef.current.scrollTop =\n scrollContainerRef.current.scrollHeight - scrollContainerRef.current.offsetHeight;\n }\n });\n return <></>;\n};\n\nconst MessageList: FunctionComponent<MessageListProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MessageListProps>, ref: MessageListProps['ref']) => {\n const { messages, unReadMessageCount = 0, onScrollToButtonClick, ...restProps } = props;\n\n const t = useI18n();\n const conversationRef = useRef<HTMLUListElement>(null);\n const scrollRef = useRef(false);\n\n const isScrolledToLatest: MessageListImperativeHandleProps['isScrolledToLatest'] =\n useCallback(() => {\n return conversationRef.current\n ? conversationRef.current.scrollHeight -\n conversationRef.current.scrollTop -\n conversationRef.current.offsetHeight <=\n 30\n : true;\n }, [conversationRef.current]);\n\n const scrollToLatestMessage: MessageListImperativeHandleProps['scrollToLatestMessage'] =\n useCallback(() => {\n if (conversationRef.current) {\n conversationRef.current.scrollTop = conversationRef.current.scrollHeight;\n }\n }, [conversationRef.current]);\n\n const [displayScrollLatest, setDisplayScrollToLatest] = useState(false);\n\n const onMessageListScroll = useCallback(() => {\n const isScrolled = isScrolledToLatest();\n if (scrollRef.current && isScrolled) {\n scrollRef.current = false;\n if (unReadMessageCount) {\n onScrollToButtonClick?.();\n }\n }\n\n if (!scrollRef.current && !isScrolled) {\n scrollRef.current = true;\n }\n\n setDisplayScrollToLatest(!isScrolled);\n }, [isScrolledToLatest(), unReadMessageCount]);\n\n const scrollToNewMessage: MessageListImperativeHandleProps['scrollToNewMessage'] =\n useCallback(() => {\n if (conversationRef.current) {\n setDisplayScrollToLatest(false);\n const newMessageIndicatorEle = conversationRef.current.querySelector<HTMLElement>(\n '[data-new-message-separator]'\n );\n if (newMessageIndicatorEle) {\n conversationRef.current.scrollTop = newMessageIndicatorEle.offsetTop;\n } else {\n conversationRef.current.scrollTop = conversationRef.current.scrollHeight;\n }\n }\n }, [conversationRef.current]);\n\n useImperativeHandle<MessageListImperativeHandleProps, MessageListImperativeHandleProps>(\n ref,\n () => ({\n isScrolledToLatest,\n scrollToLatestMessage,\n scrollToNewMessage\n }),\n [isScrolledToLatest, scrollToLatestMessage, scrollToNewMessage]\n );\n\n return (\n <>\n <Flex\n as={StyledMessageListContainer}\n item={{\n grow: 1\n }}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n {(unReadMessageCount > 0 || displayScrollLatest) && (\n <Button\n aria-label={\n unReadMessageCount > 0\n ? t('scroll_to_unread_messages')\n : t('scroll_to_latest_message')\n }\n onClick={() => {\n if (unReadMessageCount > 0) {\n scrollToNewMessage();\n } else {\n scrollToLatestMessage();\n }\n onScrollToButtonClick?.();\n }}\n icon={unReadMessageCount === 0}\n >\n <Icon name='caret-down' />\n {unReadMessageCount > 0 && <>&nbsp; {t('new_messages')}</>}\n </Button>\n )}\n <RepeatingView\n as={StyledMessageList}\n container={{ direction: 'column' }}\n ref={conversationRef}\n rows={messages}\n onScroll={debounce(onMessageListScroll, 100)}\n {...restProps}\n >\n {(item: RepeatingViewRow) => {\n const { id, type, ...messageListItemRestProps } = item as MessageListItemProps;\n if (type === 'message') {\n return <Message key={id} {...(messageListItemRestProps as MessageProps)} />;\n }\n\n if (type === 'system') {\n const extraProps: Record<string, string> = {};\n if (id === NewMessageSeparatorId) {\n extraProps['data-new-message-separator'] = NewMessageSeparatorId;\n }\n return (\n <SystemMessage\n key={id}\n {...(messageListItemRestProps as SystemMessageProps)}\n {...extraProps}\n />\n );\n }\n if (type === 'typing') {\n return (\n <TypeIndicator key={id} {...(messageListItemRestProps as TypeIndicatorProps)} />\n );\n }\n }}\n </RepeatingView>\n </Flex>\n {isScrolledToLatest() && <ScrollToLatest scrollContainerRef={conversationRef} />}\n </>\n );\n }\n);\n\nexport default MessageList;\n"]}
@@ -12,7 +12,7 @@ export interface SystemMessageProps {
12
12
  */
13
13
  variant?: 'primary' | 'secondary';
14
14
  }
15
- declare type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
15
+ type SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;
16
16
  export declare const StyledSystemMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<SystemMessagePropsWithDefaults, "variant">, never>;
17
17
  declare const SystemMessage: FunctionComponent<SystemMessageProps & ForwardProps>;
18
18
  export default SystemMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIvF,OAAO,EAIL,YAAY,EACZ,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,qCAAqC;IACrC,OAAO,EAAE,SAAS,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CACnC;AAED,aAAK,8BAA8B,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAEvF,eAAO,MAAM,mBAAmB,sJA2C/B,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"SystemMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIvF,OAAO,EAIL,YAAY,EACZ,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,qCAAqC;IACrC,OAAO,EAAE,SAAS,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CACnC;AAED,KAAK,8BAA8B,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAEvF,eAAO,MAAM,mBAAmB,sJA2C/B,CAAC;AAIF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { FunctionComponent, Ref, ReactNode } from 'react';
2
2
  import { AvatarProps, ForwardProps } from '@pega/cosmos-react-core';
3
- export declare type TranscriptHeaderProps = {
3
+ export type TranscriptHeaderProps = {
4
4
  /** transcript header content */
5
5
  content?: ReactNode;
6
6
  /** meta data */
@@ -1 +1 @@
1
- {"version":3,"file":"TranscriptMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TranscriptMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAG/F,OAAO,EAIL,WAAW,EAIX,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,qBAAqB,GAAG;IAClC,gCAAgC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,gBAAgB;IAChB,SAAS,EAA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