@pega/cosmos-react-work 10.0.0-build.1.8 → 10.0.0-build.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +8 -4
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +38 -11
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.d.ts +2 -0
  6. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.d.ts.map +1 -0
  7. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.js +8 -0
  8. package/lib/components/AppAnnouncement/AppAnnouncement.test-ids.js.map +1 -0
  9. package/lib/components/Article/ArticleRating.d.ts.map +1 -1
  10. package/lib/components/Article/ArticleRating.js +2 -2
  11. package/lib/components/Article/ArticleRating.js.map +1 -1
  12. package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
  13. package/lib/components/ArticleList/ArticleFeedback.js +2 -2
  14. package/lib/components/ArticleList/ArticleFeedback.js.map +1 -1
  15. package/lib/components/CasePreview/CasePreview.d.ts +2 -0
  16. package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
  17. package/lib/components/CasePreview/CasePreview.js +33 -13
  18. package/lib/components/CasePreview/CasePreview.js.map +1 -1
  19. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
  20. package/lib/components/CaseView/CaseHeader/CaseHeader.js +5 -3
  21. package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
  22. package/lib/components/CaseView/CaseSummary.d.ts +3 -2
  23. package/lib/components/CaseView/CaseSummary.d.ts.map +1 -1
  24. package/lib/components/CaseView/CaseSummary.js +2 -2
  25. package/lib/components/CaseView/CaseSummary.js.map +1 -1
  26. package/lib/components/CaseView/CaseView.d.ts.map +1 -1
  27. package/lib/components/CaseView/CaseView.js +6 -12
  28. package/lib/components/CaseView/CaseView.js.map +1 -1
  29. package/lib/components/CaseView/CaseView.styles.d.ts +2 -2
  30. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  31. package/lib/components/CaseView/CaseView.styles.js +193 -153
  32. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  33. package/lib/components/CaseView/CaseView.types.d.ts +6 -2
  34. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
  35. package/lib/components/CaseView/CaseView.types.js.map +1 -1
  36. package/lib/components/CaseView/UtilitiesSummary.js +1 -4
  37. package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
  38. package/lib/components/CaseView/UtilitySummaryItemDialog.d.ts.map +1 -1
  39. package/lib/components/CaseView/UtilitySummaryItemDialog.js +7 -4
  40. package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
  41. package/lib/components/Details/Details.d.ts.map +1 -1
  42. package/lib/components/Details/Details.js +9 -6
  43. package/lib/components/Details/Details.js.map +1 -1
  44. package/lib/components/Details/Details.styles.d.ts.map +1 -1
  45. package/lib/components/Details/Details.styles.js +10 -7
  46. package/lib/components/Details/Details.styles.js.map +1 -1
  47. package/lib/components/Details/DetailsList.d.ts.map +1 -1
  48. package/lib/components/Details/DetailsList.js +2 -2
  49. package/lib/components/Details/DetailsList.js.map +1 -1
  50. package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -1
  51. package/lib/components/GenAICoach/ActiveCases.js +2 -1
  52. package/lib/components/GenAICoach/ActiveCases.js.map +1 -1
  53. package/lib/components/GenAICoach/GenAICoach.d.ts +1 -1
  54. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  55. package/lib/components/GenAICoach/GenAICoach.js +267 -73
  56. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  57. package/lib/components/GenAICoach/GenAICoach.styles.d.ts +232 -9
  58. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  59. package/lib/components/GenAICoach/GenAICoach.styles.js +374 -192
  60. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  61. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +1 -1
  62. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
  63. package/lib/components/GenAICoach/GenAICoach.test-ids.js +3 -1
  64. package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
  65. package/lib/components/GenAICoach/GenAICoach.types.d.ts +36 -3
  66. package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
  67. package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
  68. package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
  69. package/lib/components/GenAICoach/GenAIMessage.js +44 -21
  70. package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
  71. package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -1
  72. package/lib/components/GenAICoach/GenAIMessageFeedback.js +10 -3
  73. package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -1
  74. package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -1
  75. package/lib/components/GenAICoach/Questionnaire.js +10 -3
  76. package/lib/components/GenAICoach/Questionnaire.js.map +1 -1
  77. package/lib/components/GenAICoach/index.d.ts +1 -1
  78. package/lib/components/GenAICoach/index.d.ts.map +1 -1
  79. package/lib/components/GenAICoach/index.js.map +1 -1
  80. package/lib/components/HeroBanner/HeroBanner.d.ts +7 -0
  81. package/lib/components/HeroBanner/HeroBanner.d.ts.map +1 -0
  82. package/lib/components/HeroBanner/HeroBanner.js +63 -0
  83. package/lib/components/HeroBanner/HeroBanner.js.map +1 -0
  84. package/lib/components/HeroBanner/HeroBanner.styles.d.ts +35 -0
  85. package/lib/components/HeroBanner/HeroBanner.styles.d.ts.map +1 -0
  86. package/lib/components/HeroBanner/HeroBanner.styles.js +118 -0
  87. package/lib/components/HeroBanner/HeroBanner.styles.js.map +1 -0
  88. package/lib/components/HeroBanner/HeroBanner.test-ids.d.ts +2 -0
  89. package/lib/components/HeroBanner/HeroBanner.test-ids.d.ts.map +1 -0
  90. package/lib/components/HeroBanner/HeroBanner.test-ids.js +11 -0
  91. package/lib/components/HeroBanner/HeroBanner.test-ids.js.map +1 -0
  92. package/lib/components/HeroBanner/HeroBanner.types.d.ts +51 -0
  93. package/lib/components/HeroBanner/HeroBanner.types.d.ts.map +1 -0
  94. package/lib/components/HeroBanner/HeroBanner.types.js +2 -0
  95. package/lib/components/HeroBanner/HeroBanner.types.js.map +1 -0
  96. package/lib/components/HeroBanner/index.d.ts +3 -0
  97. package/lib/components/HeroBanner/index.d.ts.map +1 -0
  98. package/lib/components/HeroBanner/index.js +2 -0
  99. package/lib/components/HeroBanner/index.js.map +1 -0
  100. package/lib/components/HeroBanner/utils.d.ts +20 -0
  101. package/lib/components/HeroBanner/utils.d.ts.map +1 -0
  102. package/lib/components/HeroBanner/utils.js +125 -0
  103. package/lib/components/HeroBanner/utils.js.map +1 -0
  104. package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
  105. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +5 -1
  106. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
  107. package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
  108. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +5 -1
  109. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
  110. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +25 -15
  111. package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
  112. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
  113. package/lib/components/IntelligentGuidance/IntelligentGuidance.js +6 -5
  114. package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
  115. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
  116. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +27 -9
  117. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
  118. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +8 -0
  119. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
  120. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
  121. package/lib/components/InteractionNotification/InteractionNotification.d.ts +2 -2
  122. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
  123. package/lib/components/InteractionNotification/InteractionNotification.js +6 -4
  124. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
  125. package/lib/components/MasterDetail/DetailPanelHeader.d.ts +29 -0
  126. package/lib/components/MasterDetail/DetailPanelHeader.d.ts.map +1 -0
  127. package/lib/components/MasterDetail/DetailPanelHeader.js +14 -0
  128. package/lib/components/MasterDetail/DetailPanelHeader.js.map +1 -0
  129. package/lib/components/MasterDetail/MasterDetail.d.ts +6 -0
  130. package/lib/components/MasterDetail/MasterDetail.d.ts.map +1 -0
  131. package/lib/components/MasterDetail/MasterDetail.js +116 -0
  132. package/lib/components/MasterDetail/MasterDetail.js.map +1 -0
  133. package/lib/components/MasterDetail/MasterDetail.styles.d.ts +595 -0
  134. package/lib/components/MasterDetail/MasterDetail.styles.d.ts.map +1 -0
  135. package/lib/components/MasterDetail/MasterDetail.styles.js +246 -0
  136. package/lib/components/MasterDetail/MasterDetail.styles.js.map +1 -0
  137. package/lib/components/MasterDetail/MasterDetail.test-ids.d.ts +2 -0
  138. package/lib/components/MasterDetail/MasterDetail.test-ids.d.ts.map +1 -0
  139. package/lib/components/MasterDetail/MasterDetail.test-ids.js +19 -0
  140. package/lib/components/MasterDetail/MasterDetail.test-ids.js.map +1 -0
  141. package/lib/components/MasterDetail/MasterDetail.types.d.ts +71 -0
  142. package/lib/components/MasterDetail/MasterDetail.types.d.ts.map +1 -0
  143. package/lib/components/MasterDetail/MasterDetail.types.js +2 -0
  144. package/lib/components/MasterDetail/MasterDetail.types.js.map +1 -0
  145. package/lib/components/MasterDetail/MasterDetailActions.d.ts +10 -0
  146. package/lib/components/MasterDetail/MasterDetailActions.d.ts.map +1 -0
  147. package/lib/components/MasterDetail/MasterDetailActions.js +45 -0
  148. package/lib/components/MasterDetail/MasterDetailActions.js.map +1 -0
  149. package/lib/components/MasterDetail/index.d.ts +5 -0
  150. package/lib/components/MasterDetail/index.d.ts.map +1 -0
  151. package/lib/components/MasterDetail/index.js +4 -0
  152. package/lib/components/MasterDetail/index.js.map +1 -0
  153. package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
  154. package/lib/components/SearchResults/SearchResults.js +11 -7
  155. package/lib/components/SearchResults/SearchResults.js.map +1 -1
  156. package/lib/components/SearchResults/SearchResults.styles.js +3 -3
  157. package/lib/components/SearchResults/SearchResults.styles.js.map +1 -1
  158. package/lib/components/Shortcuts/Shortcuts.d.ts +1 -1
  159. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -1
  160. package/lib/components/Shortcuts/Shortcuts.js +40 -18
  161. package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
  162. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +17 -6
  163. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
  164. package/lib/components/Shortcuts/Shortcuts.styles.js +104 -58
  165. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
  166. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +1 -1
  167. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -1
  168. package/lib/components/Shortcuts/Shortcuts.test-ids.js +4 -3
  169. package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -1
  170. package/lib/components/Shortcuts/Shortcuts.types.d.ts +18 -2
  171. package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -1
  172. package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -1
  173. package/lib/components/Stages/Stages.d.ts +4 -2
  174. package/lib/components/Stages/Stages.d.ts.map +1 -1
  175. package/lib/components/Stages/Stages.js +123 -88
  176. package/lib/components/Stages/Stages.js.map +1 -1
  177. package/lib/components/Stages/Stages.styles.d.ts +88 -3
  178. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  179. package/lib/components/Stages/Stages.styles.js +873 -171
  180. package/lib/components/Stages/Stages.styles.js.map +1 -1
  181. package/lib/components/Stages/Stages.test-ids.d.ts +2 -0
  182. package/lib/components/Stages/Stages.test-ids.d.ts.map +1 -0
  183. package/lib/components/Stages/Stages.test-ids.js +7 -0
  184. package/lib/components/Stages/Stages.test-ids.js.map +1 -0
  185. package/lib/components/Stages/Stages.types.d.ts +9 -3
  186. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  187. package/lib/components/Stages/Stages.types.js.map +1 -1
  188. package/lib/components/Stages/index.d.ts +2 -1
  189. package/lib/components/Stages/index.d.ts.map +1 -1
  190. package/lib/components/Stages/index.js +1 -0
  191. package/lib/components/Stages/index.js.map +1 -1
  192. package/lib/components/Stages/useStagesScrollbar.d.ts +21 -0
  193. package/lib/components/Stages/useStagesScrollbar.d.ts.map +1 -0
  194. package/lib/components/Stages/useStagesScrollbar.js +152 -0
  195. package/lib/components/Stages/useStagesScrollbar.js.map +1 -0
  196. package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
  197. package/lib/components/Stakeholders/Stakeholders.js +13 -11
  198. package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
  199. package/lib/components/Stakeholders/Stakeholders.types.d.ts +1 -1
  200. package/lib/components/Stakeholders/Stakeholders.types.d.ts.map +1 -1
  201. package/lib/components/Stakeholders/Stakeholders.types.js.map +1 -1
  202. package/lib/components/Tags/Tags.d.ts.map +1 -1
  203. package/lib/components/Tags/Tags.js +2 -13
  204. package/lib/components/Tags/Tags.js.map +1 -1
  205. package/lib/components/Tasks/TaskCard.d.ts +8 -0
  206. package/lib/components/Tasks/TaskCard.d.ts.map +1 -0
  207. package/lib/components/Tasks/TaskCard.js +42 -0
  208. package/lib/components/Tasks/TaskCard.js.map +1 -0
  209. package/lib/components/Tasks/TaskCards.d.ts +9 -0
  210. package/lib/components/Tasks/TaskCards.d.ts.map +1 -0
  211. package/lib/components/Tasks/TaskCards.js +40 -0
  212. package/lib/components/Tasks/TaskCards.js.map +1 -0
  213. package/lib/components/Tasks/TaskList.d.ts +13 -1
  214. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  215. package/lib/components/Tasks/TaskList.js +31 -19
  216. package/lib/components/Tasks/TaskList.js.map +1 -1
  217. package/lib/components/Tasks/Tasks.d.ts +46 -6
  218. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  219. package/lib/components/Tasks/Tasks.js +11 -5
  220. package/lib/components/Tasks/Tasks.js.map +1 -1
  221. package/lib/components/Tasks/Tasks.test-ids.d.ts +1 -1
  222. package/lib/components/Tasks/Tasks.test-ids.d.ts.map +1 -1
  223. package/lib/components/Tasks/Tasks.test-ids.js +1 -1
  224. package/lib/components/Tasks/Tasks.test-ids.js.map +1 -1
  225. package/lib/components/Tasks/index.d.ts +1 -1
  226. package/lib/components/Tasks/index.d.ts.map +1 -1
  227. package/lib/components/Tasks/index.js.map +1 -1
  228. package/lib/index.d.ts +4 -0
  229. package/lib/index.d.ts.map +1 -1
  230. package/lib/index.js +4 -0
  231. package/lib/index.js.map +1 -1
  232. package/package.json +5 -6
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
3
  import { getLuminance } from 'polished';
4
- import { Button, Flex, Icon, MenuButton, Progress, Text, createUID, menuHelpers, useI18n, useSpeechRecognition, useTestIds, useTheme, withTestIds, registerIcon, usePrevious, getFocusables, isMenuGroupProps, ErrorState, useArrows, useFocusTrap, useLiveLog, useOuterEvent, ThemeOverride, hasProp, getActiveElement, useElement, Actions, useFullscreenContext, useBreakpoint, Grid, useRefMap, VisuallyHiddenText, FileList, Lightbox, FormField, useUID, SpeechToTextButton, Toaster, useToaster, throttle } from '@pega/cosmos-react-core';
4
+ import { Button, Flex, Icon, MenuButton, Progress, Text, createUID, menuHelpers, useI18n, useSpeechRecognition, useTestIds, useTheme, withTestIds, registerIcon, usePrevious, getFocusables, isMenuGroupProps, ErrorState, useArrows, useFocusTrap, useLiveLog, useOuterEvent, ThemeOverride, hasProp, getActiveElement, useElement, Actions, useFullscreenContext, useBreakpoint, Grid, useRefMap, VisuallyHiddenText, FileList, Lightbox, FormField, useUID, SpeechToTextButton, Toaster, useToaster, throttle, Tooltip } from '@pega/cosmos-react-core';
5
5
  import * as caretUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-up.icon';
6
6
  import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
7
7
  import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
@@ -12,19 +12,36 @@ import * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icon
12
12
  import * as sendSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/send-solid.icon';
13
13
  import * as squareSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/square-solid.icon';
14
14
  import * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
15
+ import * as moreAltIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/more-alt.icon';
15
16
  import * as dockIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/dock.icon';
16
17
  import * as undockIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/undock.icon';
17
18
  import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
18
19
  import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
20
+ import * as clockSlaIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/clock-sla.icon';
19
21
  import { getGenAICoachTestIds } from './GenAICoach.test-ids';
20
22
  import { getSelectedKeys, isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
21
- import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledMenuSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper, StyledErrorContainer, StyledInput, StyledGuidedSuggestions, StyledComposerSection, StyledSendButton, StyledStopGeneratingButton, StyledGenAIFormControl, StyledGenAITextArea, StyledInitialMessageGrid, StyledGenAIFooter, StyledAgentIcon, StyledActionsContainer, StyledFullscreenWrapper, StyledScrollButton, StyledSuggestionCardsView, StyledSuggestionCardsBottomHalf, StyledStickyComposer, StyledAISuggestedBadge, StyledSalutation, StyledComposerWrapper } from './GenAICoach.styles';
23
+ import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledMenuSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper, StyledErrorContainer, StyledInput, StyledGuidedSuggestions, StyledComposerSection, StyledSendButton, StyledStopGeneratingButton, StyledGenAIFormControl, StyledGenAITextArea, StyledInitialMessageGrid, StyledGenAIFooter, StyledAgentIcon, StyledActionsContainer, StyledHeaderContainer, StyledFullscreenWrapper, StyledScrollButton, StyledSuggestionCardsView, StyledSuggestionCardsBottomHalf, StyledStickyComposer, StyledAISuggestedBadge, StyledSalutation, StyledSubHeading, StyledComposerWrapper, StyledBannerSalutationBlock, StyledComposerSelector, StyledSimplifiedInitialMessageGrid, StyledConversationHistoryButton } from './GenAICoach.styles';
22
24
  import ActiveCases from './ActiveCases';
23
25
  import CaseWorkflow from './CaseWorkflow';
24
26
  import ConversationHistory from './ConversationHistory';
25
27
  import Questionnaire from './Questionnaire';
26
28
  import { GenAIMessage, InitialSuggestedMessage } from '.';
27
- registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon, squareSolidIcon, sendSolidIcon, plusIcon, dockIcon, undockIcon, caretLeftIcon, caretRightIcon);
29
+ registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon, squareSolidIcon, sendSolidIcon, plusIcon, dockIcon, undockIcon, caretLeftIcon, caretRightIcon, clockSlaIcon, moreAltIcon);
30
+ const onHeightTransitionEnd = (el, callback) => {
31
+ const handler = (e) => {
32
+ if (e.propertyName !== 'height' || e.target !== el)
33
+ return;
34
+ el.removeEventListener('transitionend', handler);
35
+ el.removeEventListener('transitioncancel', handler);
36
+ callback();
37
+ };
38
+ el.addEventListener('transitionend', handler);
39
+ el.addEventListener('transitioncancel', handler);
40
+ return () => {
41
+ el.removeEventListener('transitionend', handler);
42
+ el.removeEventListener('transitioncancel', handler);
43
+ };
44
+ };
28
45
  const buildInitialFormAnswers = (questions = []) => Object.fromEntries(questions.map(question => [
29
46
  question.field,
30
47
  {
@@ -45,11 +62,11 @@ export const AISuggestedBadge = () => {
45
62
  const t = useI18n();
46
63
  return (_jsxs(StyledAISuggestedBadge, { container: { alignItems: 'center', gap: 0.5 }, children: [_jsx(Icon, { name: 'polaris-solid', "aria-hidden": true, size: 'font-size' }), _jsx(Text, { children: t('ai_suggestion') })] }));
47
64
  };
48
- const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef, onFullscreenToggle, isFullscreen, selectedCoach, actionsTestId }) => {
65
+ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef, onFullscreenToggle, isFullscreen, selectedCoach, actionsTestId, simplifiedAgent }) => {
49
66
  const t = useI18n();
50
67
  const fullscreenIcon = isFullscreen ? 'dock' : 'undock';
51
68
  const extraItems = [
52
- ...(allowFullScreen
69
+ ...(allowFullScreen && !simplifiedAgent
53
70
  ? [
54
71
  {
55
72
  id: 'fullscreen',
@@ -76,15 +93,25 @@ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef,
76
93
  const mergedItems = [...(actions?.items ?? []), ...extraItems];
77
94
  if (mergedItems.length === 0)
78
95
  return null;
96
+ if (simplifiedAgent) {
97
+ return (_jsx(MenuButton, { "data-testid": actionsTestId, text: t('actions'), "aria-label": selectedCoach ? t('actions_for', [selectedCoach]) : undefined, iconOnly: true, icon: 'more-alt', variant: 'simple', menu: {
98
+ items: mergedItems.map(({ text, onClick, ...rest }) => ({
99
+ ...rest,
100
+ primary: text,
101
+ onClick: onClick ? (id, e) => onClick(id, e) : undefined
102
+ }))
103
+ } }));
104
+ }
79
105
  return (_jsx(Actions, { ...(actions ?? {}), menuAt: 1, "data-testid": actionsTestId, contextualLabel: selectedCoach, items: mergedItems }));
80
106
  };
81
- const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, onNewChat, conversationHistory, onLayoutChange, onAddAttachment, attachments, attachmentsError, lightboxPreviewProps, allowFullScreen = true, isInLandingPageUtilities, stopProcess, voiceToTextProps, salutation, showSalutation = true, isPortalAgent = false, pagePanel, suggestionCardsView, draftMessage, caseWorkflow, activeCases, onStop, isCreatingConversation, conversationError, questionnaireData, onQuestionnaireDismiss, ...restProps }) => {
107
+ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, onNewChat, conversationHistory, onConversationHistoryOpen, onLayoutChange, onAddAttachment, showMultipleAttachments = false, attachments, attachmentsError, lightboxPreviewProps, allowFullScreen = true, isInLandingPageUtilities, stopProcess, voiceToTextProps, salutation, showSalutation = true, isPortalAgent = false, pagePanel, suggestionCardsView, draftMessage, caseWorkflow, activeCases, onStop, isCreatingConversation, conversationId, conversationError, questionnaireData, onQuestionnaireDismiss, simplifiedAgent = false, subHeading, operatorName, agentModeProps, modelSelectorProps, ...restProps }) => {
82
108
  const scrollTolerancePx = 2;
83
109
  const scrollThresholdPx = 50;
84
- const streamBufferLh = 5;
110
+ const streamBufferLh = simplifiedAgent ? 15 : 5;
85
111
  const bufferExtensionLh = 2;
86
112
  const scrollThrottleMs = 50;
87
113
  const resizeThrottleMs = 33;
114
+ const bannerTransitionMs = 600;
88
115
  const theme = useTheme();
89
116
  const t = useI18n();
90
117
  const testIds = useTestIds(testId, getGenAICoachTestIds);
@@ -93,15 +120,25 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
93
120
  const conversationRef = useRef(null);
94
121
  const genAICoachRef = useRef(null);
95
122
  const [messageEls, getMessageCbRef] = useRefMap();
123
+ const [showInitialScreen, setShowInitialScreen] = useState(true);
124
+ const agentInBanner = simplifiedAgent && variant.placement === 'fullpage';
125
+ const historyOpen = !!conversationHistory;
126
+ const agentExpanded = simplifiedAgent && messages.length > 0;
127
+ const hasAgentResponse = messages.some(msg => isCoachMessage(msg) && !msg.loading);
96
128
  const focusInMessageListRef = useRef(false);
97
129
  const mouseTriggeredFocusRef = useRef(false);
98
130
  const isUserTriggered = useRef(false);
131
+ const userInitiatedSendRef = useRef(false);
132
+ const prevHeightRef = useRef(0);
133
+ const showNextCoachSender = useRef(true);
99
134
  const lastFocusedMessageRef = useRef(null);
100
135
  const initialFocusedElementRef = useRef(null);
101
136
  const inputContainerRef = useRef(null);
102
137
  const messageContainerRef = useRef(null);
103
138
  const textAreaRef = useRef(null);
104
139
  const [suggestionMenuButton, setSuggestionMenuButton] = useElement(null);
140
+ const [agentModeButtonEl, setAgentModeButtonEl] = useElement(null);
141
+ const [modelSelectorButtonEl, setModelSelectorButtonEl] = useElement(null);
105
142
  const isGeneratingResponse = useRef(false);
106
143
  const focusTextArea = useRef(false);
107
144
  const historyViewRef = useRef(null);
@@ -129,7 +166,6 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
129
166
  });
130
167
  const [message, setMessage] = useState('');
131
168
  const [interimMessage, setInterimMessage] = useState('');
132
- const [coachOptions, setCoachOptions] = useState(coachOptionsProps);
133
169
  const [focusedInMessage, setFocusedInMessage] = useState(false);
134
170
  const scrollButtonRef = useRef(null);
135
171
  const trapRef = useRef(null);
@@ -318,7 +354,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
318
354
  if (lastMessage instanceof HTMLElement) {
319
355
  lastFocusedMessageRef.current = lastMessage;
320
356
  focusInMessageListRef.current = true;
321
- lastMessage.focus();
357
+ lastMessage.focus({ preventScroll: true });
322
358
  }
323
359
  }, [scrollToLatest]);
324
360
  const suggestionCardsViewElRef = useRef(null);
@@ -390,27 +426,41 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
390
426
  messageContainerRef.current = el;
391
427
  }, []);
392
428
  const onCoachChange = (id) => {
393
- setCoachOptions(cur => {
394
- return cur.map(coach => {
395
- return {
396
- ...coach,
397
- selected: coach.id === id
398
- };
399
- });
400
- });
401
429
  onCoachChangeProp?.(id);
402
430
  };
403
431
  const selectedCoach = useMemo(() => {
404
- const selected = menuHelpers.getSelected(coachOptions)[0];
432
+ const selected = menuHelpers.getSelected(coachOptionsProps)[0];
405
433
  if (selected)
406
434
  return selected.primary;
407
- if (coachOptions[0]) {
408
- if (isMenuGroupProps(coachOptions[0])) {
409
- return coachOptions[0].items[0].primary;
435
+ if (coachOptionsProps[0]) {
436
+ if (isMenuGroupProps(coachOptionsProps[0])) {
437
+ return coachOptionsProps[0].items[0].primary;
410
438
  }
411
- return coachOptions[0].primary;
439
+ return coachOptionsProps[0].primary;
412
440
  }
413
- }, [coachOptions]);
441
+ }, [coachOptionsProps]);
442
+ const selectedAgentModeLabel = useMemo(() => {
443
+ if (!agentModeProps)
444
+ return '';
445
+ const selected = menuHelpers.getSelected(agentModeProps.modes)[0];
446
+ if (selected)
447
+ return selected.primary;
448
+ if (agentModeProps.modes[0]) {
449
+ if (isMenuGroupProps(agentModeProps.modes[0])) {
450
+ return agentModeProps.modes[0].items[0].primary;
451
+ }
452
+ return agentModeProps.modes[0].primary;
453
+ }
454
+ return '';
455
+ }, [agentModeProps]);
456
+ const selectedModelLabel = useMemo(() => {
457
+ if (!modelSelectorProps)
458
+ return '';
459
+ return menuHelpers
460
+ .getSelected(modelSelectorProps.options)
461
+ .map(s => s.primary)
462
+ .join(' · ');
463
+ }, [modelSelectorProps]);
414
464
  const onResult = useCallback(value => {
415
465
  pendingResult.current = false;
416
466
  setMessage(prevMessage => {
@@ -443,6 +493,12 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
443
493
  isCoachMessageLoading ||
444
494
  (latestMessage && isCoachMessage(latestMessage) && latestMessage.isToolConfirmation))
445
495
  return;
496
+ if (simplifiedAgent) {
497
+ userInitiatedSendRef.current = true;
498
+ if (agentInBanner && messages.length === 0) {
499
+ prevHeightRef.current = genAICoachRef.current?.getBoundingClientRect().height ?? 0;
500
+ }
501
+ }
446
502
  onSend({
447
503
  id: createUID(),
448
504
  message,
@@ -451,40 +507,71 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
451
507
  formAnswers: hasFormAnswers ? formAnswers : undefined
452
508
  });
453
509
  setFormAnswers(undefined);
454
- setMessage('');
510
+ // '' means the conversation is created by this send, so the text stays until it exists.
511
+ if (conversationId !== '')
512
+ setMessage('');
455
513
  if (active) {
456
514
  stop();
457
515
  }
458
- }, [message, latestMessage, attachments, attachmentsError, formAnswers, questionnaireData]);
516
+ }, [
517
+ message,
518
+ latestMessage,
519
+ attachments,
520
+ attachmentsError,
521
+ formAnswers,
522
+ questionnaireData,
523
+ conversationId
524
+ ]);
459
525
  const handleEnterKeyDown = (e) => {
460
526
  if (e.key === 'Enter' && !e.shiftKey) {
461
527
  e.preventDefault();
462
528
  e.stopPropagation();
463
- handleSendMessage();
529
+ if (!isCreatingConversation)
530
+ handleSendMessage();
464
531
  }
465
532
  };
466
533
  const handleTextAreaChange = useCallback((e) => {
467
534
  setMessage(e.currentTarget.value);
468
535
  }, [setMessage]);
469
536
  const renderCoachOptions = useMemo(() => {
470
- if (coachOptions.length === 0 || !selectedCoach) {
537
+ if (coachOptionsProps.length === 0 || !selectedCoach) {
471
538
  return null;
472
539
  }
473
- if (coachOptions.length === 1) {
540
+ if (coachOptionsProps.length === 1) {
474
541
  return (_jsx(Text, { variant: isPortalAgent && !pagePanel?.visible ? 'h1' : 'h2', children: selectedCoach }));
475
542
  }
476
543
  return (_jsx(MenuButton, { text: selectedCoach, "aria-label": t('agent_switcher', [selectedCoach]), variant: 'text', as: StyledGenAIOptionsMenu, menu: {
477
544
  mode: 'single-select',
478
- items: coachOptions,
545
+ items: coachOptionsProps,
479
546
  onItemClick: onCoachChange
480
547
  } }));
481
- }, [coachOptions, selectedCoach, isPortalAgent, pagePanel?.visible]);
548
+ }, [coachOptionsProps, selectedCoach, isPortalAgent, pagePanel?.visible]);
482
549
  const headerContent = useMemo(() => {
550
+ if (simplifiedAgent && showInitialScreen)
551
+ return null;
483
552
  return isInUtilities(variant) && variant.state === 'minimized' ? (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'h2', children: selectedCoach }), _jsx(Flex, { container: { alignItems: 'center' }, children: _jsx(Button, { icon: true, label: t('maximize'), "aria-label": t('agent_noun', [t('maximize')]), variant: 'simple', onClick: () => {
484
553
  variant.onStateChange('maximized');
485
554
  isUserTriggered.current = true;
486
- }, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: { gap: 0.5 }, as: StyledActionsContainer, children: [activeCases && _jsx(ActiveCases, { activeCases: activeCases }), onNewChat && (_jsx(Button, { icon: true, variant: 'simple', label: t('new_chat'), "aria-label": t('new_chat'), onClick: onNewChat, children: _jsx(Icon, { name: 'plus' }) })), _jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions }), variant.placement === 'dialog' && !fullScreen && (_jsx(Button, { icon: true, label: t('close'), "aria-label": t('close_chat_with_ai'), variant: 'simple', onClick: variant.onClose, children: _jsx(Icon, { name: 'times' }) }))] })] }));
487
- }, [variant, coachOptions, activeCases, actions, allowFullScreen, onNewChat]);
555
+ }, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: { gap: 0.5 }, as: StyledActionsContainer, children: [activeCases && _jsx(ActiveCases, { activeCases: activeCases }), simplifiedAgent && (_jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions, simplifiedAgent: true })), onNewChat && (_jsx(Button, { icon: true, variant: 'simple', label: simplifiedAgent ? t('close') : t('new_chat'), "aria-label": simplifiedAgent ? t('close_chat_with_ai') : t('new_chat'), onClick: () => {
556
+ if (agentInBanner && genAICoachRef.current) {
557
+ prevHeightRef.current = genAICoachRef.current.getBoundingClientRect().height;
558
+ }
559
+ if (simplifiedAgent && conversationHistory) {
560
+ conversationHistory.onDismiss();
561
+ }
562
+ onNewChat?.();
563
+ }, children: _jsx(Icon, { name: simplifiedAgent ? 'times' : 'plus' }) })), !simplifiedAgent && (_jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions })), variant.placement === 'dialog' && !fullScreen && (_jsx(Button, { icon: true, label: t('close'), "aria-label": t('close_chat_with_ai'), variant: 'simple', onClick: variant.onClose, children: _jsx(Icon, { name: 'times' }) }))] })] }));
564
+ }, [
565
+ variant,
566
+ coachOptionsProps,
567
+ activeCases,
568
+ actions,
569
+ allowFullScreen,
570
+ onNewChat,
571
+ simplifiedAgent,
572
+ showInitialScreen,
573
+ messages.length
574
+ ]);
488
575
  const getMessageContainingElement = (element) => {
489
576
  if (element)
490
577
  return Array.from(messageEls.values()).find(el => el && el.contains(element));
@@ -529,6 +616,63 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
529
616
  textAreaRef.current?.focus();
530
617
  }
531
618
  }, [draftMessage, suggestionCardsView]);
619
+ useEffect(() => {
620
+ if (conversationId)
621
+ setMessage('');
622
+ }, [conversationId]);
623
+ const animateHeightFrom = useCallback((fromHeight) => {
624
+ const el = genAICoachRef.current;
625
+ if (!el)
626
+ return;
627
+ const toHeight = el.getBoundingClientRect().height;
628
+ if (Math.abs(fromHeight - toHeight) <= scrollTolerancePx)
629
+ return;
630
+ el.style.transition = 'none';
631
+ el.style.height = `${fromHeight}px`;
632
+ const removeListener = onHeightTransitionEnd(el, () => el.style.removeProperty('height'));
633
+ const rafId = requestAnimationFrame(() => {
634
+ el.getBoundingClientRect();
635
+ el.style.removeProperty('transition');
636
+ el.style.height = `${toHeight}px`;
637
+ });
638
+ return () => {
639
+ cancelAnimationFrame(rafId);
640
+ removeListener();
641
+ el.style.removeProperty('height');
642
+ el.style.removeProperty('transition');
643
+ };
644
+ }, []);
645
+ useLayoutEffect(() => {
646
+ const fromHeight = prevHeightRef.current;
647
+ if (!agentInBanner || !fromHeight || historyOpen)
648
+ return;
649
+ if (messages.length === 0 && !showInitialScreen)
650
+ return;
651
+ prevHeightRef.current = 0;
652
+ return animateHeightFrom(fromHeight);
653
+ }, [messages.length, agentInBanner, showInitialScreen, historyOpen, animateHeightFrom]);
654
+ useEffect(() => {
655
+ if (!agentInBanner)
656
+ return;
657
+ if (messages.length === 0) {
658
+ if (!(loading && conversationHistory)) {
659
+ setShowInitialScreen(true);
660
+ }
661
+ userInitiatedSendRef.current = false;
662
+ return;
663
+ }
664
+ if (!showInitialScreen)
665
+ return;
666
+ if (!userInitiatedSendRef.current) {
667
+ setShowInitialScreen(false);
668
+ return;
669
+ }
670
+ const timer = setTimeout(() => {
671
+ setShowInitialScreen(false);
672
+ userInitiatedSendRef.current = false;
673
+ }, bannerTransitionMs);
674
+ return () => clearTimeout(timer);
675
+ }, [messages.length, agentInBanner, showInitialScreen]);
532
676
  useEffect(() => {
533
677
  if (isUserTriggered.current) {
534
678
  if (isInUtilities(variant) &&
@@ -707,26 +851,51 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
707
851
  const getGridColumns = () => {
708
852
  const multiCol = 'repeat(auto-fit, minmax(calc(100% / 4 - 1rem), 1fr))';
709
853
  const singleCol = '1fr';
710
- return !isSmallOrAbove ? singleCol : multiCol;
854
+ return simplifiedAgent || !isSmallOrAbove ? singleCol : multiCol;
711
855
  };
712
856
  useEffect(() => {
713
857
  if (voiceToTextError) {
714
858
  push({ content: voiceToTextError });
715
859
  }
716
860
  }, [voiceToTextError]);
717
- const genAIFooter = (_jsxs(Flex, { container: { direction: 'column' }, as: StyledGenAIFooter, children: [_jsxs(StyledComposerWrapper, { focused: focused, hasQuestionnaire: !!questionnaireData && !questionnaireDismissed, onFocus: () => setFocused(true), onBlur: e => {
861
+ const showStaticSuggestions = !loading &&
862
+ !error &&
863
+ (agentInBanner ? showInitialScreen : messages.length === 0) &&
864
+ initialSuggestedMessages &&
865
+ initialSuggestedMessages.length > 0;
866
+ const suggestionItems = showStaticSuggestions
867
+ ? initialSuggestedMessages.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
868
+ if (guidedMode) {
869
+ onSend({
870
+ id: initialMessage.id,
871
+ message: initialMessage.message
872
+ });
873
+ }
874
+ else {
875
+ setMessage(initialMessage.message ?? '');
876
+ }
877
+ isUserTriggered.current = true;
878
+ textAreaRef.current?.focus();
879
+ }, testId: initialSuggestedMessage.id })))
880
+ : null;
881
+ const staticSuggestions = showStaticSuggestions &&
882
+ (agentInBanner ? (_jsx(Flex, { container: { wrap: 'wrap', gap: 0.75 }, as: StyledSimplifiedInitialMessageGrid, children: suggestionItems })) : (_jsx(Grid, { as: StyledInitialMessageGrid, container: {
883
+ cols: getGridColumns(),
884
+ gap: simplifiedAgent ? 0.75 : 1.5
885
+ }, children: suggestionItems })));
886
+ const genAIFooter = (_jsxs(Flex, { container: { direction: 'column' }, as: StyledGenAIFooter, children: [_jsxs(StyledComposerWrapper, { focused: focused, hasQuestionnaire: !!questionnaireData && !questionnaireDismissed, "$agentInBanner": agentInBanner, onFocus: () => setFocused(true), onBlur: e => {
718
887
  if (!(e.relatedTarget instanceof Node) || !e.currentTarget.contains(e.relatedTarget)) {
719
888
  setFocused(false);
720
889
  }
721
- }, children: [questionnaireData && !questionnaireDismissed && !questionnaireData.inline && (_jsx(Questionnaire, { data: questionnaireData, onChange: handleFormChange, onCancel: handleFormCancel }, questionnaireKey)), _jsx(FormField, { label: t('message_pega_gen_ai_coach'), labelHidden: true, labelFor: composerId, info: conversationError || undefined, status: conversationError ? 'error' : undefined, children: _jsx(StyledGenAIFormControl, { focused: (!questionnaireData || questionnaireDismissed) && focused, status: conversationError ? 'error' : undefined, children: _jsxs(Flex, { container: { direction: 'column', gap: 0.25 }, children: [_jsx(StyledGenAITextArea, { id: composerId, ref: textAreaRef, value: interimMessage ? `${message}${interimMessage}` : message, placeholder: t('write_message'), onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: () => {
890
+ }, children: [questionnaireData && !questionnaireDismissed && !questionnaireData.inline && (_jsx(Questionnaire, { data: questionnaireData, onChange: handleFormChange, onCancel: handleFormCancel }, questionnaireKey)), _jsx(FormField, { label: t('message_pega_gen_ai_coach'), labelHidden: true, labelFor: composerId, info: conversationError || undefined, status: conversationError ? 'error' : undefined, children: _jsx(StyledGenAIFormControl, { focused: (!questionnaireData || questionnaireDismissed) && focused, status: conversationError ? 'error' : undefined, children: _jsxs(Flex, { container: { direction: 'column', gap: 0.25 }, children: [_jsx(StyledGenAITextArea, { id: composerId, ref: textAreaRef, value: interimMessage ? `${message}${interimMessage}` : message, placeholder: simplifiedAgent ? t('ask_anything', [selectedCoach ?? '']) : t('write_message'), onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: () => {
722
891
  if (active)
723
892
  stop();
724
- }, autoResize: true }), _jsxs(Flex, { container: {
893
+ }, autoResize: true, simplified: simplifiedAgent }), _jsxs(Flex, { container: {
725
894
  direction: 'row',
726
895
  justify: 'between',
727
- gap: 1,
896
+ gap: 2,
728
897
  pad: [undefined, 1, 1, 1]
729
- }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, children: [!(messages.length === 0 && suggestionCardsView) && suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'simple', icon: 'chat-typing', iconOnly: true, as: StyledMenuSuggestions, menu: {
898
+ }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, item: { grow: 1, shrink: 1, basis: '0%' }, children: [agentInBanner && onConversationHistoryOpen && (_jsx(Flex, { container: { alignItems: 'center' }, as: StyledConversationHistoryButton, children: _jsx(Button, { icon: true, variant: 'simple', label: t('your_chats'), onClick: onConversationHistoryOpen, children: _jsx(Icon, { name: 'clock-sla' }) }) })), !(messages.length === 0 && suggestionCardsView) && suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'simple', icon: 'chat-typing', iconOnly: true, as: StyledMenuSuggestions, menu: {
730
899
  items: suggestions,
731
900
  onItemClick: id => {
732
901
  const selected = menuHelpers.getItem(suggestions, id);
@@ -740,7 +909,16 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
740
909
  fileUploadInputRef.current.value = '';
741
910
  }
742
911
  fileUploadInputRef.current?.click();
743
- }, variant: 'simple', label: t('add_attachment'), children: _jsx(Icon, { name: 'paper-clip' }) }), _jsx(StyledInput, { type: 'file', ref: fileUploadInputRef, onChange: onFileChange, multiple: false, "data-testid": testIds.attachments })] }))] }), (() => {
912
+ }, variant: 'simple', label: t('add_attachment'), children: _jsx(Icon, { name: 'paper-clip' }) }), _jsx(StyledInput, { type: 'file', ref: fileUploadInputRef, onChange: onFileChange, multiple: showMultipleAttachments, "data-testid": testIds.attachments })] })), agentModeProps && agentModeProps.modes.length > 0 && (_jsxs(_Fragment, { children: [_jsx(StyledComposerSelector, { ref: setAgentModeButtonEl, text: selectedAgentModeLabel, "aria-label": t('agent_mode_selector', [selectedAgentModeLabel]), variant: 'simple', "data-testid": testIds.agentMode, menu: {
913
+ mode: 'single-select',
914
+ items: agentModeProps.modes,
915
+ onItemClick: agentModeProps.onAgentModeChange
916
+ }, showArrow: true }), agentModeButtonEl && selectedAgentModeLabel && (_jsx(Tooltip, { target: agentModeButtonEl, smart: true, showDelay: 'none', hideDelay: 'none', children: selectedAgentModeLabel }))] })), modelSelectorProps && modelSelectorProps.options.length > 0 && (_jsxs(_Fragment, { children: [_jsx(StyledComposerSelector, { ref: setModelSelectorButtonEl, text: selectedModelLabel, "aria-label": t('model_selector_button', [selectedModelLabel]), variant: 'simple', "data-testid": testIds.modelSelector, menu: {
917
+ mode: 'single-select',
918
+ variant: 'flyout',
919
+ items: modelSelectorProps.options,
920
+ onItemClick: modelSelectorProps.onModelChange
921
+ }, showArrow: true }), modelSelectorButtonEl && selectedModelLabel && (_jsx(Tooltip, { target: modelSelectorButtonEl, smart: true, showDelay: 'none', hideDelay: 'none', children: selectedModelLabel }))] }))] }), (() => {
744
922
  if (active && pendingResult.current) {
745
923
  return (_jsxs(Flex, { container: {
746
924
  gap: 1,
@@ -763,13 +941,13 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
763
941
  return (_jsx(StyledStopGeneratingButton, { variant: 'primary', icon: true, label: t('stop'), "aria-label": t('stop'), onClick: () => {
764
942
  textAreaRef.current?.focus();
765
943
  onStopFn?.();
766
- }, children: _jsx(Icon, { name: 'square-solid' }) }));
944
+ }, simplified: simplifiedAgent, children: _jsx(Icon, { name: 'square-solid' }) }));
767
945
  }
768
946
  const isLoading = latestMessage &&
769
947
  isCoachMessage(latestMessage) &&
770
948
  latestMessage.loading &&
771
949
  !latestMessage.error;
772
- const sendButton = (_jsx(StyledSendButton, { variant: 'primary', onClick: isCreatingConversation ? undefined : handleSendMessage, icon: true, label: t('send'), "aria-label": t('send_message'), children: _jsx(Icon, { name: 'send-solid' }) }));
950
+ const sendButton = (_jsx(StyledSendButton, { variant: 'primary', onClick: isCreatingConversation ? undefined : handleSendMessage, loading: isCreatingConversation, icon: true, label: t('send'), "aria-label": t('send_message'), simplified: simplifiedAgent, children: _jsx(Icon, { name: 'send-solid' }) }));
773
951
  if (isLoading) {
774
952
  if (isCreatingConversation) {
775
953
  return sendButton;
@@ -782,44 +960,43 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
782
960
  }, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] }));
783
961
  }
784
962
  return sendButton;
785
- })()] })] }) }) })] }), attachments && attachments.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: FileList, type: 'item', "aria-label": `${t('attachments')}`, items: attachments, container: { pad: [1, 0] } }), attachmentsError && (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, as: StyledErrorContainer, children: [_jsx(Icon, { name: 'warn-solid' }), _jsx(VisuallyHiddenText, { children: `${t('error')} ` }), attachmentsError] }))] })), _jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) })] }));
963
+ })()] })] }) }) }), agentInBanner && !guidedMode && staticSuggestions] }), attachments && attachments.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: FileList, type: 'item', "aria-label": `${t('attachments')}`, items: attachments, container: { pad: [1, 0] } }), attachmentsError && (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, as: StyledErrorContainer, children: [_jsx(Icon, { name: 'warn-solid' }), _jsx(VisuallyHiddenText, { children: `${t('error')} ` }), attachmentsError] }))] })), hasAgentResponse && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) }))] }));
786
964
  const isCompact = variant.placement === 'fullpage' &&
787
965
  !fullScreen &&
788
966
  !isInLandingPageUtilities &&
789
- messages.length === 0;
967
+ messages.length === 0 &&
968
+ !(agentInBanner && historyOpen);
790
969
  const fullPageAndInitialScreen = (fullScreen || (variant.placement === 'fullpage' && !isInLandingPageUtilities)) &&
791
970
  messages.length === 0;
792
- const renderTextArea = fullPageAndInitialScreen ? null : genAIFooter;
793
- const GenAICoachElement = (_jsx(_Fragment, { children: ((isInUtilities(variant) && variant.state !== 'minimized') || !isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column' }, as: StyledFlexWrapper, children: [caseWorkflow && _jsx(CaseWorkflow, { ...caseWorkflow }), _jsx(Flex, { as: StyledMessagesContainer, ref: setMessageContainerRef, withSuggestionCards: !loading && !error && messages.length === 0 && !!suggestionCardsView, container: loading || error
971
+ const renderTextArea = agentInBanner || !fullPageAndInitialScreen ? genAIFooter : null;
972
+ const GenAICoachElement = (_jsx(_Fragment, { children: ((isInUtilities(variant) && variant.state !== 'minimized') || !isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column' }, as: StyledFlexWrapper, isExpanded: agentInBanner && agentExpanded, children: [caseWorkflow && _jsx(CaseWorkflow, { ...caseWorkflow }), _jsx(Flex, { as: StyledMessagesContainer, ref: setMessageContainerRef, withSuggestionCards: !loading && !error && messages.length === 0 && !!suggestionCardsView, container: loading || error
794
973
  ? { direction: 'column', pad: [0, 2], justify: 'center' }
795
974
  : { direction: 'column', pad: [0, 2] }, ...(!loading && !error && messages.length === 0 && suggestionCardsView
796
975
  ? {}
797
- : { item: { grow: 1 } }), onScroll: updateScrollStateOnScrollEvent, children: loading || error ? (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, children: loading ? (_jsx(Progress, { variant: 'ring', placement: 'block', message: typeof loading === 'string' ? loading : t('loading') })) : (_jsx(ErrorState, { message: error })) })) : (_jsx(_Fragment, { children: messages.length === 0 ? (_jsxs(Flex, { as: StyledInitialMessageContainer, container: {
976
+ : { item: { grow: 1 } }), onScroll: updateScrollStateOnScrollEvent, children: loading || error ? (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, children: loading ? (_jsx(ThemeOverride, { theme: {
977
+ base: {
978
+ palette: {
979
+ 'primary-background': theme.components.agent.background
980
+ }
981
+ }
982
+ }, children: _jsx(Progress, { variant: 'ring', placement: 'block', message: typeof loading === 'string' ? loading : t('loading') }) })) : (_jsx(ErrorState, { message: error })) })) : (_jsx(_Fragment, { children: (agentInBanner ? showInitialScreen : messages.length === 0) ? (_jsxs(Flex, { as: StyledInitialMessageContainer, container: {
798
983
  justify: suggestionCardsView ? undefined : 'center',
799
984
  direction: 'column',
800
985
  alignItems: 'center',
801
- gap: 4,
802
- pad: [6, 0, 2, 0]
986
+ gap: simplifiedAgent ? 2 : 4,
987
+ pad: simplifiedAgent ? [0, 0, 2, 0] : [6, 0, 2, 0]
803
988
  }, ...(suggestionCardsView ? {} : { item: { grow: 1 } }), children: [((isInUtilities(variant) && variant.state === 'maximized') ||
804
989
  !isInUtilities(variant)) &&
805
990
  showSalutation && (_jsxs(Flex, { container: {
806
991
  direction: 'column',
807
992
  alignItems: 'center',
808
- gap: 2,
809
- pad: [0, 2]
810
- }, children: [_jsx(AgentIcon, {}), _jsx(Text, { variant: 'h3', as: StyledSalutation, children: salutation ?? t('welcome_text') })] })), initialSuggestedMessages && initialSuggestedMessages.length > 0 && (_jsx(Grid, { as: StyledInitialMessageGrid, container: { cols: getGridColumns(), gap: 1.5 }, children: initialSuggestedMessages.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
811
- if (guidedMode) {
812
- onSend({
813
- id: initialMessage.id,
814
- message: initialMessage.message
815
- });
816
- }
817
- else {
818
- setMessage(initialMessage.message ?? '');
819
- }
820
- isUserTriggered.current = true;
821
- textAreaRef.current?.focus();
822
- }, testId: initialSuggestedMessage.id }))) })), fullPageAndInitialScreen && !guidedMode && !suggestionCardsView && genAIFooter] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onMouseDown: (e) => {
993
+ gap: simplifiedAgent ? 2.5 : 2,
994
+ pad: simplifiedAgent ? [0, 2, 1, 2] : [0, 2]
995
+ }, as: simplifiedAgent ? StyledBannerSalutationBlock : undefined, isExpanded: agentExpanded, children: [!simplifiedAgent && _jsx(AgentIcon, {}), _jsx(StyledSalutation, { variant: simplifiedAgent ? 'h2' : 'h3', simplified: simplifiedAgent, children: salutation ?? t('welcome_text') }), simplifiedAgent && (_jsx(StyledSubHeading, { variant: 'primary', as: 'p', children: subHeading ?? t('what_can_i_help_you_with') }))] })), (!agentInBanner || guidedMode) && staticSuggestions, fullPageAndInitialScreen &&
996
+ !guidedMode &&
997
+ !suggestionCardsView &&
998
+ !agentInBanner &&
999
+ genAIFooter] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, simplified: simplifiedAgent, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onMouseDown: (e) => {
823
1000
  mouseTriggeredFocusRef.current = true;
824
1001
  const target = e.target instanceof Element ? e.target : null;
825
1002
  const clickedMessage = getMessageContainingElement(target);
@@ -911,11 +1088,13 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
911
1088
  }
912
1089
  }
913
1090
  }, children: messages.map(item => {
914
- const messageProps = isCoachMessage(item)
915
- ? {
1091
+ let messageProps;
1092
+ if (isCoachMessage(item)) {
1093
+ messageProps = {
916
1094
  ...item,
917
1095
  suggestions: latestMessage?.id === item.id ? item.suggestions : undefined,
918
1096
  onSend,
1097
+ showSenderInfo: simplifiedAgent ? showNextCoachSender.current : undefined,
919
1098
  onSubmit: item.isToolConfirmation
920
1099
  ? (tools) => {
921
1100
  onSend({
@@ -925,13 +1104,21 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
925
1104
  });
926
1105
  }
927
1106
  : undefined
928
- }
929
- : item;
1107
+ };
1108
+ showNextCoachSender.current = false;
1109
+ }
1110
+ else if (isUserMessage(item) && simplifiedAgent) {
1111
+ showNextCoachSender.current = true;
1112
+ messageProps = { ...item, userName: operatorName };
1113
+ }
1114
+ else {
1115
+ messageProps = item;
1116
+ }
930
1117
  return (_jsx(GenAIMessage, { ...messageProps, ref: getMessageCbRef(item.id), testId: item.id, announceInteraction: !focusInMessageListRef.current, onAnimationCursorUpdate: animatedTillCursor => {
931
1118
  if (isCoachMessage(item)) {
932
1119
  setAnimationInitialCursorPos(animatedTillCursor);
933
1120
  }
934
- }, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
1121
+ }, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
935
1122
  }) })) })) }), showScrollToBottom && (_jsx(StyledScrollButton, { ref: scrollButtonRef, icon: true, onClick: handleScrollToBottomClick, ariaLabel: t('scroll_to_latest_message'), onKeyDown: focusLastMessageLi, children: _jsx(Icon, { name: 'caret-down' }) })), !loading && messages.length === 0 && suggestionCardsView ? (_jsxs(_Fragment, { children: [((isInUtilities(variant) && variant.state !== 'minimized') ||
936
1123
  !isInUtilities(variant)) &&
937
1124
  !guidedMode && (_jsx(StyledStickyComposer, { children: _jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, ref: setInputContainerRef, children: _jsx(StyledComposerSection, { children: genAIFooter }) }) })), _jsx(Flex, { container: { direction: 'column' }, as: StyledSuggestionCardsBottomHalf, children: _jsx(StyledSuggestionCardsView, { ref: setSuggestionCardsViewRef, children: suggestionCardsView }) })] })) : (((isInUtilities(variant) && variant.state !== 'minimized') ||
@@ -965,7 +1152,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
965
1152
  });
966
1153
  }
967
1154
  }
968
- } }) })), _jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) })] })) })) : (renderTextArea)] }) })))] })) }));
1155
+ } }) })), hasAgentResponse && (_jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) }))] })) })) : (renderTextArea)] }) })))] })) }));
969
1156
  useEffect(() => {
970
1157
  if (focusTextArea.current && !conversationHistory && textAreaRef.current) {
971
1158
  textAreaRef.current.focus();
@@ -989,19 +1176,26 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
989
1176
  attachmentsAdded.current = false;
990
1177
  }
991
1178
  }, [attachments, attachmentsError]);
992
- const historyView = conversationHistory && (_jsx(ConversationHistory, { testId: testIds.root, ...conversationHistory, onItemClick: conversationId => {
1179
+ const historyView = conversationHistory && (_jsx(ConversationHistory, { testId: testIds.root, ...conversationHistory, onItemClick: selectedConversationId => {
993
1180
  if (condition) {
994
1181
  focusTextArea.current = true;
995
1182
  }
996
1183
  else {
997
1184
  textAreaRef.current?.focus();
998
1185
  }
999
- conversationHistory.onItemClick?.(conversationId);
1186
+ conversationHistory.onItemClick?.(selectedConversationId);
1000
1187
  }, onDismiss: () => {
1001
1188
  focusTextArea.current = true;
1189
+ if (agentInBanner && messages.length === 0 && genAICoachRef.current) {
1190
+ prevHeightRef.current = genAICoachRef.current.getBoundingClientRect().height;
1191
+ }
1002
1192
  conversationHistory.onDismiss();
1003
1193
  }, inFullPage: !condition, ref: historyViewRef }));
1004
- return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, as: StyledGenAICoachContainer, "data-testid": testIds.root, variant: variant, fullScreen: fullScreen, isCompact: isCompact, isPortalAgent: isPortalAgent, ref: genAICoachRef, children: [_jsx(Flex, { container: { justify: 'between', alignItems: 'center', pad: [1.5, 2, 0.5] }, children: headerContent }), condition ? (_jsx(_Fragment, { children: conversationHistory ? historyView : GenAICoachElement })) : (_jsxs(Grid, { container: { gap: 0.5, cols: '2fr 3fr' }, as: StyledGridContainer, conversationHistory: !!conversationHistory, children: [historyView, GenAICoachElement] })), lightboxPreviewProps && _jsx(Lightbox, { ...lightboxPreviewProps })] }));
1194
+ return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, as: StyledGenAICoachContainer, "data-testid": testIds.root, variant: variant, fullScreen: fullScreen, isCompact: isCompact, isPortalAgent: isPortalAgent, simplifiedAgent: simplifiedAgent, ref: genAICoachRef, children: [_jsx(Flex, { as: agentExpanded ? StyledHeaderContainer : undefined, container: {
1195
+ justify: 'between',
1196
+ alignItems: 'center',
1197
+ pad: simplifiedAgent ? [0, 2, 0.5] : [1.5, 2, 0.5]
1198
+ }, children: headerContent }), condition ? (_jsx(_Fragment, { children: conversationHistory ? historyView : GenAICoachElement })) : (_jsxs(Grid, { container: { gap: 0.5, cols: '2fr 3fr' }, as: StyledGridContainer, conversationHistory: !!conversationHistory, children: [historyView, GenAICoachElement] })), lightboxPreviewProps && _jsx(Lightbox, { ...lightboxPreviewProps })] }));
1005
1199
  };
1006
1200
  const GenAICoach = (props) => (_jsx(Toaster, { children: _jsx(StyledFullscreenWrapper, { children: _jsx(GenAICoachContent, { ...props }) }) }));
1007
1201
  export default withTestIds(GenAICoach, getGenAICoachTestIds);