@pega/cosmos-react-social 4.0.0-dev.9.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/lib/components/Chat/Chat.d.ts +10 -12
  2. package/lib/components/Chat/Chat.d.ts.map +1 -1
  3. package/lib/components/Chat/Chat.js +10 -13
  4. package/lib/components/Chat/Chat.js.map +1 -1
  5. package/lib/components/Chat/Chat.types.d.ts +106 -4
  6. package/lib/components/Chat/Chat.types.d.ts.map +1 -1
  7. package/lib/components/Chat/Chat.types.js +9 -1
  8. package/lib/components/Chat/Chat.types.js.map +1 -1
  9. package/lib/components/Chat/ChatBody.d.ts +3 -8
  10. package/lib/components/Chat/ChatBody.d.ts.map +1 -1
  11. package/lib/components/Chat/ChatBody.js +289 -15
  12. package/lib/components/Chat/ChatBody.js.map +1 -1
  13. package/lib/components/Chat/ChatComposer.d.ts +3 -4
  14. package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
  15. package/lib/components/Chat/ChatComposer.js +41 -31
  16. package/lib/components/Chat/ChatComposer.js.map +1 -1
  17. package/lib/components/Chat/ChatHeader.d.ts +2 -2
  18. package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
  19. package/lib/components/Chat/ChatHeader.js +3 -3
  20. package/lib/components/Chat/ChatHeader.js.map +1 -1
  21. package/lib/components/Chat/ChatSettingsPanel.styles.js +1 -1
  22. package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -1
  23. package/lib/components/Chat/Message.d.ts +3 -43
  24. package/lib/components/Chat/Message.d.ts.map +1 -1
  25. package/lib/components/Chat/Message.js +68 -28
  26. package/lib/components/Chat/Message.js.map +1 -1
  27. package/lib/components/Chat/Message.styles.d.ts +32 -21
  28. package/lib/components/Chat/Message.styles.d.ts.map +1 -1
  29. package/lib/components/Chat/Message.styles.js +92 -20
  30. package/lib/components/Chat/Message.styles.js.map +1 -1
  31. package/lib/components/Chat/SuggestedReplyPicker.d.ts +20 -4
  32. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
  33. package/lib/components/Chat/SuggestedReplyPicker.js +115 -51
  34. package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
  35. package/lib/components/Chat/SystemMessage.d.ts +4 -15
  36. package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
  37. package/lib/components/Chat/SystemMessage.js +33 -23
  38. package/lib/components/Chat/SystemMessage.js.map +1 -1
  39. package/lib/components/Chat/TypeIndicator.d.ts +3 -10
  40. package/lib/components/Chat/TypeIndicator.d.ts.map +1 -1
  41. package/lib/components/Chat/TypeIndicator.js +6 -3
  42. package/lib/components/Chat/TypeIndicator.js.map +1 -1
  43. package/lib/components/Chat/index.d.ts +13 -13
  44. package/lib/components/Chat/index.d.ts.map +1 -1
  45. package/lib/components/Chat/index.js +1 -5
  46. package/lib/components/Chat/index.js.map +1 -1
  47. package/lib/components/Email/ContextMenuPopover.js +1 -1
  48. package/lib/components/Email/ContextMenuPopover.js.map +1 -1
  49. package/lib/components/Email/Email.d.ts.map +1 -1
  50. package/lib/components/Email/Email.js +1 -1
  51. package/lib/components/Email/Email.js.map +1 -1
  52. package/lib/components/Email/Email.styles.d.ts +12 -4
  53. package/lib/components/Email/Email.styles.d.ts.map +1 -1
  54. package/lib/components/Email/Email.styles.js +11 -4
  55. package/lib/components/Email/Email.styles.js.map +1 -1
  56. package/lib/components/Email/Email.types.d.ts +9 -7
  57. package/lib/components/Email/Email.types.d.ts.map +1 -1
  58. package/lib/components/Email/Email.types.js.map +1 -1
  59. package/lib/components/Email/EmailCaseView.d.ts.map +1 -1
  60. package/lib/components/Email/EmailCaseView.js +2 -2
  61. package/lib/components/Email/EmailCaseView.js.map +1 -1
  62. package/lib/components/Email/EmailComposer.d.ts.map +1 -1
  63. package/lib/components/Email/EmailComposer.js +71 -93
  64. package/lib/components/Email/EmailComposer.js.map +1 -1
  65. package/lib/components/Email/EmailConversation.d.ts.map +1 -1
  66. package/lib/components/Email/EmailConversation.js +77 -82
  67. package/lib/components/Email/EmailConversation.js.map +1 -1
  68. package/lib/components/Email/EmailEntity.d.ts.map +1 -1
  69. package/lib/components/Email/EmailEntity.js +1 -1
  70. package/lib/components/Email/EmailEntity.js.map +1 -1
  71. package/lib/components/Email/EmailManager.js +2 -2
  72. package/lib/components/Email/EmailManager.js.map +1 -1
  73. package/lib/components/Email/EmailShell.js +1 -1
  74. package/lib/components/Email/EmailShell.js.map +1 -1
  75. package/lib/components/Email/EmailSummaryItem.d.ts +1 -0
  76. package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
  77. package/lib/components/Email/EmailSummaryItem.js +4 -5
  78. package/lib/components/Email/EmailSummaryItem.js.map +1 -1
  79. package/lib/components/Email/EmailSummaryList.js +2 -2
  80. package/lib/components/Email/EmailSummaryList.js.map +1 -1
  81. package/lib/components/Email/EntityList.js +2 -2
  82. package/lib/components/Email/EntityList.js.map +1 -1
  83. package/lib/components/Email/index.d.ts +1 -1
  84. package/lib/components/Email/index.d.ts.map +1 -1
  85. package/lib/components/Email/index.js.map +1 -1
  86. package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -1
  87. package/lib/components/Email/utils/EntityHighlighter.js +4 -10
  88. package/lib/components/Email/utils/EntityHighlighter.js.map +1 -1
  89. package/lib/components/Feed/Feed.context.d.ts +5 -1
  90. package/lib/components/Feed/Feed.context.d.ts.map +1 -1
  91. package/lib/components/Feed/Feed.context.js.map +1 -1
  92. package/lib/components/Feed/Feed.d.ts +3 -53
  93. package/lib/components/Feed/Feed.d.ts.map +1 -1
  94. package/lib/components/Feed/Feed.js +52 -32
  95. package/lib/components/Feed/Feed.js.map +1 -1
  96. package/lib/components/Feed/Feed.types.d.ts +330 -0
  97. package/lib/components/Feed/Feed.types.d.ts.map +1 -0
  98. package/lib/components/Feed/Feed.types.js +2 -0
  99. package/lib/components/Feed/Feed.types.js.map +1 -0
  100. package/lib/components/Feed/FeedAnnouncer.d.ts +2 -3
  101. package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -1
  102. package/lib/components/Feed/FeedAnnouncer.js.map +1 -1
  103. package/lib/components/Feed/FeedAttachments.d.ts +3 -9
  104. package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
  105. package/lib/components/Feed/FeedAttachments.js +20 -18
  106. package/lib/components/Feed/FeedAttachments.js.map +1 -1
  107. package/lib/components/Feed/FeedButton.d.ts +0 -1
  108. package/lib/components/Feed/FeedButton.d.ts.map +1 -1
  109. package/lib/components/Feed/FeedButton.js +2 -10
  110. package/lib/components/Feed/FeedButton.js.map +1 -1
  111. package/lib/components/Feed/FeedContent.d.ts +2 -10
  112. package/lib/components/Feed/FeedContent.d.ts.map +1 -1
  113. package/lib/components/Feed/FeedContent.js +9 -2
  114. package/lib/components/Feed/FeedContent.js.map +1 -1
  115. package/lib/components/Feed/FeedContentFooter.d.ts +5 -0
  116. package/lib/components/Feed/FeedContentFooter.d.ts.map +1 -0
  117. package/lib/components/Feed/FeedContentFooter.js +34 -0
  118. package/lib/components/Feed/FeedContentFooter.js.map +1 -0
  119. package/lib/components/Feed/FeedContentHeader.d.ts +5 -0
  120. package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -0
  121. package/lib/components/Feed/FeedContentHeader.js +101 -0
  122. package/lib/components/Feed/FeedContentHeader.js.map +1 -0
  123. package/lib/components/Feed/FeedEditRegion.d.ts +6 -0
  124. package/lib/components/Feed/FeedEditRegion.d.ts.map +1 -0
  125. package/lib/components/Feed/FeedEditRegion.js +57 -0
  126. package/lib/components/Feed/FeedEditRegion.js.map +1 -0
  127. package/lib/components/Feed/FeedInputRegion.d.ts +8 -0
  128. package/lib/components/Feed/FeedInputRegion.d.ts.map +1 -0
  129. package/lib/components/Feed/FeedInputRegion.js +86 -0
  130. package/lib/components/Feed/FeedInputRegion.js.map +1 -0
  131. package/lib/components/Feed/FeedLikeButton.d.ts +5 -17
  132. package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
  133. package/lib/components/Feed/FeedLikeButton.js +54 -42
  134. package/lib/components/Feed/FeedLikeButton.js.map +1 -1
  135. package/lib/components/Feed/FeedModalList.d.ts +1 -13
  136. package/lib/components/Feed/FeedModalList.d.ts.map +1 -1
  137. package/lib/components/Feed/FeedModalList.js +6 -3
  138. package/lib/components/Feed/FeedModalList.js.map +1 -1
  139. package/lib/components/Feed/FeedNewPost.d.ts +1 -30
  140. package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
  141. package/lib/components/Feed/FeedNewPost.js +7 -85
  142. package/lib/components/Feed/FeedNewPost.js.map +1 -1
  143. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +1 -30
  144. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
  145. package/lib/components/Feed/FeedNewPostTypeMenu.js +38 -50
  146. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
  147. package/lib/components/Feed/FeedPost.d.ts +2 -4
  148. package/lib/components/Feed/FeedPost.d.ts.map +1 -1
  149. package/lib/components/Feed/FeedPost.js +97 -170
  150. package/lib/components/Feed/FeedPost.js.map +1 -1
  151. package/lib/components/Feed/FeedReply.d.ts +1 -4
  152. package/lib/components/Feed/FeedReply.d.ts.map +1 -1
  153. package/lib/components/Feed/FeedReply.js +56 -138
  154. package/lib/components/Feed/FeedReply.js.map +1 -1
  155. package/lib/components/Feed/FeedReplyInput.d.ts +2 -27
  156. package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
  157. package/lib/components/Feed/FeedReplyInput.js +9 -96
  158. package/lib/components/Feed/FeedReplyInput.js.map +1 -1
  159. package/lib/components/Feed/FeedRichText.d.ts +1 -4
  160. package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
  161. package/lib/components/Feed/FeedRichText.js +4 -9
  162. package/lib/components/Feed/FeedRichText.js.map +1 -1
  163. package/lib/components/Feed/index.d.ts +4 -7
  164. package/lib/components/Feed/index.d.ts.map +1 -1
  165. package/lib/components/Feed/index.js.map +1 -1
  166. package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -1
  167. package/lib/components/HashtagButton/HashtagButton.js +3 -3
  168. package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
  169. package/lib/components/MentionButton/MentionButton.d.ts +1 -1
  170. package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
  171. package/lib/components/MentionButton/MentionButton.js +12 -14
  172. package/lib/components/MentionButton/MentionButton.js.map +1 -1
  173. package/package.json +17 -19
  174. package/lib/components/Chat/ChatTranscript.d.ts +0 -23
  175. package/lib/components/Chat/ChatTranscript.d.ts.map +0 -1
  176. package/lib/components/Chat/ChatTranscript.js +0 -45
  177. package/lib/components/Chat/ChatTranscript.js.map +0 -1
  178. package/lib/components/Chat/MessageList.d.ts +0 -35
  179. package/lib/components/Chat/MessageList.d.ts.map +0 -1
  180. package/lib/components/Chat/MessageList.js +0 -134
  181. package/lib/components/Chat/MessageList.js.map +0 -1
  182. package/lib/components/Chat/RepeatingView.d.ts +0 -31
  183. package/lib/components/Chat/RepeatingView.d.ts.map +0 -1
  184. package/lib/components/Chat/RepeatingView.js +0 -47
  185. package/lib/components/Chat/RepeatingView.js.map +0 -1
  186. package/lib/components/Chat/TranscriptMessage.d.ts +0 -25
  187. package/lib/components/Chat/TranscriptMessage.d.ts.map +0 -1
  188. package/lib/components/Chat/TranscriptMessage.js +0 -48
  189. package/lib/components/Chat/TranscriptMessage.js.map +0 -1
  190. package/lib/components/Feed/FeedPost.types.d.ts +0 -107
  191. package/lib/components/Feed/FeedPost.types.d.ts.map +0 -1
  192. package/lib/components/Feed/FeedPost.types.js +0 -2
  193. package/lib/components/Feed/FeedPost.types.js.map +0 -1
  194. package/lib/components/Feed/FeedReply.types.d.ts +0 -72
  195. package/lib/components/Feed/FeedReply.types.d.ts.map +0 -1
  196. package/lib/components/Feed/FeedReply.types.js +0 -2
  197. package/lib/components/Feed/FeedReply.types.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { ReactElement, FunctionComponent, Ref, ReactNode } from 'react';
1
+ import { FunctionComponent, Ref } from 'react';
2
2
  import { BannerProps, ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
- import ChatBody from './ChatBody';
4
- import ChatComposer from './ChatComposer';
5
- import ChatHeader from './ChatHeader';
6
- import SuggestedReplyPicker from './SuggestedReplyPicker';
7
- export declare type ChatBannerProps = {
3
+ import { ChatComposerProps } from './ChatComposer';
4
+ import { ChatHeaderProps } from './ChatHeader';
5
+ import { SuggestedReplyPickerProps } from './SuggestedReplyPicker';
6
+ import { ChatBodyProps } from './Chat.types';
7
+ export type ChatBannerProps = {
8
8
  /** Content */
9
9
  content: string;
10
10
  /** Name of the icon */
@@ -14,17 +14,15 @@ export interface ChatProps extends NoChildrenProp {
14
14
  /** ref to the element */
15
15
  ref?: Ref<HTMLElement>;
16
16
  /** Header of conversation pane */
17
- header: ReactElement<typeof ChatHeader>;
18
- /** Utility - This is used by utility container internally. It has predefined styles and visible conditionally based on utility prop is */
19
- utility?: ReactNode;
17
+ header: ChatHeaderProps;
20
18
  /** Wrapper of message groups, system messages, type ahead */
21
- body: ReactElement<typeof ChatBody>;
19
+ body: ChatBodyProps;
22
20
  /** Wrapper of suggested replies */
23
- suggestedReplyPicker?: ReactElement<typeof SuggestedReplyPicker>;
21
+ suggestedReplyPicker?: SuggestedReplyPickerProps;
24
22
  /** chat banner */
25
23
  banner?: Pick<BannerProps, 'variant' | 'messages'>;
26
24
  /** Wrapper of conversation input, emojis, attachments */
27
- footer: ReactElement<typeof ChatComposer>;
25
+ composer: ChatComposerProps;
28
26
  }
29
27
  declare const Chat: FunctionComponent<ChatProps & ForwardProps>;
30
28
  export default Chat;
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EAGjB,GAAG,EACH,SAAS,EAGV,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,WAAW,EAEX,YA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BAAgB,CAAC;AACjE,OAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAA6B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,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,eAAe,CAAC;IACxB,6DAA6D;IAC7D,IAAI,EAAE,aAAa,CAAC;IACpB,mCAAmC;IACnC,oBAAoB,CAAC,EAAE,yBAAyB,CAAC;IACjD,kBAAkB;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;IACnD,yDAAyD;IACzD,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAgED,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAsBpD,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -1,17 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useRef, useEffect } from 'react';
2
+ import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { Flex, Banner, defaultThemeProp } from '@pega/cosmos-react-core';
5
5
  import { StyledBanner } from '@pega/cosmos-react-core/lib/components/Banner/Banner';
6
+ import ChatBody from './ChatBody';
7
+ import ChatComposer from './ChatComposer';
8
+ import ChatHeader from './ChatHeader';
9
+ import SuggestedReplyPicker from './SuggestedReplyPicker';
6
10
  const StyledUtilityContainer = styled.div ``;
7
11
  const StyledUtilityMerger = styled.div ``;
8
12
  const StyledUtilityContent = styled.div ``;
9
13
  const StyledChatContainer = styled.section(props => {
10
- const { theme: { base: { spacing, shadow: { high: shadowHigh }, palette: { 'primary-background': primaryBackground, 'secondary-background': secondaryBackground } } } } = props;
14
+ const { theme: { base: { spacing, shadow: { high: shadowHigh }, palette: { 'primary-background': primaryBackground, 'secondary-background': secondaryBackground }, 'border-radius': borderRadius } } } = props;
11
15
  return css `
12
16
  height: 100%;
13
17
  background: ${primaryBackground};
14
18
  width: 100%;
19
+ border-radius: ${borderRadius};
15
20
  ${StyledUtilityMerger} {
16
21
  min-height: 15rem;
17
22
  position: relative;
@@ -49,19 +54,11 @@ const StyledChatContainer = styled.section(props => {
49
54
  `;
50
55
  });
51
56
  StyledChatContainer.defaultProps = defaultThemeProp;
52
- const Chat = forwardRef((props, ref) => {
53
- const { header, body, footer, utility, banner, suggestedReplyPicker, ...restProps } = props;
54
- const utilityContentRef = useRef(null);
55
- useEffect(() => {
56
- utilityContentRef.current?.focus();
57
- }, [utility]);
57
+ const Chat = forwardRef(function Chat(props, ref) {
58
+ const { header, body, composer, banner, suggestedReplyPicker, ...restProps } = props;
58
59
  return (_jsxs(Flex, { ref: ref, as: StyledChatContainer, container: {
59
60
  direction: 'column'
60
- }, ...restProps, children: [header, _jsxs(Flex, { container: {
61
- direction: 'column'
62
- }, as: StyledUtilityMerger, children: [utility && (_jsx(Flex, { tabIndex: 0, as: StyledUtilityContainer, container: {
63
- direction: 'column'
64
- }, children: _jsx(StyledUtilityContent, { ref: utilityContentRef, children: utility }) })), banner && _jsx(Banner, { variant: banner.variant, messages: banner.messages }), body] }), suggestedReplyPicker, footer] }));
61
+ }, ...restProps, children: [_jsx(ChatHeader, { ...header }), banner && _jsx(Banner, { variant: banner.variant, messages: banner.messages }), _jsx(ChatBody, { ...body }), suggestedReplyPicker && _jsx(SuggestedReplyPicker, { ...suggestedReplyPicker }), _jsx(ChatComposer, { ...composer })] }));
65
62
  });
66
63
  export default Chat;
67
64
  //# sourceMappingURL=Chat.js.map
@@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AE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,SAAS,EAAE,GAAG,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
+ {"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,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;AAEpF,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,YAAmC,MA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pB,KACG,SAAS,aAEb,KAAC,UAAU,OAAK,MAAM,GAAI,EACzB,MAAM,IAAI,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAI,EACzE,KAAC,QAAQ,OAAK,IAAI,GAAI,EACrB,oBAAoB,IAAI,KAAC,oBAAoB,OAAK,oBAAoB,GAAI,EAC3E,KAAC,YAAY,OAAK,QAAQ,GAAI,IACzB,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref } 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, { ChatComposerProps } from './ChatComposer';\nimport ChatHeader, { ChatHeaderProps } from './ChatHeader';\nimport SuggestedReplyPicker, { SuggestedReplyPickerProps } from './SuggestedReplyPicker';\nimport { ChatBodyProps } from './Chat.types';\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: ChatHeaderProps;\n /** Wrapper of message groups, system messages, type ahead */\n body: ChatBodyProps;\n /** Wrapper of suggested replies */\n suggestedReplyPicker?: SuggestedReplyPickerProps;\n /** chat banner */\n banner?: Pick<BannerProps, 'variant' | 'messages'>;\n /** Wrapper of conversation input, emojis, attachments */\n composer: ChatComposerProps;\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 'border-radius': borderRadius\n }\n }\n } = props;\n return css`\n height: 100%;\n background: ${primaryBackground};\n width: 100%;\n border-radius: ${borderRadius};\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(function Chat(\n props: PropsWithoutRef<ChatProps>,\n ref: ChatProps['ref']\n) {\n const { header, body, composer, banner, suggestedReplyPicker, ...restProps } = props;\n\n return (\n <Flex\n ref={ref}\n as={StyledChatContainer}\n container={{\n direction: 'column'\n }}\n {...restProps}\n >\n <ChatHeader {...header} />\n {banner && <Banner variant={banner.variant} messages={banner.messages} />}\n <ChatBody {...body} />\n {suggestedReplyPicker && <SuggestedReplyPicker {...suggestedReplyPicker} />}\n <ChatComposer {...composer} />\n </Flex>\n );\n});\n\nexport default Chat;\n"]}
@@ -1,5 +1,6 @@
1
+ import { ReactNode, Ref } from 'react';
1
2
  import { DefaultTheme } from 'styled-components';
2
- import { BaseProps, Action, NoChildrenProp, OmitStrict } from '@pega/cosmos-react-core';
3
+ import { BaseProps, Action, NoChildrenProp, OmitStrict, LinkProps, AvatarProps } from '@pega/cosmos-react-core';
3
4
  export interface AttachmentItemProps extends BaseProps {
4
5
  /** Unique Id for this attachment */
5
6
  id: string;
@@ -7,7 +8,7 @@ export interface AttachmentItemProps extends BaseProps {
7
8
  name: string;
8
9
  /**
9
10
  * A Cosmos icon name identifier to use for a attachment. Will serve as a fallback to a broken thumbnail.
10
- * @default "document-doc"
11
+ * @default 'document-doc'
11
12
  */
12
13
  icon?: string;
13
14
  /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */
@@ -21,14 +22,115 @@ export interface AttachmentItemProps extends BaseProps {
21
22
  /** When passed, this will render a single icon button or within a MenuButton if onDelete is defined. */
22
23
  onDelete?: (id: string) => void;
23
24
  }
24
- export declare type UserAvailability = 'available' | 'unavailable' | 'temporarilyUnavailable';
25
+ export type UserAvailability = 'available' | 'unavailable' | 'temporarilyUnavailable';
25
26
  export interface ChatSettingsPanelProps extends NoChildrenProp {
26
27
  status?: UserAvailability;
27
28
  label: string;
28
29
  onClick: () => void;
29
30
  }
30
- export declare type ColorTheme = [
31
+ export type ColorTheme = [
31
32
  keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>,
32
33
  'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark'
33
34
  ];
35
+ export interface MediaPageLinks extends Pick<LinkProps, 'href'> {
36
+ /** Unique id for this push link */
37
+ id: string;
38
+ /** A string to be used as an image src for a thumbnail. */
39
+ thumbnail?: AttachmentItemProps['thumbnail'];
40
+ /** Additional information about the linked resource. */
41
+ title?: string;
42
+ }
43
+ export type MessageHeaderProps = {
44
+ /** message header content */
45
+ content?: ReactNode;
46
+ /** meta data */
47
+ meta?: ReactNode;
48
+ };
49
+ export interface MessageProps {
50
+ /** Message to be displayed */
51
+ message?: string;
52
+ /** Attachment list */
53
+ attachments?: AttachmentItemProps[];
54
+ /** Message page push links list */
55
+ mediaPageLinks?: MediaPageLinks[];
56
+ /** timestamp of the message(Formatted) */
57
+ timestamp?: string;
58
+ /** Incoming message/ outgoing message */
59
+ direction: 'in' | 'out';
60
+ /** Avatar information, can be image and name */
61
+ avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;
62
+ /** Message status */
63
+ status?: 'delivered' | 'opened' | 'undeliverable' | 'sent';
64
+ /** Indicates if this message is being currently typed */
65
+ typing?: boolean;
66
+ /** Message header */
67
+ messageHeader?: MessageHeaderProps;
68
+ /** Sender type */
69
+ senderType: 'customer' | 'agent' | 'bot';
70
+ /** Sender ID, will be helpful in deciding the colour */
71
+ senderId: string;
72
+ /** Number used to determine the color of agent's message */
73
+ agentVariant?: number;
74
+ /** ref to the message wrapper */
75
+ ref?: Ref<HTMLLIElement>;
76
+ }
77
+ export interface TypeIndicatorProps extends Pick<MessageProps, 'ref' | 'message' | 'senderId' | 'senderType' | 'agentVariant'> {
78
+ /** Avatar information, can be image and name */
79
+ avatarInfo: Pick<AvatarProps, 'name' | 'imageSrc'>;
80
+ }
81
+ export interface SystemMessageProps extends Pick<MessageProps, 'ref' | 'timestamp'> {
82
+ /** System message to be displayed */
83
+ message: string;
84
+ /** variant of this system message
85
+ * @default 'secondary'
86
+ */
87
+ variant?: 'primary' | 'secondary';
88
+ }
89
+ export interface ChatBodyHandleValue {
90
+ isScrolledToLatest: () => boolean;
91
+ scrollToLatestMessage: () => void;
92
+ scrollToNewMessage: () => void;
93
+ }
94
+ export interface ChatBodyProps {
95
+ /** Transcripts */
96
+ transcripts: {
97
+ /** Unique id of a chat session */
98
+ id: string;
99
+ /** Messages in a chat session */
100
+ messages: ChatBodyListItemProps[];
101
+ }[];
102
+ /** Live chat messages */
103
+ liveChat: ChatBodyListItemProps[];
104
+ /** Total unread messages */
105
+ unreadMessageCount?: number;
106
+ /** on scroll to button */
107
+ onScrollToButtonClick?: () => void;
108
+ /** Indicates if the data is being currently loading */
109
+ loading?: boolean;
110
+ /** Offset of the row item that need to trigger the load more callback */
111
+ offset?: number;
112
+ /** Callback to fetch more rows */
113
+ loadMore?: () => void;
114
+ /** Imperative handle */
115
+ handle?: Ref<ChatBodyHandleValue>;
116
+ /** ref to the element */
117
+ ref?: Ref<HTMLDivElement>;
118
+ }
119
+ type MessageListItemProps = OmitStrict<MessageProps, 'agentVariant' | 'typing'> & {
120
+ type: 'message';
121
+ id: string;
122
+ };
123
+ type SystemMessageListItemProps = SystemMessageProps & {
124
+ type: 'system';
125
+ id: string;
126
+ };
127
+ type TypeIndicatorListItemPops = OmitStrict<TypeIndicatorProps, 'agentVariant'> & {
128
+ type: 'typing';
129
+ id: string;
130
+ };
131
+ export type ChatBodyListItemProps = MessageListItemProps | SystemMessageListItemProps | TypeIndicatorListItemPops;
132
+ export declare const isMessageListItem: (message: ChatBodyListItemProps) => message is MessageListItemProps;
133
+ export declare const isSystemMessageListItem: (message: ChatBodyListItemProps) => message is SystemMessageListItemProps;
134
+ export declare const isTypeIndicatorListItem: (message: ChatBodyListItemProps) => message is TypeIndicatorListItemPops;
135
+ export {};
34
136
  //# 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,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,oIAAo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,uBAAuB,YACzB,qBAAqB,0CAG/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACzB,qBAAqB,yCAG/B,CAAC"}
@@ -1,2 +1,10 @@
1
- export {};
1
+ export const isMessageListItem = (message) => {
2
+ return message.type === 'message';
3
+ };
4
+ export const isSystemMessageListItem = (message) => {
5
+ return message.type === 'system';
6
+ };
7
+ export const isTypeIndicatorListItem = (message) => {
8
+ return message.type === 'typing';
9
+ };
2
10
  //# sourceMappingURL=Chat.types.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"Chat.types.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"AA4JA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAA8B,EACG,EAAE;IACnC,OAAO,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAA8B,EACS,EAAE;IACzC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAA8B,EACQ,EAAE;IACxC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;AACnC,CAAC,CAAC","sourcesContent":["import { ReactNode, Ref } from 'react';\nimport { DefaultTheme } from 'styled-components';\n\nimport {\n BaseProps,\n Action,\n NoChildrenProp,\n OmitStrict,\n LinkProps,\n AvatarProps\n} 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\nexport interface MediaPageLinks extends Pick<LinkProps, 'href'> {\n /** Unique id for this push link */\n id: string;\n /** A string to be used as an image src for a thumbnail. */\n thumbnail?: AttachmentItemProps['thumbnail'];\n /** Additional information about the linked resource. */\n title?: string;\n}\n\nexport type MessageHeaderProps = {\n /** message header content */\n content?: ReactNode;\n /** meta data */\n meta?: ReactNode;\n};\n\nexport interface MessageProps {\n /** Message to be displayed */\n message?: string;\n /** Attachment list */\n attachments?: AttachmentItemProps[];\n /** Message page push links list */\n mediaPageLinks?: MediaPageLinks[];\n /** timestamp of the message(Formatted) */\n timestamp?: string;\n /** Incoming message/ outgoing message */\n direction: 'in' | 'out';\n /** Avatar information, can be image and name */\n avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;\n /** Message status */\n status?: 'delivered' | 'opened' | 'undeliverable' | 'sent';\n /** Indicates if this message is being currently typed */\n typing?: boolean;\n /** Message header */\n messageHeader?: MessageHeaderProps;\n /** Sender type */\n senderType: 'customer' | 'agent' | 'bot';\n /** Sender ID, will be helpful in deciding the colour */\n senderId: string;\n /** Number used to determine the color of agent's message */\n agentVariant?: number;\n /** ref to the message wrapper */\n ref?: Ref<HTMLLIElement>;\n}\n\nexport interface TypeIndicatorProps\n extends Pick<MessageProps, 'ref' | 'message' | 'senderId' | 'senderType' | 'agentVariant'> {\n /** Avatar information, can be image and name */\n avatarInfo: Pick<AvatarProps, 'name' | 'imageSrc'>;\n}\n\nexport interface SystemMessageProps extends Pick<MessageProps, 'ref' | 'timestamp'> {\n /** System message to be displayed */\n message: string;\n /** variant of this system message\n * @default 'secondary'\n */\n variant?: 'primary' | 'secondary';\n}\n\nexport interface ChatBodyHandleValue {\n isScrolledToLatest: () => boolean;\n scrollToLatestMessage: () => void;\n scrollToNewMessage: () => void;\n}\n\nexport interface ChatBodyProps {\n /** Transcripts */\n transcripts: {\n /** Unique id of a chat session */\n id: string;\n /** Messages in a chat session */\n messages: ChatBodyListItemProps[];\n }[];\n /** Live chat messages */\n liveChat: ChatBodyListItemProps[];\n /** Total unread messages */\n unreadMessageCount?: number;\n /** on scroll to button */\n onScrollToButtonClick?: () => void;\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Offset of the row item that need to trigger the load more callback */\n offset?: number;\n /** Callback to fetch more rows */\n loadMore?: () => void;\n /** Imperative handle */\n handle?: Ref<ChatBodyHandleValue>;\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype MessageListItemProps = OmitStrict<MessageProps, 'agentVariant' | 'typing'> & {\n type: 'message';\n id: string;\n};\n\ntype SystemMessageListItemProps = SystemMessageProps & { type: 'system'; id: string };\n\ntype TypeIndicatorListItemPops = OmitStrict<TypeIndicatorProps, 'agentVariant'> & {\n type: 'typing';\n id: string;\n};\n\nexport type ChatBodyListItemProps =\n | MessageListItemProps\n | SystemMessageListItemProps\n | TypeIndicatorListItemPops;\n\nexport const isMessageListItem = (\n message: ChatBodyListItemProps\n): message is MessageListItemProps => {\n return message.type === 'message';\n};\n\nexport const isSystemMessageListItem = (\n message: ChatBodyListItemProps\n): message is SystemMessageListItemProps => {\n return message.type === 'system';\n};\n\nexport const isTypeIndicatorListItem = (\n message: ChatBodyListItemProps\n): message is TypeIndicatorListItemPops => {\n return message.type === 'typing';\n};\n"]}
@@ -1,12 +1,7 @@
1
- import { FunctionComponent, Ref, ReactElement } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
  import { ForwardProps } from '@pega/cosmos-react-core';
3
- import MessageList from './MessageList';
4
- export interface ChatBodyProps {
5
- /** ref to the element */
6
- ref?: Ref<HTMLDivElement>;
7
- /** Message data Array */
8
- children: ReactElement<typeof MessageList>;
9
- }
3
+ import { ChatBodyProps } from './Chat.types';
4
+ export declare const NewMessageSeparatorId = "new-message-separator";
10
5
  declare const ChatBody: FunctionComponent<ChatBodyProps & ForwardProps>;
11
6
  export default ChatBody;
12
7
  //# sourceMappingURL=ChatBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBody.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1F,OAAO,EAAQ,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,EAAE,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;CAC5C;AAOD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAoB7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"ChatBody.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatBody.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAYb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAGL,aAAa,EAKd,MAAM,cAAc,CAAC;AAQtB,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAuH7D,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA2R5D,CAAC;AAEH,eAAe,QAAQ,CAAC"}