@pega/cosmos-react-social 5.0.0-dev.4.9 → 5.0.0-dev.6.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 (237) hide show
  1. package/lib/components/Autopilot/Autopilot.d.ts +15 -0
  2. package/lib/components/Autopilot/Autopilot.d.ts.map +1 -0
  3. package/lib/components/Autopilot/Autopilot.js +50 -0
  4. package/lib/components/Autopilot/Autopilot.js.map +1 -0
  5. package/lib/components/Autopilot/AutopilotAvatar.d.ts +8 -0
  6. package/lib/components/Autopilot/AutopilotAvatar.d.ts.map +1 -0
  7. package/lib/components/Autopilot/AutopilotAvatar.js +14 -0
  8. package/lib/components/Autopilot/AutopilotAvatar.js.map +1 -0
  9. package/lib/components/Autopilot/AutopilotGlimpse.d.ts +9 -0
  10. package/lib/components/Autopilot/AutopilotGlimpse.d.ts.map +1 -0
  11. package/lib/components/Autopilot/AutopilotGlimpse.js +26 -0
  12. package/lib/components/Autopilot/AutopilotGlimpse.js.map +1 -0
  13. package/lib/components/Autopilot/index.d.ts +4 -0
  14. package/lib/components/Autopilot/index.d.ts.map +1 -0
  15. package/lib/components/Autopilot/index.js +3 -0
  16. package/lib/components/Autopilot/index.js.map +1 -0
  17. package/lib/components/Chat/Chat.d.ts +29 -0
  18. package/lib/components/Chat/Chat.d.ts.map +1 -0
  19. package/lib/components/Chat/Chat.js +64 -0
  20. package/lib/components/Chat/Chat.js.map +1 -0
  21. package/lib/components/Chat/Chat.types.d.ts +136 -0
  22. package/lib/components/Chat/Chat.types.d.ts.map +1 -0
  23. package/lib/components/Chat/Chat.types.js +10 -0
  24. package/lib/components/Chat/Chat.types.js.map +1 -0
  25. package/lib/components/Chat/ChatBody.d.ts +7 -0
  26. package/lib/components/Chat/ChatBody.d.ts.map +1 -0
  27. package/lib/components/Chat/ChatBody.js +292 -0
  28. package/lib/components/Chat/ChatBody.js.map +1 -0
  29. package/lib/components/Chat/ChatComposer.d.ts +50 -0
  30. package/lib/components/Chat/ChatComposer.d.ts.map +1 -0
  31. package/lib/components/Chat/ChatComposer.js +221 -0
  32. package/lib/components/Chat/ChatComposer.js.map +1 -0
  33. package/lib/components/Chat/ChatHeader.d.ts +29 -0
  34. package/lib/components/Chat/ChatHeader.d.ts.map +1 -0
  35. package/lib/components/Chat/ChatHeader.js +44 -0
  36. package/lib/components/Chat/ChatHeader.js.map +1 -0
  37. package/lib/components/Chat/ChatSettingsPanel.d.ts +7 -0
  38. package/lib/components/Chat/ChatSettingsPanel.d.ts.map +1 -0
  39. package/lib/components/Chat/ChatSettingsPanel.js +15 -0
  40. package/lib/components/Chat/ChatSettingsPanel.js.map +1 -0
  41. package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +16 -0
  42. package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -0
  43. package/lib/components/Chat/ChatSettingsPanel.styles.js +47 -0
  44. package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -0
  45. package/lib/components/Chat/Message.d.ts +6 -0
  46. package/lib/components/Chat/Message.d.ts.map +1 -0
  47. package/lib/components/Chat/Message.js +98 -0
  48. package/lib/components/Chat/Message.js.map +1 -0
  49. package/lib/components/Chat/Message.styles.d.ts +43 -0
  50. package/lib/components/Chat/Message.styles.d.ts.map +1 -0
  51. package/lib/components/Chat/Message.styles.js +270 -0
  52. package/lib/components/Chat/Message.styles.js.map +1 -0
  53. package/lib/components/Chat/SuggestedReplyPicker.d.ts +42 -0
  54. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -0
  55. package/lib/components/Chat/SuggestedReplyPicker.js +143 -0
  56. package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -0
  57. package/lib/components/Chat/SystemMessage.d.ts +8 -0
  58. package/lib/components/Chat/SystemMessage.d.ts.map +1 -0
  59. package/lib/components/Chat/SystemMessage.js +50 -0
  60. package/lib/components/Chat/SystemMessage.js.map +1 -0
  61. package/lib/components/Chat/TypeIndicator.d.ts +6 -0
  62. package/lib/components/Chat/TypeIndicator.d.ts.map +1 -0
  63. package/lib/components/Chat/TypeIndicator.js +12 -0
  64. package/lib/components/Chat/TypeIndicator.js.map +1 -0
  65. package/lib/components/Chat/index.d.ts +15 -0
  66. package/lib/components/Chat/index.d.ts.map +1 -0
  67. package/lib/components/Chat/index.js +10 -0
  68. package/lib/components/Chat/index.js.map +1 -0
  69. package/lib/components/Email/ContextMenuPopover.d.ts +5 -0
  70. package/lib/components/Email/ContextMenuPopover.d.ts.map +1 -0
  71. package/lib/components/Email/ContextMenuPopover.js +53 -0
  72. package/lib/components/Email/ContextMenuPopover.js.map +1 -0
  73. package/lib/components/Email/Email.d.ts +7 -0
  74. package/lib/components/Email/Email.d.ts.map +1 -0
  75. package/lib/components/Email/Email.js +248 -0
  76. package/lib/components/Email/Email.js.map +1 -0
  77. package/lib/components/Email/Email.styles.d.ts +67 -0
  78. package/lib/components/Email/Email.styles.d.ts.map +1 -0
  79. package/lib/components/Email/Email.styles.js +392 -0
  80. package/lib/components/Email/Email.styles.js.map +1 -0
  81. package/lib/components/Email/Email.types.d.ts +394 -0
  82. package/lib/components/Email/Email.types.d.ts.map +1 -0
  83. package/lib/components/Email/Email.types.js +2 -0
  84. package/lib/components/Email/Email.types.js.map +1 -0
  85. package/lib/components/Email/EmailCaseView.d.ts +6 -0
  86. package/lib/components/Email/EmailCaseView.d.ts.map +1 -0
  87. package/lib/components/Email/EmailCaseView.js +36 -0
  88. package/lib/components/Email/EmailCaseView.js.map +1 -0
  89. package/lib/components/Email/EmailComposer.d.ts +10 -0
  90. package/lib/components/Email/EmailComposer.d.ts.map +1 -0
  91. package/lib/components/Email/EmailComposer.js +255 -0
  92. package/lib/components/Email/EmailComposer.js.map +1 -0
  93. package/lib/components/Email/EmailConversation.d.ts +17 -0
  94. package/lib/components/Email/EmailConversation.d.ts.map +1 -0
  95. package/lib/components/Email/EmailConversation.js +174 -0
  96. package/lib/components/Email/EmailConversation.js.map +1 -0
  97. package/lib/components/Email/EmailEntity.d.ts +11 -0
  98. package/lib/components/Email/EmailEntity.d.ts.map +1 -0
  99. package/lib/components/Email/EmailEntity.js +51 -0
  100. package/lib/components/Email/EmailEntity.js.map +1 -0
  101. package/lib/components/Email/EmailManager.d.ts +6 -0
  102. package/lib/components/Email/EmailManager.d.ts.map +1 -0
  103. package/lib/components/Email/EmailManager.js +21 -0
  104. package/lib/components/Email/EmailManager.js.map +1 -0
  105. package/lib/components/Email/EmailNotificationPanel.d.ts +7 -0
  106. package/lib/components/Email/EmailNotificationPanel.d.ts.map +1 -0
  107. package/lib/components/Email/EmailNotificationPanel.js +15 -0
  108. package/lib/components/Email/EmailNotificationPanel.js.map +1 -0
  109. package/lib/components/Email/EmailSelector.d.ts +22 -0
  110. package/lib/components/Email/EmailSelector.d.ts.map +1 -0
  111. package/lib/components/Email/EmailSelector.js +121 -0
  112. package/lib/components/Email/EmailSelector.js.map +1 -0
  113. package/lib/components/Email/EmailShell.d.ts +6 -0
  114. package/lib/components/Email/EmailShell.d.ts.map +1 -0
  115. package/lib/components/Email/EmailShell.js +46 -0
  116. package/lib/components/Email/EmailShell.js.map +1 -0
  117. package/lib/components/Email/EmailSummaryItem.d.ts +11 -0
  118. package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -0
  119. package/lib/components/Email/EmailSummaryItem.js +118 -0
  120. package/lib/components/Email/EmailSummaryItem.js.map +1 -0
  121. package/lib/components/Email/EmailSummaryList.d.ts +6 -0
  122. package/lib/components/Email/EmailSummaryList.d.ts.map +1 -0
  123. package/lib/components/Email/EmailSummaryList.js +95 -0
  124. package/lib/components/Email/EmailSummaryList.js.map +1 -0
  125. package/lib/components/Email/EntityList.d.ts +6 -0
  126. package/lib/components/Email/EntityList.d.ts.map +1 -0
  127. package/lib/components/Email/EntityList.js +74 -0
  128. package/lib/components/Email/EntityList.js.map +1 -0
  129. package/lib/components/Email/index.d.ts +13 -0
  130. package/lib/components/Email/index.d.ts.map +1 -0
  131. package/lib/components/Email/index.js +12 -0
  132. package/lib/components/Email/index.js.map +1 -0
  133. package/lib/components/Email/utils/EntityHighlighter.d.ts +10 -0
  134. package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -0
  135. package/lib/components/Email/utils/EntityHighlighter.js +260 -0
  136. package/lib/components/Email/utils/EntityHighlighter.js.map +1 -0
  137. package/lib/components/Feed/Feed.context.d.ts +56 -0
  138. package/lib/components/Feed/Feed.context.d.ts.map +1 -0
  139. package/lib/components/Feed/Feed.context.js +14 -0
  140. package/lib/components/Feed/Feed.context.js.map +1 -0
  141. package/lib/components/Feed/Feed.d.ts +6 -0
  142. package/lib/components/Feed/Feed.d.ts.map +1 -0
  143. package/lib/components/Feed/Feed.js +152 -0
  144. package/lib/components/Feed/Feed.js.map +1 -0
  145. package/lib/components/Feed/Feed.types.d.ts +334 -0
  146. package/lib/components/Feed/Feed.types.d.ts.map +1 -0
  147. package/lib/components/Feed/Feed.types.js +2 -0
  148. package/lib/components/Feed/Feed.types.js.map +1 -0
  149. package/lib/components/Feed/FeedAnnouncer.d.ts +6 -0
  150. package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -0
  151. package/lib/components/Feed/FeedAnnouncer.js +11 -0
  152. package/lib/components/Feed/FeedAnnouncer.js.map +1 -0
  153. package/lib/components/Feed/FeedAttachments.d.ts +8 -0
  154. package/lib/components/Feed/FeedAttachments.d.ts.map +1 -0
  155. package/lib/components/Feed/FeedAttachments.js +97 -0
  156. package/lib/components/Feed/FeedAttachments.js.map +1 -0
  157. package/lib/components/Feed/FeedButton.d.ts +5 -0
  158. package/lib/components/Feed/FeedButton.d.ts.map +1 -0
  159. package/lib/components/Feed/FeedButton.js +15 -0
  160. package/lib/components/Feed/FeedButton.js.map +1 -0
  161. package/lib/components/Feed/FeedContent.d.ts +6 -0
  162. package/lib/components/Feed/FeedContent.d.ts.map +1 -0
  163. package/lib/components/Feed/FeedContent.js +46 -0
  164. package/lib/components/Feed/FeedContent.js.map +1 -0
  165. package/lib/components/Feed/FeedContentFooter.d.ts +5 -0
  166. package/lib/components/Feed/FeedContentFooter.d.ts.map +1 -0
  167. package/lib/components/Feed/FeedContentFooter.js +34 -0
  168. package/lib/components/Feed/FeedContentFooter.js.map +1 -0
  169. package/lib/components/Feed/FeedContentHeader.d.ts +5 -0
  170. package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -0
  171. package/lib/components/Feed/FeedContentHeader.js +107 -0
  172. package/lib/components/Feed/FeedContentHeader.js.map +1 -0
  173. package/lib/components/Feed/FeedEditRegion.d.ts +6 -0
  174. package/lib/components/Feed/FeedEditRegion.d.ts.map +1 -0
  175. package/lib/components/Feed/FeedEditRegion.js +57 -0
  176. package/lib/components/Feed/FeedEditRegion.js.map +1 -0
  177. package/lib/components/Feed/FeedInputRegion.d.ts +8 -0
  178. package/lib/components/Feed/FeedInputRegion.d.ts.map +1 -0
  179. package/lib/components/Feed/FeedInputRegion.js +86 -0
  180. package/lib/components/Feed/FeedInputRegion.js.map +1 -0
  181. package/lib/components/Feed/FeedLikeButton.d.ts +7 -0
  182. package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -0
  183. package/lib/components/Feed/FeedLikeButton.js +102 -0
  184. package/lib/components/Feed/FeedLikeButton.js.map +1 -0
  185. package/lib/components/Feed/FeedModalList.d.ts +5 -0
  186. package/lib/components/Feed/FeedModalList.d.ts.map +1 -0
  187. package/lib/components/Feed/FeedModalList.js +39 -0
  188. package/lib/components/Feed/FeedModalList.js.map +1 -0
  189. package/lib/components/Feed/FeedNewPost.d.ts +7 -0
  190. package/lib/components/Feed/FeedNewPost.d.ts.map +1 -0
  191. package/lib/components/Feed/FeedNewPost.js +30 -0
  192. package/lib/components/Feed/FeedNewPost.js.map +1 -0
  193. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +6 -0
  194. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -0
  195. package/lib/components/Feed/FeedNewPostTypeMenu.js +375 -0
  196. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -0
  197. package/lib/components/Feed/FeedPost.d.ts +8 -0
  198. package/lib/components/Feed/FeedPost.d.ts.map +1 -0
  199. package/lib/components/Feed/FeedPost.js +85 -0
  200. package/lib/components/Feed/FeedPost.js.map +1 -0
  201. package/lib/components/Feed/FeedReply.d.ts +7 -0
  202. package/lib/components/Feed/FeedReply.d.ts.map +1 -0
  203. package/lib/components/Feed/FeedReply.js +36 -0
  204. package/lib/components/Feed/FeedReply.js.map +1 -0
  205. package/lib/components/Feed/FeedReplyInput.d.ts +7 -0
  206. package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -0
  207. package/lib/components/Feed/FeedReplyInput.js +21 -0
  208. package/lib/components/Feed/FeedReplyInput.js.map +1 -0
  209. package/lib/components/Feed/FeedRichText.d.ts +6 -0
  210. package/lib/components/Feed/FeedRichText.d.ts.map +1 -0
  211. package/lib/components/Feed/FeedRichText.js +155 -0
  212. package/lib/components/Feed/FeedRichText.js.map +1 -0
  213. package/lib/components/Feed/index.d.ts +7 -0
  214. package/lib/components/Feed/index.d.ts.map +1 -0
  215. package/lib/components/Feed/index.js +6 -0
  216. package/lib/components/Feed/index.js.map +1 -0
  217. package/lib/components/HashtagButton/HashtagButton.d.ts +23 -0
  218. package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -0
  219. package/lib/components/HashtagButton/HashtagButton.js +44 -0
  220. package/lib/components/HashtagButton/HashtagButton.js.map +1 -0
  221. package/lib/components/HashtagButton/index.d.ts +3 -0
  222. package/lib/components/HashtagButton/index.d.ts.map +1 -0
  223. package/lib/components/HashtagButton/index.js +3 -0
  224. package/lib/components/HashtagButton/index.js.map +1 -0
  225. package/lib/components/MentionButton/MentionButton.d.ts +35 -0
  226. package/lib/components/MentionButton/MentionButton.d.ts.map +1 -0
  227. package/lib/components/MentionButton/MentionButton.js +94 -0
  228. package/lib/components/MentionButton/MentionButton.js.map +1 -0
  229. package/lib/components/MentionButton/index.d.ts +3 -0
  230. package/lib/components/MentionButton/index.d.ts.map +1 -0
  231. package/lib/components/MentionButton/index.js +3 -0
  232. package/lib/components/MentionButton/index.js.map +1 -0
  233. package/lib/index.d.ts +12 -0
  234. package/lib/index.d.ts.map +1 -0
  235. package/lib/index.js +13 -0
  236. package/lib/index.js.map +1 -0
  237. package/package.json +4 -4
@@ -0,0 +1,15 @@
1
+ import type { FunctionComponent, ReactElement } from 'react';
2
+ import type { ForwardProps } from '@pega/cosmos-react-core';
3
+ interface AutopilotProps {
4
+ children: Record<string, string> | ReactElement;
5
+ }
6
+ declare const Autopilot: FunctionComponent<AutopilotProps & ForwardProps>;
7
+ export declare const AutopilotConfig: {
8
+ type: string;
9
+ xmlElement: string;
10
+ regexPattern: RegExp;
11
+ component: FunctionComponent<AutopilotProps & ForwardProps>;
12
+ inject: () => string;
13
+ };
14
+ export default Autopilot;
15
+ //# sourceMappingURL=Autopilot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autopilot.d.ts","sourceRoot":"","sources":["../../../src/components/Autopilot/Autopilot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,YAAY,EAAmB,MAAM,OAAO,CAAC;AAU/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC;CACjD;AAsBD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAoC9D,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;CAS3B,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, isValidElement, useContext, useState } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { Button, Icon, defaultThemeProp, useConsolidatedRef, useElement } from '@pega/cosmos-react-core';
5
+ import { FeedContext } from '../Feed/Feed.context';
6
+ const StyledAutopilotButton = styled(Button)(({ theme }) => {
7
+ return css `
8
+ color: ${theme.base.palette.ai};
9
+
10
+ &:enabled:focus,
11
+ &:not([disabled]):focus {
12
+ box-shadow: none;
13
+ text-decoration: underline;
14
+ }
15
+
16
+ svg {
17
+ margin-inline-end: calc(0.5 * ${theme.base.spacing});
18
+ }
19
+ `;
20
+ });
21
+ StyledAutopilotButton.defaultProps = defaultThemeProp;
22
+ const serializer = new XMLSerializer();
23
+ const Autopilot = forwardRef(function Autopilot({ children, ...restProps }, ref) {
24
+ const { autopilotInfo: { label: autopilotLabel }, onAutopilotClick } = useContext(FeedContext);
25
+ const [autopilotContent, setAutopilotContent] = useState();
26
+ const [target, setTarget] = useElement(null);
27
+ const mentionRef = useConsolidatedRef(ref);
28
+ const handleClick = (e) => {
29
+ setTarget(e.currentTarget);
30
+ const comp = onAutopilotClick?.({
31
+ target: e.currentTarget,
32
+ onDismiss: () => setTarget(null)
33
+ });
34
+ if (comp)
35
+ setAutopilotContent(comp);
36
+ };
37
+ return (_jsxs(_Fragment, { children: [_jsxs(StyledAutopilotButton, { ...restProps, ref: mentionRef, variant: 'link', onClick: handleClick, spellCheck: false, children: [_jsx(Icon, { name: 'polaris-solid' }), isValidElement(children) ? children : autopilotLabel] }), target && autopilotContent] }));
38
+ });
39
+ export const AutopilotConfig = {
40
+ type: 'autopilot',
41
+ xmlElement: 'pega-autopilot',
42
+ regexPattern: /(?:^|)<pega-autopilot\/>/g,
43
+ component: Autopilot,
44
+ inject: () => {
45
+ const element = document.createElementNS(null, 'pega-autopilot');
46
+ return serializer.serializeToString(element);
47
+ }
48
+ };
49
+ export default Autopilot;
50
+ //# sourceMappingURL=Autopilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autopilot.js","sourceRoot":"","sources":["../../../src/components/Autopilot/Autopilot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EA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,CAAC,SAAS,CAAC,IAAI,CAAC;SACjC,CAAC,CAAC;QACH,IAAI,IAAI;YAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,OAAO,CACL,8BACE,MAAC,qBAAqB,OAChB,SAAS,EACb,GAAG,EAAE,UAAU,EACf,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,KAAK,aAEjB,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,GAAG,EAC5B,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,IAC/B,EACvB,MAAM,IAAI,gBAAgB,IAC1B,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,2BAA2B;IACzC,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,GAAG,EAAE;QACX,MAAM,OAAO,GAAG,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QACjE,OAAO,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, isValidElement, useContext, useState } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, ReactElement, Ref, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Icon,\n defaultThemeProp,\n useConsolidatedRef,\n useElement\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface AutopilotProps {\n children: Record<string, string> | ReactElement;\n}\n\nconst StyledAutopilotButton = styled(Button)(({ theme }) => {\n return css`\n color: ${theme.base.palette.ai};\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: none;\n text-decoration: underline;\n }\n\n svg {\n margin-inline-end: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledAutopilotButton.defaultProps = defaultThemeProp;\n\nconst serializer = new XMLSerializer();\n\nconst Autopilot: FunctionComponent<AutopilotProps & ForwardProps> = forwardRef(function Autopilot(\n { children, ...restProps }: PropsWithoutRef<AutopilotProps>,\n ref: Ref<HTMLButtonElement>\n) {\n const {\n autopilotInfo: { label: autopilotLabel },\n onAutopilotClick\n } = useContext(FeedContext);\n const [autopilotContent, setAutopilotContent] = useState<JSX.Element | undefined>();\n const [target, setTarget] = useElement<HTMLButtonElement>(null);\n const mentionRef = useConsolidatedRef(ref);\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n setTarget(e.currentTarget);\n const comp = onAutopilotClick?.({\n target: e.currentTarget,\n onDismiss: () => setTarget(null)\n });\n if (comp) setAutopilotContent(comp);\n };\n\n return (\n <>\n <StyledAutopilotButton\n {...restProps}\n ref={mentionRef}\n variant='link'\n onClick={handleClick}\n spellCheck={false}\n >\n <Icon name='polaris-solid' />\n {isValidElement(children) ? children : autopilotLabel}\n </StyledAutopilotButton>\n {target && autopilotContent}\n </>\n );\n});\n\nexport const AutopilotConfig = {\n type: 'autopilot',\n xmlElement: 'pega-autopilot',\n regexPattern: /(?:^|)<pega-autopilot\\/>/g,\n component: Autopilot,\n inject: () => {\n const element = document.createElementNS(null, 'pega-autopilot');\n return serializer.serializeToString(element);\n }\n};\n\nexport default Autopilot;\n"]}
@@ -0,0 +1,8 @@
1
+ import type { FunctionComponent } from 'react';
2
+ import type { SubComponentVariant } from '../Feed/Feed.types';
3
+ interface AutopilotAvatarProps {
4
+ variant?: SubComponentVariant['variant'];
5
+ }
6
+ declare const AutopilotAvatar: FunctionComponent<AutopilotAvatarProps>;
7
+ export default AutopilotAvatar;
8
+ //# sourceMappingURL=AutopilotAvatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutopilotAvatar.d.ts","sourceRoot":"","sources":["../../../src/components/Autopilot/AutopilotAvatar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAkB5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { Avatar, useTheme } from '@pega/cosmos-react-core';
4
+ import { FeedContext } from '../Feed/Feed.context';
5
+ const AutopilotAvatar = ({ variant }) => {
6
+ const { autopilotInfo: { label: autopilotLabel } } = useContext(FeedContext);
7
+ const theme = useTheme();
8
+ let size = 'm';
9
+ if (variant === 'post')
10
+ size = 'l';
11
+ return (_jsx(Avatar, { name: autopilotLabel, icon: 'polaris-solid', size: size, color: theme.base.palette.light, backgroundColor: theme.base.palette.ai }));
12
+ };
13
+ export default AutopilotAvatar;
14
+ //# sourceMappingURL=AutopilotAvatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutopilotAvatar.js","sourceRoot":"","sources":["../../../src/components/Autopilot/AutopilotAvatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMnD,MAAM,eAAe,GAA4C,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/E,MAAM,EACJ,aAAa,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EACzC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,IAAI,GAAwB,GAAG,CAAC;IACpC,IAAI,OAAO,KAAK,MAAM;QAAE,IAAI,GAAG,GAAG,CAAC;IAEnC,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,cAAc,EACpB,IAAI,EAAC,eAAe,EACpB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAC/B,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GACtC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useContext } from 'react';\nimport type { FunctionComponent } from 'react';\n\nimport { Avatar, useTheme } from '@pega/cosmos-react-core';\nimport type { AvatarProps } from '@pega/cosmos-react-core';\n\nimport type { SubComponentVariant } from '../Feed/Feed.types';\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface AutopilotAvatarProps {\n variant?: SubComponentVariant['variant'];\n}\n\nconst AutopilotAvatar: FunctionComponent<AutopilotAvatarProps> = ({ variant }) => {\n const {\n autopilotInfo: { label: autopilotLabel }\n } = useContext(FeedContext);\n const theme = useTheme();\n\n let size: AvatarProps['size'] = 'm';\n if (variant === 'post') size = 'l';\n\n return (\n <Avatar\n name={autopilotLabel}\n icon='polaris-solid'\n size={size}\n color={theme.base.palette.light}\n backgroundColor={theme.base.palette.ai}\n />\n );\n};\n\nexport default AutopilotAvatar;\n"]}
@@ -0,0 +1,9 @@
1
+ import type { Ref } from 'react';
2
+ import type { BaseProps, InfoDialogProps, NoChildrenProp, OmitStrict, WithAttributes } from '@pega/cosmos-react-core';
3
+ export type AutopilotGlimpseProps = WithAttributes<'div', BaseProps & OmitStrict<InfoDialogProps, 'children' | 'progress'> & NoChildrenProp & {
4
+ /** Ref for the wrapping element. */
5
+ ref?: Ref<HTMLDivElement>;
6
+ }>;
7
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<AutopilotGlimpseProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
8
+ export default _default;
9
+ //# sourceMappingURL=AutopilotGlimpse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutopilotGlimpse.d.ts","sourceRoot":"","sources":["../../../src/components/Autopilot/AutopilotGlimpse.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,KAAK,EACV,SAAS,EAET,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACf,MAAM,yBAAyB,CAAC;AAQjC,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAChD,KAAK,EACL,SAAS,GACP,UAAU,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU,CAAC,GACpD,cAAc,GAAG;IACf,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B,CACJ,CAAC;;AAaF,wBA0BG"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useContext } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { defaultThemeProp, InfoDialog } from '@pega/cosmos-react-core';
5
+ import { RichTextViewer } from '@pega/cosmos-react-rte';
6
+ import { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';
7
+ import { FeedContext } from '../Feed/Feed.context';
8
+ import AutopilotAvatar from './AutopilotAvatar';
9
+ const StyledInfoDialog = styled(InfoDialog)(({ theme }) => {
10
+ return css `
11
+ ${StyledEditorContainer} {
12
+ padding: 0;
13
+ max-width: min(${theme.base['content-width'].sm}, calc(100vw - 2rem));
14
+ }
15
+ `;
16
+ });
17
+ StyledInfoDialog.defaultProps = defaultThemeProp;
18
+ export default forwardRef(function AutopilotGlimpse({ target, onDismiss, ...restProps }, ref) {
19
+ const { autopilotInfo } = useContext(FeedContext);
20
+ return (_jsx(StyledInfoDialog, { ...restProps, target: target, heading: {
21
+ primary: autopilotInfo.label,
22
+ secondary: autopilotInfo.meta,
23
+ visual: _jsx(AutopilotAvatar, {})
24
+ }, onDismiss: onDismiss, ref: ref, children: autopilotInfo.description && (_jsx(RichTextViewer, { type: 'markdown', content: autopilotInfo.description })) }));
25
+ });
26
+ //# sourceMappingURL=AutopilotGlimpse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutopilotGlimpse.js","sourceRoot":"","sources":["../../../src/components/Autopilot/AutopilotGlimpse.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASvE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4EAA4E,CAAC;AAEnH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAYhD,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;MACN,qBAAqB;;uBAEJ,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;;GAElD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,eAAe,UAAU,CAGvB,SAAS,gBAAgB,CACzB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAA0C,EAC3E,GAAiC;IAEjC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAElD,OAAO,CACL,KAAC,gBAAgB,OACX,SAAS,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;YACP,OAAO,EAAE,aAAa,CAAC,KAAK;YAC5B,SAAS,EAAE,aAAa,CAAC,IAAI;YAC7B,MAAM,EAAE,KAAC,eAAe,KAAG;SAC5B,EACD,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,YAEP,aAAa,CAAC,WAAW,IAAI,CAC5B,KAAC,cAAc,IAAC,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,aAAa,CAAC,WAAW,GAAI,CACvE,GACgB,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { forwardRef, useContext } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp, InfoDialog } from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n RefElement,\n InfoDialogProps,\n NoChildrenProp,\n OmitStrict,\n WithAttributes\n} from '@pega/cosmos-react-core';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\nimport AutopilotAvatar from './AutopilotAvatar';\n\nexport type AutopilotGlimpseProps = WithAttributes<\n 'div',\n BaseProps &\n OmitStrict<InfoDialogProps, 'children' | 'progress'> &\n NoChildrenProp & {\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n }\n>;\n\nconst StyledInfoDialog = styled(InfoDialog)(({ theme }) => {\n return css`\n ${StyledEditorContainer} {\n padding: 0;\n max-width: min(${theme.base['content-width'].sm}, calc(100vw - 2rem));\n }\n `;\n});\n\nStyledInfoDialog.defaultProps = defaultThemeProp;\n\nexport default forwardRef<\n RefElement<AutopilotGlimpseProps>,\n PropsWithoutRef<AutopilotGlimpseProps>\n>(function AutopilotGlimpse(\n { target, onDismiss, ...restProps }: PropsWithoutRef<AutopilotGlimpseProps>,\n ref: AutopilotGlimpseProps['ref']\n) {\n const { autopilotInfo } = useContext(FeedContext);\n\n return (\n <StyledInfoDialog\n {...restProps}\n target={target}\n heading={{\n primary: autopilotInfo.label,\n secondary: autopilotInfo.meta,\n visual: <AutopilotAvatar />\n }}\n onDismiss={onDismiss}\n ref={ref}\n >\n {autopilotInfo.description && (\n <RichTextViewer type='markdown' content={autopilotInfo.description} />\n )}\n </StyledInfoDialog>\n );\n});\n"]}
@@ -0,0 +1,4 @@
1
+ export { AutopilotConfig } from './Autopilot';
2
+ export { default as AutopilotGlimpse } from './AutopilotGlimpse';
3
+ export type { AutopilotGlimpseProps } from './AutopilotGlimpse';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Autopilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { AutopilotConfig } from './Autopilot';
2
+ export { default as AutopilotGlimpse } from './AutopilotGlimpse';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Autopilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { AutopilotConfig } from './Autopilot';\nexport { default as AutopilotGlimpse } from './AutopilotGlimpse';\nexport type { AutopilotGlimpseProps } from './AutopilotGlimpse';\n"]}
@@ -0,0 +1,29 @@
1
+ import type { FunctionComponent, Ref } from 'react';
2
+ import type { BannerProps, ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
+ import type { ChatComposerProps } from './ChatComposer';
4
+ import type { ChatHeaderProps } from './ChatHeader';
5
+ import type { SuggestedReplyPickerProps } from './SuggestedReplyPicker';
6
+ import type { ChatBodyProps } from './Chat.types';
7
+ export type ChatBannerProps = {
8
+ /** Content */
9
+ content: string;
10
+ /** Name of the icon */
11
+ icon: string;
12
+ };
13
+ export interface ChatProps extends NoChildrenProp {
14
+ /** ref to the element */
15
+ ref?: Ref<HTMLElement>;
16
+ /** Header of conversation pane */
17
+ header: ChatHeaderProps;
18
+ /** Wrapper of message groups, system messages, type ahead */
19
+ body: ChatBodyProps;
20
+ /** Wrapper of suggested replies */
21
+ suggestedReplyPicker?: SuggestedReplyPickerProps;
22
+ /** chat banner */
23
+ banner?: Pick<BannerProps, 'variant' | 'messages'>;
24
+ /** Wrapper of conversation input, emojis, attachments */
25
+ composer: ChatComposerProps;
26
+ }
27
+ declare const Chat: FunctionComponent<ChatProps & ForwardProps>;
28
+ export default Chat;
29
+ //# sourceMappingURL=Chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,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"}
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { Flex, Banner, defaultThemeProp } from '@pega/cosmos-react-core';
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';
10
+ const StyledUtilityContainer = styled.div ``;
11
+ const StyledUtilityMerger = styled.div ``;
12
+ const StyledUtilityContent = styled.div ``;
13
+ const StyledChatContainer = styled.section(props => {
14
+ const { theme: { base: { spacing, shadow: { high: shadowHigh }, palette: { 'primary-background': primaryBackground, 'secondary-background': secondaryBackground }, 'border-radius': borderRadius } } } = props;
15
+ return css `
16
+ height: 100%;
17
+ background: ${primaryBackground};
18
+ width: 100%;
19
+ border-radius: ${borderRadius};
20
+ ${StyledUtilityMerger} {
21
+ min-height: 15rem;
22
+ position: relative;
23
+ height: 100%;
24
+ overflow-y: hidden;
25
+ }
26
+ ${StyledUtilityContainer} {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ z-index: 2;
31
+ max-height: 60%;
32
+ width: 100%;
33
+ background-color: ${secondaryBackground};
34
+ > ${StyledUtilityContent} {
35
+ padding: ${spacing} 0;
36
+ box-shadow: ${shadowHigh};
37
+ height: auto;
38
+ width: 100%;
39
+ overflow-y: auto;
40
+ background: linear-gradient(${secondaryBackground} 10%, rgba(255, 255, 255, 0)),
41
+ linear-gradient(rgba(255, 255, 255, 0), ${secondaryBackground} 10%) 0 100%,
42
+ radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)),
43
+ radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)) 0 100%;
44
+ background-repeat: no-repeat;
45
+ background-size: 100% 1rem, 100% 1rem, 100% 0.25rem, 100% 0.25rem;
46
+ background-attachment: local, local, scroll, scroll;
47
+ }
48
+ }
49
+ ${StyledBanner} {
50
+ padding: calc(2 * ${spacing});
51
+ margin-bottom: 0;
52
+ flex-shrink: 0;
53
+ }
54
+ `;
55
+ });
56
+ StyledChatContainer.defaultProps = defaultThemeProp;
57
+ const Chat = forwardRef(function Chat(props, ref) {
58
+ const { header, body, composer, banner, suggestedReplyPicker, ...restProps } = props;
59
+ return (_jsxs(Flex, { ref: ref, as: StyledChatContainer, container: {
60
+ direction: 'column'
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 })] }));
62
+ });
63
+ export default Chat;
64
+ //# sourceMappingURL=Chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO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;IAErB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAErF,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE;YACT,SAAS,EAAE,QAAQ;SACpB,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 { forwardRef } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, Banner, defaultThemeProp } from '@pega/cosmos-react-core';\nimport type { BannerProps, ForwardProps, NoChildrenProp } 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 type { ChatComposerProps } from './ChatComposer';\nimport ChatHeader from './ChatHeader';\nimport type { ChatHeaderProps } from './ChatHeader';\nimport SuggestedReplyPicker from './SuggestedReplyPicker';\nimport type { SuggestedReplyPickerProps } from './SuggestedReplyPicker';\nimport type { 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"]}
@@ -0,0 +1,136 @@
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { DefaultTheme } from 'styled-components';
3
+ import type { BaseProps, Action, NoChildrenProp, OmitStrict, LinkProps, AvatarProps } from '@pega/cosmos-react-core';
4
+ export interface AttachmentItemProps extends BaseProps {
5
+ /** Unique Id for this attachment */
6
+ id: string;
7
+ /** Name of the attachment. */
8
+ name: string;
9
+ /**
10
+ * A Cosmos icon name identifier to use for a attachment. Will serve as a fallback to a broken thumbnail.
11
+ * @default 'document-doc'
12
+ */
13
+ icon?: string;
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. */
15
+ thumbnail?: string;
16
+ /** 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. */
17
+ meta?: string;
18
+ /** When passed, previews the attachment on click */
19
+ onPreview?: (id: string) => void;
20
+ /** Actions list for the attachment */
21
+ actions?: Action[];
22
+ /** When passed, this will render a single icon button or within a MenuButton if onDelete is defined. */
23
+ onDelete?: (id: string) => void;
24
+ }
25
+ export type UserAvailability = 'available' | 'unavailable' | 'temporarilyUnavailable';
26
+ export interface ChatSettingsPanelProps extends NoChildrenProp {
27
+ status?: UserAvailability;
28
+ label: string;
29
+ onClick: () => void;
30
+ }
31
+ export type ColorTheme = [
32
+ keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>,
33
+ 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark'
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 {};
136
+ //# sourceMappingURL=Chat.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chat.types.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CA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AAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF,KAAK,yBAAyB,GAAG,UAAU,CAAC,kBAAkB,EAAE,cAAc,CAAC,GAAG;IAChF,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,0BAA0B,GAC1B,yBAAyB,CAAC;AAE9B,eAAO,MAAM,iBAAiB,YACnB,qBAAqB,oCAG/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACzB,qBAAqB,0CAG/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACzB,qBAAqB,yCAG/B,CAAC"}
@@ -0,0 +1,10 @@
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
+ };
10
+ //# sourceMappingURL=Chat.types.js.map
@@ -0,0 +1 @@
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 type { ReactNode, Ref } from 'react';\nimport type { DefaultTheme } from 'styled-components';\n\nimport type {\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"]}
@@ -0,0 +1,7 @@
1
+ import type { FunctionComponent } from 'react';
2
+ import type { ForwardProps } from '@pega/cosmos-react-core';
3
+ import type { ChatBodyProps } from './Chat.types';
4
+ export declare const NewMessageSeparatorId = "new-message-separator";
5
+ declare const ChatBody: FunctionComponent<ChatBodyProps & ForwardProps>;
6
+ export default ChatBody;
7
+ //# sourceMappingURL=ChatBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatBody.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatBody.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAA8B,MAAM,OAAO,CAAC;AAoB3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,KAAK,EAGV,aAAa,EAEd,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"}