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

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.
@@ -1 +1 @@
1
- {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAgHA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAiDhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCA29DyB,eAAe;;;AAQ1C,wBAA6D"}
1
+ {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAgHA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAiDhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCAy+DyB,eAAe;;;AAQ1C,wBAA6D"}
@@ -118,6 +118,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
118
118
  const { announcePolite } = useLiveLog();
119
119
  const elementRef = useRef(null);
120
120
  const conversationRef = useRef(null);
121
+ const conversationIdRef = useRef(conversationId);
121
122
  const genAICoachRef = useRef(null);
122
123
  const [messageEls, getMessageCbRef] = useRefMap();
123
124
  const [showInitialScreen, setShowInitialScreen] = useState(true);
@@ -724,6 +725,14 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
724
725
  }, [isLatestAgentMessageStreaming]);
725
726
  useEffect(() => {
726
727
  const scrollState = scrollStateRef.current;
728
+ // Replacing the conversation leaves no stream-start transition, so the previous one's buffer would linger.
729
+ if (conversationIdRef.current !== conversationId) {
730
+ conversationIdRef.current = conversationId;
731
+ if (scrollState.isStreamingActive) {
732
+ scrollState.isStreamingActive = false;
733
+ manageBuffer('clear');
734
+ }
735
+ }
727
736
  const wasStreaming = scrollState.isStreamingActive;
728
737
  if (isLatestAgentMessageStreaming && !wasStreaming) {
729
738
  scrollStateRef.current = {
@@ -749,7 +758,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
749
758
  };
750
759
  manageBuffer('clear');
751
760
  }
752
- }, [isLatestAgentMessageStreaming, manageBuffer]);
761
+ }, [isLatestAgentMessageStreaming, conversationId, manageBuffer]);
753
762
  useEffect(() => {
754
763
  const container = messageContainerRef.current;
755
764
  const content = conversationRef.current;
@@ -1087,7 +1096,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
1087
1096
  }
1088
1097
  }
1089
1098
  }
1090
- }, children: messages.map(item => {
1099
+ }, children: messages.map((item, index) => {
1091
1100
  let messageProps;
1092
1101
  if (isCoachMessage(item)) {
1093
1102
  messageProps = {
@@ -1118,7 +1127,9 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
1118
1127
  if (isCoachMessage(item)) {
1119
1128
  setAnimationInitialCursorPos(animatedTillCursor);
1120
1129
  }
1121
- }, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
1130
+ }, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== undefined && prevFullScreen !== fullScreen
1131
+ ? { animationInitialCursorPos }
1132
+ : {}) }, conversationId ? `${conversationId}:${index}` : index));
1122
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') ||
1123
1134
  !isInUtilities(variant)) &&
1124
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') ||