@pega/cosmos-react-work 10.0.0-build.10.2 → 10.0.0-build.10.3
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.
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +38 -38
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +5 -0
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +16 -0
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +2 -0
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
- package/lib/components/Tasks/TaskCards.d.ts.map +1 -1
- package/lib/components/Tasks/TaskCards.js +19 -12
- package/lib/components/Tasks/TaskCards.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAkHA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAiDhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCAg/DyB,eAAe;;;AAQ1C,wBAA6D"}
|
|
@@ -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, Tooltip } 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, HTML } 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';
|
|
@@ -20,7 +20,7 @@ import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/ico
|
|
|
20
20
|
import * as clockSlaIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/clock-sla.icon';
|
|
21
21
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
22
22
|
import { getSelectedKeys, isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
|
|
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';
|
|
23
|
+
import { StyledMessagesContainer, StyledDisclaimerText, StyledDisclaimerMessage, 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';
|
|
24
24
|
import ActiveCases from './ActiveCases';
|
|
25
25
|
import CaseWorkflow from './CaseWorkflow';
|
|
26
26
|
import ConversationHistory from './ConversationHistory';
|
|
@@ -104,7 +104,7 @@ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef,
|
|
|
104
104
|
}
|
|
105
105
|
return (_jsx(Actions, { ...(actions ?? {}), menuAt: 1, "data-testid": actionsTestId, contextualLabel: selectedCoach, items: mergedItems }));
|
|
106
106
|
};
|
|
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 }) => {
|
|
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, disclaimerMessage, ...restProps }) => {
|
|
108
108
|
const scrollTolerancePx = 2;
|
|
109
109
|
const scrollThresholdPx = 50;
|
|
110
110
|
const streamBufferLh = simplifiedAgent ? 15 : 5;
|
|
@@ -1005,7 +1005,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
|
|
|
1005
1005
|
!guidedMode &&
|
|
1006
1006
|
!suggestionCardsView &&
|
|
1007
1007
|
!agentInBanner &&
|
|
1008
|
-
genAIFooter] })) : (
|
|
1008
|
+
genAIFooter] })) : (_jsxs(Flex, { as: StyledMessagesList, ref: conversationRef, simplified: simplifiedAgent, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onMouseDown: (e) => {
|
|
1009
1009
|
mouseTriggeredFocusRef.current = true;
|
|
1010
1010
|
const target = e.target instanceof Element ? e.target : null;
|
|
1011
1011
|
const clickedMessage = getMessageContainingElement(target);
|
|
@@ -1096,41 +1096,41 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
|
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
}, children: messages.map((item, index) => {
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1099
|
+
}, children: [disclaimerMessage && (_jsx(StyledDisclaimerMessage, { children: _jsx(HTML, { content: disclaimerMessage }) })), messages.map((item, index) => {
|
|
1100
|
+
let messageProps;
|
|
1101
|
+
if (isCoachMessage(item)) {
|
|
1102
|
+
messageProps = {
|
|
1103
|
+
...item,
|
|
1104
|
+
suggestions: latestMessage?.id === item.id ? item.suggestions : undefined,
|
|
1105
|
+
onSend,
|
|
1106
|
+
showSenderInfo: simplifiedAgent ? showNextCoachSender.current : undefined,
|
|
1107
|
+
onSubmit: item.isToolConfirmation
|
|
1108
|
+
? (tools) => {
|
|
1109
|
+
onSend({
|
|
1110
|
+
...item,
|
|
1111
|
+
message: typeof item.message === 'string' ? item.message : '',
|
|
1112
|
+
tools
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
: undefined
|
|
1116
|
+
};
|
|
1117
|
+
showNextCoachSender.current = false;
|
|
1118
|
+
}
|
|
1119
|
+
else if (isUserMessage(item) && simplifiedAgent) {
|
|
1120
|
+
showNextCoachSender.current = true;
|
|
1121
|
+
messageProps = { ...item, userName: operatorName };
|
|
1122
|
+
}
|
|
1123
|
+
else {
|
|
1124
|
+
messageProps = item;
|
|
1125
|
+
}
|
|
1126
|
+
return (_jsx(GenAIMessage, { ...messageProps, ref: getMessageCbRef(item.id), testId: item.id, announceInteraction: !focusInMessageListRef.current, onAnimationCursorUpdate: animatedTillCursor => {
|
|
1127
|
+
if (isCoachMessage(item)) {
|
|
1128
|
+
setAnimationInitialCursorPos(animatedTillCursor);
|
|
1114
1129
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1119
|
-
else if (isUserMessage(item) && simplifiedAgent) {
|
|
1120
|
-
showNextCoachSender.current = true;
|
|
1121
|
-
messageProps = { ...item, userName: operatorName };
|
|
1122
|
-
}
|
|
1123
|
-
else {
|
|
1124
|
-
messageProps = item;
|
|
1125
|
-
}
|
|
1126
|
-
return (_jsx(GenAIMessage, { ...messageProps, ref: getMessageCbRef(item.id), testId: item.id, announceInteraction: !focusInMessageListRef.current, onAnimationCursorUpdate: animatedTillCursor => {
|
|
1127
|
-
if (isCoachMessage(item)) {
|
|
1128
|
-
setAnimationInitialCursorPos(animatedTillCursor);
|
|
1129
|
-
}
|
|
1130
|
-
}, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== undefined && prevFullScreen !== fullScreen
|
|
1131
|
-
? { animationInitialCursorPos }
|
|
1132
|
-
: {}) }, conversationId ? `${conversationId}:${index}` : index));
|
|
1133
|
-
}) })) })) }), 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') ||
|
|
1130
|
+
}, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== undefined && prevFullScreen !== fullScreen
|
|
1131
|
+
? { animationInitialCursorPos }
|
|
1132
|
+
: {}) }, conversationId ? `${conversationId}:${index}` : index));
|
|
1133
|
+
})] })) })) }), 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') ||
|
|
1134
1134
|
!isInUtilities(variant)) &&
|
|
1135
1135
|
!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') ||
|
|
1136
1136
|
!isInUtilities(variant)) &&
|