@pega/cosmos-react-work 10.0.0-build.4.3 → 10.0.0-build.4.31

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 (94) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  2. package/lib/components/AppAnnouncement/AppAnnouncement.js +23 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  4. package/lib/components/Article/ArticleRating.d.ts.map +1 -1
  5. package/lib/components/Article/ArticleRating.js +2 -2
  6. package/lib/components/Article/ArticleRating.js.map +1 -1
  7. package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
  8. package/lib/components/ArticleList/ArticleFeedback.js +2 -2
  9. package/lib/components/ArticleList/ArticleFeedback.js.map +1 -1
  10. package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
  11. package/lib/components/CaseView/CaseHeader/CaseHeader.js +1 -1
  12. package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
  13. package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
  14. package/lib/components/CaseView/CaseView.styles.js +4 -2
  15. package/lib/components/CaseView/CaseView.styles.js.map +1 -1
  16. package/lib/components/CaseView/CaseView.types.d.ts +1 -0
  17. package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
  18. package/lib/components/CaseView/CaseView.types.js.map +1 -1
  19. package/lib/components/Details/DetailsList.d.ts.map +1 -1
  20. package/lib/components/Details/DetailsList.js +2 -2
  21. package/lib/components/Details/DetailsList.js.map +1 -1
  22. package/lib/components/GenAICoach/ActiveCases.d.ts.map +1 -1
  23. package/lib/components/GenAICoach/ActiveCases.js +2 -1
  24. package/lib/components/GenAICoach/ActiveCases.js.map +1 -1
  25. package/lib/components/GenAICoach/GenAICoach.d.ts +1 -1
  26. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  27. package/lib/components/GenAICoach/GenAICoach.js +39 -6
  28. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  29. package/lib/components/GenAICoach/GenAICoach.styles.d.ts +11 -0
  30. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  31. package/lib/components/GenAICoach/GenAICoach.styles.js +24 -9
  32. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  33. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +1 -1
  34. package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
  35. package/lib/components/GenAICoach/GenAICoach.test-ids.js +3 -1
  36. package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
  37. package/lib/components/GenAICoach/GenAICoach.types.d.ts +13 -1
  38. package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
  39. package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
  40. package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -1
  41. package/lib/components/GenAICoach/GenAIMessageFeedback.js +2 -2
  42. package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -1
  43. package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -1
  44. package/lib/components/GenAICoach/Questionnaire.js +10 -3
  45. package/lib/components/GenAICoach/Questionnaire.js.map +1 -1
  46. package/lib/components/GenAICoach/index.d.ts +1 -1
  47. package/lib/components/GenAICoach/index.d.ts.map +1 -1
  48. package/lib/components/GenAICoach/index.js.map +1 -1
  49. package/lib/components/InteractionNotification/InteractionNotification.d.ts +1 -1
  50. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
  51. package/lib/components/InteractionNotification/InteractionNotification.js +2 -2
  52. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
  53. package/lib/components/Shortcuts/Shortcuts.d.ts +1 -1
  54. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -1
  55. package/lib/components/Shortcuts/Shortcuts.js +25 -11
  56. package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
  57. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +16 -3
  58. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
  59. package/lib/components/Shortcuts/Shortcuts.styles.js +91 -47
  60. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
  61. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts +1 -1
  62. package/lib/components/Shortcuts/Shortcuts.test-ids.d.ts.map +1 -1
  63. package/lib/components/Shortcuts/Shortcuts.test-ids.js +4 -3
  64. package/lib/components/Shortcuts/Shortcuts.test-ids.js.map +1 -1
  65. package/lib/components/Shortcuts/Shortcuts.types.d.ts +18 -2
  66. package/lib/components/Shortcuts/Shortcuts.types.d.ts.map +1 -1
  67. package/lib/components/Shortcuts/Shortcuts.types.js.map +1 -1
  68. package/lib/components/Stages/Stages.d.ts.map +1 -1
  69. package/lib/components/Stages/Stages.js +60 -39
  70. package/lib/components/Stages/Stages.js.map +1 -1
  71. package/lib/components/Stages/Stages.styles.d.ts +27 -5
  72. package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
  73. package/lib/components/Stages/Stages.styles.js +692 -163
  74. package/lib/components/Stages/Stages.styles.js.map +1 -1
  75. package/lib/components/Stages/Stages.types.d.ts +6 -0
  76. package/lib/components/Stages/Stages.types.d.ts.map +1 -1
  77. package/lib/components/Stages/Stages.types.js.map +1 -1
  78. package/lib/components/Stages/index.d.ts +1 -1
  79. package/lib/components/Stages/index.d.ts.map +1 -1
  80. package/lib/components/Stages/index.js.map +1 -1
  81. package/lib/components/Tags/Tags.d.ts.map +1 -1
  82. package/lib/components/Tags/Tags.js +1 -12
  83. package/lib/components/Tags/Tags.js.map +1 -1
  84. package/lib/components/Tasks/TaskCard.d.ts.map +1 -1
  85. package/lib/components/Tasks/TaskCard.js +5 -2
  86. package/lib/components/Tasks/TaskCard.js.map +1 -1
  87. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  88. package/lib/components/Tasks/TaskList.js +24 -16
  89. package/lib/components/Tasks/TaskList.js.map +1 -1
  90. package/lib/components/Tasks/Tasks.d.ts +7 -2
  91. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  92. package/lib/components/Tasks/Tasks.js +7 -5
  93. package/lib/components/Tasks/Tasks.js.map +1 -1
  94. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
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';
@@ -19,7 +19,7 @@ import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icon
19
19
  import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
20
20
  import { getGenAICoachTestIds } from './GenAICoach.test-ids';
21
21
  import { getSelectedKeys, isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
22
- 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 } from './GenAICoach.styles';
22
+ 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 } from './GenAICoach.styles';
23
23
  import ActiveCases from './ActiveCases';
24
24
  import CaseWorkflow from './CaseWorkflow';
25
25
  import ConversationHistory from './ConversationHistory';
@@ -98,7 +98,7 @@ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef,
98
98
  }
99
99
  return (_jsx(Actions, { ...(actions ?? {}), menuAt: 1, "data-testid": actionsTestId, contextualLabel: selectedCoach, items: mergedItems }));
100
100
  };
101
- 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, simplifiedAgent = false, subHeading, operatorName, ...restProps }) => {
101
+ 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, simplifiedAgent = false, subHeading, operatorName, agentModeProps, modelSelectorProps, ...restProps }) => {
102
102
  const scrollTolerancePx = 2;
103
103
  const scrollThresholdPx = 50;
104
104
  const streamBufferLh = simplifiedAgent ? 15 : 5;
@@ -131,6 +131,8 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
131
131
  const messageContainerRef = useRef(null);
132
132
  const textAreaRef = useRef(null);
133
133
  const [suggestionMenuButton, setSuggestionMenuButton] = useElement(null);
134
+ const [agentModeButtonEl, setAgentModeButtonEl] = useElement(null);
135
+ const [modelSelectorButtonEl, setModelSelectorButtonEl] = useElement(null);
134
136
  const isGeneratingResponse = useRef(false);
135
137
  const focusTextArea = useRef(false);
136
138
  const historyViewRef = useRef(null);
@@ -440,6 +442,28 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
440
442
  return coachOptions[0].primary;
441
443
  }
442
444
  }, [coachOptions]);
445
+ const selectedAgentModeLabel = useMemo(() => {
446
+ if (!agentModeProps)
447
+ return '';
448
+ const selected = menuHelpers.getSelected(agentModeProps.modes)[0];
449
+ if (selected)
450
+ return selected.primary;
451
+ if (agentModeProps.modes[0]) {
452
+ if (isMenuGroupProps(agentModeProps.modes[0])) {
453
+ return agentModeProps.modes[0].items[0].primary;
454
+ }
455
+ return agentModeProps.modes[0].primary;
456
+ }
457
+ return '';
458
+ }, [agentModeProps]);
459
+ const selectedModelLabel = useMemo(() => {
460
+ if (!modelSelectorProps)
461
+ return '';
462
+ return menuHelpers
463
+ .getSelected(modelSelectorProps.options)
464
+ .map(s => s.primary)
465
+ .join(' · ');
466
+ }, [modelSelectorProps]);
443
467
  const onResult = useCallback(value => {
444
468
  pendingResult.current = false;
445
469
  setMessage(prevMessage => {
@@ -842,9 +866,9 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
842
866
  }, autoResize: true, simplified: simplifiedAgent }), _jsxs(Flex, { container: {
843
867
  direction: 'row',
844
868
  justify: 'between',
845
- gap: 1,
869
+ gap: 2,
846
870
  pad: [undefined, 1, 1, 1]
847
- }, 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: {
871
+ }, children: [_jsxs(Flex, { container: { alignItems: 'center' }, item: { grow: 1, shrink: 1, basis: '0%' }, children: [!(messages.length === 0 && suggestionCardsView) && suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'simple', icon: 'chat-typing', iconOnly: true, as: StyledMenuSuggestions, menu: {
848
872
  items: suggestions,
849
873
  onItemClick: id => {
850
874
  const selected = menuHelpers.getItem(suggestions, id);
@@ -858,7 +882,16 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
858
882
  fileUploadInputRef.current.value = '';
859
883
  }
860
884
  fileUploadInputRef.current?.click();
861
- }, 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 })] }))] }), (() => {
885
+ }, 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 })] })), 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: {
886
+ mode: 'single-select',
887
+ items: agentModeProps.modes,
888
+ onItemClick: agentModeProps.onAgentModeChange
889
+ }, 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: {
890
+ mode: 'single-select',
891
+ variant: 'flyout',
892
+ items: modelSelectorProps.options,
893
+ onItemClick: modelSelectorProps.onModelChange
894
+ }, showArrow: true }), modelSelectorButtonEl && selectedModelLabel && (_jsx(Tooltip, { target: modelSelectorButtonEl, smart: true, showDelay: 'none', hideDelay: 'none', children: selectedModelLabel }))] }))] }), (() => {
862
895
  if (active && pendingResult.current) {
863
896
  return (_jsxs(Flex, { container: {
864
897
  gap: 1,