@pega/cosmos-react-work 9.29.0 → 9.30.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.
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +30 -17
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +4 -0
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +41 -17
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts +2 -0
- package/lib/components/GenAICoach/GenAICoach.utils.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.utils.js +31 -0
- package/lib/components/GenAICoach/GenAICoach.utils.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":"AA4GA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAyChF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCAi4DyB,eAAe;;;AAQ1C,wBAA6D"}
|
|
@@ -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, StyledSimplifiedInitialMessageGrid } from './GenAICoach.styles';
|
|
23
23
|
import ActiveCases from './ActiveCases';
|
|
24
24
|
import CaseWorkflow from './CaseWorkflow';
|
|
25
25
|
import ConversationHistory from './ConversationHistory';
|
|
@@ -825,14 +825,39 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
|
|
|
825
825
|
const getGridColumns = () => {
|
|
826
826
|
const multiCol = 'repeat(auto-fit, minmax(calc(100% / 4 - 1rem), 1fr))';
|
|
827
827
|
const singleCol = '1fr';
|
|
828
|
-
return !isSmallOrAbove ? singleCol : multiCol;
|
|
828
|
+
return simplifiedAgent || !isSmallOrAbove ? singleCol : multiCol;
|
|
829
829
|
};
|
|
830
830
|
useEffect(() => {
|
|
831
831
|
if (voiceToTextError) {
|
|
832
832
|
push({ content: voiceToTextError });
|
|
833
833
|
}
|
|
834
834
|
}, [voiceToTextError]);
|
|
835
|
-
const
|
|
835
|
+
const showStaticSuggestions = !loading &&
|
|
836
|
+
!error &&
|
|
837
|
+
(agentInBanner ? showInitialScreen : messages.length === 0) &&
|
|
838
|
+
initialSuggestedMessages &&
|
|
839
|
+
initialSuggestedMessages.length > 0;
|
|
840
|
+
const suggestionItems = showStaticSuggestions
|
|
841
|
+
? initialSuggestedMessages.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
|
|
842
|
+
if (guidedMode) {
|
|
843
|
+
onSend({
|
|
844
|
+
id: initialMessage.id,
|
|
845
|
+
message: initialMessage.message
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
setMessage(initialMessage.message ?? '');
|
|
850
|
+
}
|
|
851
|
+
isUserTriggered.current = true;
|
|
852
|
+
textAreaRef.current?.focus();
|
|
853
|
+
}, testId: initialSuggestedMessage.id })))
|
|
854
|
+
: null;
|
|
855
|
+
const staticSuggestions = showStaticSuggestions &&
|
|
856
|
+
(agentInBanner ? (_jsx(Flex, { container: { wrap: 'wrap', gap: 0.75 }, as: StyledSimplifiedInitialMessageGrid, children: suggestionItems })) : (_jsx(Grid, { as: StyledInitialMessageGrid, container: {
|
|
857
|
+
cols: getGridColumns(),
|
|
858
|
+
gap: simplifiedAgent ? 0.75 : 1.5
|
|
859
|
+
}, children: suggestionItems })));
|
|
860
|
+
const genAIFooter = (_jsxs(Flex, { container: { direction: 'column' }, as: StyledGenAIFooter, children: [_jsxs(StyledComposerWrapper, { focused: focused, hasQuestionnaire: !!questionnaireData && !questionnaireDismissed, "$agentInBanner": agentInBanner, onFocus: () => setFocused(true), onBlur: e => {
|
|
836
861
|
if (!(e.relatedTarget instanceof Node) || !e.currentTarget.contains(e.relatedTarget)) {
|
|
837
862
|
setFocused(false);
|
|
838
863
|
}
|
|
@@ -900,7 +925,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
|
|
|
900
925
|
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] }));
|
|
901
926
|
}
|
|
902
927
|
return sendButton;
|
|
903
|
-
})()] })] }) }) })] }), 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') }) }))] }));
|
|
928
|
+
})()] })] }) }) }), 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') }) }))] }));
|
|
904
929
|
const isCompact = variant.placement === 'fullpage' &&
|
|
905
930
|
!fullScreen &&
|
|
906
931
|
!isInLandingPageUtilities &&
|
|
@@ -932,19 +957,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
|
|
|
932
957
|
alignItems: 'center',
|
|
933
958
|
gap: simplifiedAgent ? 2.5 : 2,
|
|
934
959
|
pad: simplifiedAgent ? [0, 2, 1, 2] : [0, 2]
|
|
935
|
-
}, as: simplifiedAgent ? StyledBannerSalutationBlock : undefined, isExpanded: agentExpanded, children: [!simplifiedAgent && _jsx(AgentIcon, {}), _jsx(StyledSalutation, { variant: simplifiedAgent ? 'h1' : 'h3', simplified: simplifiedAgent, children: salutation ?? t('welcome_text') }), simplifiedAgent && (_jsx(StyledSubHeading, { variant: 'primary', as: 'p', children: subHeading ?? t('what_can_i_help_you_with') }))] })),
|
|
936
|
-
if (guidedMode) {
|
|
937
|
-
onSend({
|
|
938
|
-
id: initialMessage.id,
|
|
939
|
-
message: initialMessage.message
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
else {
|
|
943
|
-
setMessage(initialMessage.message ?? '');
|
|
944
|
-
}
|
|
945
|
-
isUserTriggered.current = true;
|
|
946
|
-
textAreaRef.current?.focus();
|
|
947
|
-
}, testId: initialSuggestedMessage.id }))) })), fullPageAndInitialScreen &&
|
|
960
|
+
}, as: simplifiedAgent ? StyledBannerSalutationBlock : undefined, isExpanded: agentExpanded, children: [!simplifiedAgent && _jsx(AgentIcon, {}), _jsx(StyledSalutation, { variant: simplifiedAgent ? 'h1' : '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 &&
|
|
948
961
|
!guidedMode &&
|
|
949
962
|
!suggestionCardsView &&
|
|
950
963
|
!agentInBanner &&
|