@pega/cosmos-react-work 8.0.0-build.4.4 → 8.0.0-build.40.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/AppAnnouncement/AppAnnouncement.d.ts +8 -4
- package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/AppAnnouncement/AppAnnouncement.js +6 -4
- package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/Article/Article.d.ts +2 -6
- package/lib/components/Article/Article.d.ts.map +1 -1
- package/lib/components/Article/Article.js +2 -7
- package/lib/components/Article/Article.js.map +1 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts +1 -1
- package/lib/components/ArticleList/AIArticleSummary.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.js +6 -2
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts +3 -3
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js +7 -8
- package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -1
- package/lib/components/ArticleList/ArticleFeedback.d.ts +1 -1
- package/lib/components/ArticleList/ArticleFeedback.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.js +4 -4
- package/lib/components/ArticleList/ArticleList.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +9 -5
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts +1 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleListHeader.js +9 -6
- package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleSemanticSearch.js +11 -4
- package/lib/components/ArticleList/ArticleSemanticSearch.js.map +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js +1 -1
- package/lib/components/ArticleList/ArticleSummaryHeader.js.map +1 -1
- package/lib/components/ArticleList/ArticleTag.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleTag.js +3 -3
- package/lib/components/ArticleList/ArticleTag.js.map +1 -1
- package/lib/components/ArticleList/QuestionList.d.ts +1 -1
- package/lib/components/ArticleList/QuestionList.d.ts.map +1 -1
- package/lib/components/ArticleList/QuestionList.js +1 -1
- package/lib/components/ArticleList/QuestionList.js.map +1 -1
- package/lib/components/ArticleList/RelatedQuestions.d.ts +19 -0
- package/lib/components/ArticleList/RelatedQuestions.d.ts.map +1 -0
- package/lib/components/ArticleList/RelatedQuestions.js +40 -0
- package/lib/components/ArticleList/RelatedQuestions.js.map +1 -0
- package/lib/components/ArticleList/index.d.ts +1 -0
- package/lib/components/ArticleList/index.d.ts.map +1 -1
- package/lib/components/ArticleList/index.js +1 -0
- package/lib/components/ArticleList/index.js.map +1 -1
- package/lib/components/Assignments/Assignments.js +2 -2
- package/lib/components/Assignments/Assignments.js.map +1 -1
- package/lib/components/Assignments/Assignments.styles.d.ts +2 -2
- package/lib/components/Assignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.js +24 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js +51 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.styles.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts +2 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js +6 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.test-ids.js.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts +23 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.js +2 -0
- package/lib/components/CaseHierarchy/CaseHierarchy.types.js.map +1 -0
- package/lib/components/CaseHierarchy/index.d.ts +4 -0
- package/lib/components/CaseHierarchy/index.d.ts.map +1 -0
- package/lib/components/CaseHierarchy/index.js +3 -0
- package/lib/components/CaseHierarchy/index.js.map +1 -0
- package/lib/components/CasePreview/CasePreview.d.ts +3 -3
- package/lib/components/CasePreview/CasePreview.d.ts.map +1 -1
- package/lib/components/CasePreview/CasePreview.js +7 -6
- package/lib/components/CasePreview/CasePreview.js.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.d.ts.map +1 -1
- package/lib/components/CaseView/CaseHeader/CaseHeader.js +4 -3
- package/lib/components/CaseView/CaseHeader/CaseHeader.js.map +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.d.ts +1 -1
- package/lib/components/CaseView/CaseHeader/Summary.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +65 -24
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +12 -8
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +287 -110
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +8 -2
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.d.ts +1 -0
- package/lib/components/CaseView/UtilitiesSummary.d.ts.map +1 -1
- package/lib/components/CaseView/UtilitiesSummary.js +85 -19
- package/lib/components/CaseView/UtilitiesSummary.js.map +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js +1 -1
- package/lib/components/CaseView/UtilitySummaryItemDialog.js.map +1 -1
- package/lib/components/CaseView/index.d.ts +1 -1
- package/lib/components/CaseView/index.d.ts.map +1 -1
- package/lib/components/CaseView/index.js.map +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts +1 -1
- package/lib/components/ConfigurableLayout/LayoutCell.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.d.ts +3 -3
- package/lib/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/Details/Details.d.ts +5 -3
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +4 -4
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/Details.styles.d.ts.map +1 -1
- package/lib/components/Details/Details.styles.js +17 -4
- package/lib/components/Details/Details.styles.js.map +1 -1
- package/lib/components/GenAICoach/ConversationHistory.d.ts +5 -0
- package/lib/components/GenAICoach/ConversationHistory.d.ts.map +1 -0
- package/lib/components/GenAICoach/ConversationHistory.js +73 -0
- package/lib/components/GenAICoach/ConversationHistory.js.map +1 -0
- package/lib/components/GenAICoach/GenAICoach.d.ts +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +178 -140
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +21 -10
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +106 -57
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +2 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js +9 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +49 -8
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.js +77 -13
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -1
- package/lib/components/GenAICoach/index.d.ts +1 -1
- package/lib/components/GenAICoach/index.d.ts.map +1 -1
- package/lib/components/GenAICoach/index.js.map +1 -1
- package/lib/components/Glimpse/Glimpse.d.ts +3 -3
- package/lib/components/Glimpse/Glimpse.d.ts.map +1 -1
- package/lib/components/Glimpse/Glimpse.js.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentContext.d.ts +28 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.js +14 -0
- package/lib/components/HierarchicalAssignments/AssignmentContext.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentDetail.d.ts +4 -1
- package/lib/components/HierarchicalAssignments/AssignmentDetail.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentDetail.js +2 -2
- package/lib/components/HierarchicalAssignments/AssignmentDetail.js.map +1 -1
- package/lib/components/HierarchicalAssignments/AssignmentNode.d.ts +19 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.js +33 -0
- package/lib/components/HierarchicalAssignments/AssignmentNode.js.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.d.ts +15 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.js +21 -0
- package/lib/components/HierarchicalAssignments/AssignmentTree.js.map +1 -0
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts +22 -21
- package/lib/components/HierarchicalAssignments/Assignments.styles.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/Assignments.styles.js +85 -69
- package/lib/components/HierarchicalAssignments/Assignments.styles.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts +1 -2
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js +117 -9
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js +2 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.test-ids.js.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts +12 -12
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/HierarchicalAssignments.types.js.map +1 -1
- package/lib/components/HierarchicalAssignments/helpers.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/helpers.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/helpers.js +167 -0
- package/lib/components/HierarchicalAssignments/helpers.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts +18 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +105 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js +105 -0
- package/lib/components/HierarchicalAssignments/nodeItems/CaseDetail.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.d.ts +23 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.d.ts.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.js +42 -0
- package/lib/components/HierarchicalAssignments/nodeItems/useNodeFocus.js.map +1 -0
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +2 -3
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +5 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +2 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +32 -21
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/InteractionNotification/CountdownButton.d.ts +3 -3
- package/lib/components/InteractionNotification/CountdownButton.d.ts.map +1 -1
- package/lib/components/InteractionNotification/CountdownButton.js +1 -1
- package/lib/components/InteractionNotification/CountdownButton.js.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.d.ts +3 -3
- package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
- package/lib/components/Predictions/Predictions.d.ts +2 -3
- package/lib/components/Predictions/Predictions.d.ts.map +1 -1
- package/lib/components/Predictions/Predictions.js +1 -0
- package/lib/components/Predictions/Predictions.js.map +1 -1
- package/lib/components/SearchResults/ActiveFilter.d.ts +1 -1
- package/lib/components/SearchResults/ActiveFilter.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.d.ts +2 -3
- package/lib/components/SearchResults/SearchResults.d.ts.map +1 -1
- package/lib/components/SearchResults/SearchResults.js +1 -2
- package/lib/components/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts +1 -1
- package/lib/components/SearchResults/SearchResults.styles.d.ts.map +1 -1
- package/lib/components/Stages/StageGlimpse.js +1 -1
- package/lib/components/Stages/StageGlimpse.js.map +1 -1
- package/lib/components/Stages/Stages.d.ts +2 -3
- package/lib/components/Stages/Stages.d.ts.map +1 -1
- package/lib/components/Stages/Stages.js +4 -1
- package/lib/components/Stages/Stages.js.map +1 -1
- package/lib/components/Stages/Stages.styles.d.ts +5 -3
- package/lib/components/Stages/Stages.styles.d.ts.map +1 -1
- package/lib/components/Stages/Stages.styles.js +6 -10
- package/lib/components/Stages/Stages.styles.js.map +1 -1
- package/lib/components/Stakeholders/StakeholderForm.d.ts +1 -1
- package/lib/components/Stakeholders/Stakeholders.d.ts +2 -3
- package/lib/components/Stakeholders/Stakeholders.d.ts.map +1 -1
- package/lib/components/Stakeholders/Stakeholders.js +37 -26
- package/lib/components/Stakeholders/Stakeholders.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +3 -3
- package/lib/components/Tags/Tags.d.ts.map +1 -1
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/components/Tasks/TaskList.d.ts +10 -5
- package/lib/components/Tasks/TaskList.d.ts.map +1 -1
- package/lib/components/Tasks/TaskList.js +15 -7
- package/lib/components/Tasks/TaskList.js.map +1 -1
- package/lib/components/Tasks/Tasks.d.ts +6 -1
- package/lib/components/Tasks/Tasks.d.ts.map +1 -1
- package/lib/components/Tasks/Tasks.js +14 -4
- package/lib/components/Tasks/Tasks.js.map +1 -1
- package/lib/components/Timeline/Timeline.d.ts +3 -3
- package/lib/components/Timeline/Timeline.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.js +9 -2
- package/lib/components/Timeline/Timeline.js.map +1 -1
- package/lib/components/Timeline/Timeline.styles.d.ts +5 -5
- package/lib/components/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.styles.js +10 -3
- package/lib/components/Timeline/Timeline.styles.js.map +1 -1
- package/lib/components/Timeline/Timeline.types.d.ts +11 -1
- package/lib/components/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/components/Timeline/Timeline.types.js.map +1 -1
- package/lib/components/Timeline/TimelineItem.d.ts +1 -2
- package/lib/components/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineItem.js +10 -9
- package/lib/components/Timeline/TimelineItem.js.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.d.ts +2 -3
- package/lib/components/Timeline/TimelineToolbar.d.ts.map +1 -1
- package/lib/components/Timeline/TimelineToolbar.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts +5 -0
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js +3 -3
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts +0 -2
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +2 -5
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +9 -8
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts +0 -32
- package/lib/components/HierarchicalAssignments/AssignmentContainer.d.ts.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js +0 -46
- package/lib/components/HierarchicalAssignments/AssignmentContainer.js.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts +0 -10
- package/lib/components/HierarchicalAssignments/AssignmentItem.d.ts.map +0 -1
- package/lib/components/HierarchicalAssignments/AssignmentItem.js +0 -22
- package/lib/components/HierarchicalAssignments/AssignmentItem.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Button, Flex, Icon, MenuButton, Progress, Text, TextArea, createUID, menuHelpers, useI18n, useTestIds, useTheme, withTestIds,
|
|
3
|
+
import { Button, Flex, Icon, MenuButton, Progress, Text, TextArea, createUID, menuHelpers, useI18n, useTestIds, useTheme, withTestIds, registerIcon, usePrevious, getFocusables, isMenuGroupProps, ErrorState, useArrows, focusableSelector, useLiveLog, useOuterEvent, ThemeOverride, hasProp, getActiveElement, useElement, Actions, useBreakpoint, Grid } from '@pega/cosmos-react-core';
|
|
4
4
|
import * as caretUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-up.icon';
|
|
5
5
|
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
6
6
|
import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
|
|
@@ -8,22 +8,29 @@ import * as minusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mi
|
|
|
8
8
|
import * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';
|
|
9
9
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
10
10
|
import { isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
|
|
11
|
-
import {
|
|
11
|
+
import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper } from './GenAICoach.styles';
|
|
12
|
+
import ConversationHistory from './ConversationHistory';
|
|
12
13
|
import { GenAIMessage, InitialSuggestedMessage } from '.';
|
|
13
14
|
registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon);
|
|
14
|
-
const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error,
|
|
15
|
+
const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, conversationHistory, onLayoutChange, ...restProps }) => {
|
|
15
16
|
const theme = useTheme();
|
|
16
17
|
const t = useI18n();
|
|
17
18
|
const elementRef = useRef(null);
|
|
18
19
|
const conversationRef = useRef(null);
|
|
19
20
|
const genAICoachRef = useRef(null);
|
|
20
|
-
const
|
|
21
|
+
const isSmallOrAbove = useBreakpoint('sm', {
|
|
22
|
+
breakpointRef: genAICoachRef
|
|
23
|
+
});
|
|
21
24
|
const focusInMessageListRef = useRef(false);
|
|
22
25
|
const isUserTriggered = useRef(false);
|
|
23
26
|
const lastFocusedMessageRef = useRef(null);
|
|
24
27
|
const initialFocusedElementRef = useRef(null);
|
|
25
28
|
const messageContainerRef = useRef(null);
|
|
26
29
|
const textAreaRef = useRef(null);
|
|
30
|
+
const [suggestionMenuButton, setSuggestionMenuButton] = useElement(null);
|
|
31
|
+
const isGeneratingResponse = useRef(false);
|
|
32
|
+
const focusTextArea = useRef(false);
|
|
33
|
+
const historyViewRef = useRef(null);
|
|
27
34
|
const [message, setMessage] = useState('');
|
|
28
35
|
const [coachOptions, setCoachOptions] = useState(coachOptionsProps);
|
|
29
36
|
const [arrowKey, setArrowKey] = useState(null);
|
|
@@ -31,6 +38,10 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
31
38
|
const testIds = useTestIds(testId, getGenAICoachTestIds);
|
|
32
39
|
const { announcePolite } = useLiveLog();
|
|
33
40
|
const latestMessage = messages.at(-1);
|
|
41
|
+
const condition = variant.placement === 'dialog' ||
|
|
42
|
+
variant.placement === 'utilities' ||
|
|
43
|
+
(variant.placement === 'fullpage' && !isSmallOrAbove) ||
|
|
44
|
+
!conversationHistory;
|
|
34
45
|
const onCoachChange = (id) => {
|
|
35
46
|
setCoachOptions(cur => {
|
|
36
47
|
return cur.map(coach => {
|
|
@@ -76,20 +87,20 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
76
87
|
if (coachOptions.length === 1) {
|
|
77
88
|
return (_jsxs(Flex, { container: { gap: 1 }, children: [_jsx(Icon, { name: 'polaris-solid', color: theme.base.palette.ai }), _jsx(Text, { variant: 'h3', children: selectedCoach })] }));
|
|
78
89
|
}
|
|
79
|
-
return (_jsx(MenuButton, { text: selectedCoach, variant: 'text', as: StyledGenAIOptionsMenu, icon: 'polaris-solid', menu: {
|
|
90
|
+
return (_jsx(MenuButton, { text: selectedCoach, "aria-label": t('agent_switcher', [selectedCoach]), variant: 'text', as: StyledGenAIOptionsMenu, icon: 'polaris-solid', menu: {
|
|
80
91
|
mode: 'single-select',
|
|
81
92
|
items: coachOptions,
|
|
82
93
|
onItemClick: onCoachChange
|
|
83
94
|
} }));
|
|
84
95
|
}, [coachOptions, selectedCoach]);
|
|
85
96
|
const headerContent = useMemo(() => {
|
|
86
|
-
return isInUtilities(variant) && variant.state === '
|
|
97
|
+
return isInUtilities(variant) && variant.state === 'minimized' ? (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { gap: 1 }, children: [_jsx(Icon, { name: 'polaris-solid', color: theme.base.palette.ai }), _jsx(Text, { variant: 'h3', 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: () => {
|
|
87
98
|
variant.onStateChange('maximized');
|
|
88
99
|
isUserTriggered.current = true;
|
|
89
|
-
}, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, isInUtilities(variant) && (_jsx(Button, { icon: true, label: t('minimize'), "aria-label": t('
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
}, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: true, children: [isInUtilities(variant) && (_jsx(Button, { icon: true, label: t('minimize'), "aria-label": t('agent_noun', [t('minimize')]), variant: 'simple', onClick: () => {
|
|
101
|
+
variant.onStateChange('minimized');
|
|
102
|
+
isUserTriggered.current = true;
|
|
103
|
+
}, children: _jsx(Icon, { name: 'minus' }) })), actions && (_jsx(Actions, { "data-testid": testIds.actions, contextualLabel: selectedCoach, ...actions })), variant.placement === 'dialog' && (_jsx(Button, { icon: true, label: t('close'), "aria-label": t('agent_noun', [t('close')]), variant: 'simple', onClick: variant.onClose, children: _jsx(Icon, { name: 'times' }) }))] })] }));
|
|
93
104
|
}, [variant, coachOptions]);
|
|
94
105
|
const setLastFocusableElement = () => {
|
|
95
106
|
focusInMessageListRef.current = false;
|
|
@@ -116,7 +127,7 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
116
127
|
}
|
|
117
128
|
if (isUserTriggered.current) {
|
|
118
129
|
if (isInUtilities(variant) &&
|
|
119
|
-
(variant.state === '
|
|
130
|
+
(variant.state === 'minimized' || (guidedMode && variant.state === 'maximized')) &&
|
|
120
131
|
getFocusables(genAICoachRef).length > 0) {
|
|
121
132
|
getFocusables(genAICoachRef)[0].focus();
|
|
122
133
|
isUserTriggered.current = false;
|
|
@@ -128,6 +139,9 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
141
|
}, [variantState, variant.placement]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
onLayoutChange?.(!condition);
|
|
144
|
+
}, [condition]);
|
|
131
145
|
useEffect(() => {
|
|
132
146
|
onOpen?.();
|
|
133
147
|
window.addEventListener('resize', onResize);
|
|
@@ -136,9 +150,6 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
136
150
|
};
|
|
137
151
|
}, []);
|
|
138
152
|
useEffect(() => {
|
|
139
|
-
if (isInUtilities(variant) && variant.state !== 'maximized' && messages.length > 0) {
|
|
140
|
-
variant.onStateChange('maximized');
|
|
141
|
-
}
|
|
142
153
|
const prevFilteredMsgs = previousMessages?.filter(item => !hasProp(item, 'loading')) ?? [];
|
|
143
154
|
const currentFilteredMsgs = messages?.filter(item => !hasProp(item, 'loading')) ?? [];
|
|
144
155
|
if (prevFilteredMsgs.length < currentFilteredMsgs.length ||
|
|
@@ -156,13 +167,22 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
156
167
|
setArrowKey(null);
|
|
157
168
|
}
|
|
158
169
|
else if (latestMessage?.loading) {
|
|
159
|
-
|
|
170
|
+
isGeneratingResponse.current = true;
|
|
160
171
|
}
|
|
161
172
|
else {
|
|
162
|
-
announcePolite({ message: t('
|
|
173
|
+
announcePolite({ message: t('agent_noun', [`${t('new_message')} ${t('from')}`]) });
|
|
163
174
|
}
|
|
164
175
|
}
|
|
165
176
|
}, [messages]);
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
if (suggestionMenuButton && isGeneratingResponse.current) {
|
|
179
|
+
announcePolite({ message: t('response_generated') });
|
|
180
|
+
isGeneratingResponse.current = false;
|
|
181
|
+
const activeElement = getActiveElement();
|
|
182
|
+
if (activeElement && activeElement === document.body)
|
|
183
|
+
suggestionMenuButton.focus();
|
|
184
|
+
}
|
|
185
|
+
}, [suggestionMenuButton]);
|
|
166
186
|
/** Supports arrow key behaviors */
|
|
167
187
|
useEffect(() => {
|
|
168
188
|
const focusables = getFocusables(elementRef);
|
|
@@ -191,56 +211,67 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
191
211
|
setArrowKey(null);
|
|
192
212
|
focusInMessageListRef.current = false;
|
|
193
213
|
});
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
214
|
+
const GenAICoachElement = (_jsx(_Fragment, { children: ((isInUtilities(variant) && variant.state !== 'minimized') || !isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column' }, as: StyledFlexWrapper, children: [_jsx(Flex, { as: StyledMessagesContainer, ref: messageContainerRef, container: loading || error
|
|
215
|
+
? { direction: 'column', pad: [0, 2], justify: 'center' }
|
|
216
|
+
: { direction: 'column', pad: [0, 2] }, item: { grow: 1 }, 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: {
|
|
217
|
+
justify: 'center',
|
|
218
|
+
direction: 'column',
|
|
219
|
+
gap: 8
|
|
220
|
+
}, item: { grow: 1 }, children: [((isInUtilities(variant) && variant.state === 'maximized') ||
|
|
221
|
+
!isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column', alignItems: 'center', gap: 2 }, children: [_jsx(Icon, { name: 'polaris-solid', size: 'l', color: theme.base.palette.ai }), _jsx(Text, { variant: 'h2', children: t('welcome_text') })] })), _jsx(Flex, { container: { direction: 'column', gap: 1.5 }, children: initialSuggestedMessages?.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
|
|
222
|
+
onSend(initialMessage);
|
|
223
|
+
isUserTriggered.current = true;
|
|
224
|
+
}, testId: initialSuggestedMessage.id }))) })] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onFocus: () => {
|
|
225
|
+
if (!focusInMessageListRef.current) {
|
|
226
|
+
if (lastFocusedMessageRef.current) {
|
|
227
|
+
lastFocusedMessageRef.current.focus();
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
/** Focus on the latest message if the chat message list was never focused */
|
|
231
|
+
const lastChild = conversationRef.current && conversationRef.current.lastElementChild;
|
|
232
|
+
if (lastChild instanceof HTMLElement) {
|
|
233
|
+
lastChild.focus();
|
|
215
234
|
}
|
|
216
235
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
236
|
+
}
|
|
237
|
+
focusInMessageListRef.current = true;
|
|
238
|
+
setArrowKey(null);
|
|
239
|
+
}, onKeyDown: (e) => {
|
|
240
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
241
|
+
setArrowKey(e.key);
|
|
242
|
+
elementRef.current = null;
|
|
243
|
+
}
|
|
244
|
+
else if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
245
|
+
const currentElement = conversationRef.current?.querySelector('li:focus');
|
|
246
|
+
if (currentElement && currentElement instanceof HTMLElement) {
|
|
247
|
+
elementRef.current = currentElement;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
elementRef.current =
|
|
251
|
+
conversationRef.current
|
|
252
|
+
?.querySelector(':focus')
|
|
253
|
+
?.closest('li[type="message"]') || null;
|
|
254
|
+
}
|
|
255
|
+
initialFocusedElementRef.current = elementRef.current;
|
|
256
|
+
if (currentElement && getFocusables(currentElement).length > 0) {
|
|
221
257
|
setArrowKey(e.key);
|
|
222
|
-
elementRef.current = null;
|
|
223
258
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
259
|
+
}
|
|
260
|
+
else if (e.key === 'Tab') {
|
|
261
|
+
setLastFocusableElement();
|
|
262
|
+
if (e.shiftKey) {
|
|
263
|
+
if (!condition &&
|
|
264
|
+
conversationHistory &&
|
|
265
|
+
conversationHistory.selectedItemId) {
|
|
266
|
+
const selectedId = historyViewRef.current?.querySelector(`li[id="${conversationHistory.selectedItemId}"]`);
|
|
267
|
+
if (selectedId) {
|
|
268
|
+
selectedId.focus();
|
|
269
|
+
e.preventDefault();
|
|
270
|
+
}
|
|
228
271
|
}
|
|
229
272
|
else {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
?.querySelector(':focus')
|
|
233
|
-
?.closest('li[type="message"]') || null;
|
|
234
|
-
}
|
|
235
|
-
initialFocusedElementRef.current = elementRef.current;
|
|
236
|
-
if (currentElement && getFocusables(currentElement).length > 0) {
|
|
237
|
-
setArrowKey(e.key);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
else if (e.key === 'Tab') {
|
|
241
|
-
setLastFocusableElement();
|
|
242
|
-
if (e.shiftKey) {
|
|
243
|
-
const prevElement = conversationRef.current?.parentElement?.previousElementSibling;
|
|
273
|
+
const prevElement = conversationRef.current?.parentElement?.parentElement
|
|
274
|
+
?.previousElementSibling;
|
|
244
275
|
if (prevElement) {
|
|
245
276
|
const focusables = getFocusables(prevElement);
|
|
246
277
|
if (focusables.length) {
|
|
@@ -249,95 +280,102 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
249
280
|
}
|
|
250
281
|
}
|
|
251
282
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
const nextElement = conversationRef.current?.parentElement?.nextElementSibling;
|
|
286
|
+
if (nextElement) {
|
|
287
|
+
const focusables = getFocusables(nextElement);
|
|
288
|
+
if (focusables.length) {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
focusables[0].focus();
|
|
260
291
|
}
|
|
261
292
|
}
|
|
262
293
|
setArrowKey(null);
|
|
263
294
|
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
alignItems: 'center',
|
|
280
|
-
pad: 1
|
|
281
|
-
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] })) : (_jsx(Configuration, { theme: {
|
|
282
|
-
components: {
|
|
283
|
-
button: {
|
|
284
|
-
color: theme.base.palette.ai,
|
|
285
|
-
'secondary-color': theme.base.palette.ai,
|
|
286
|
-
'secondary-fill-style': 'outline'
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}, children: _jsx(MenuButton, { text: t('ask_coach', [selectedCoach ?? '']), icon: 'polaris-solid', menu: {
|
|
290
|
-
items: suggestions,
|
|
291
|
-
onItemClick: id => {
|
|
292
|
-
const selected = menuHelpers.getItem(suggestions, id);
|
|
293
|
-
if (selected)
|
|
294
|
-
onSend({
|
|
295
|
-
id: selected.id,
|
|
296
|
-
message: selected.primary
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
} }) })), _jsx(StyledDisclaimerText, { children: t('ai_disclaimer') })] })) })) : (_jsxs(_Fragment, { children: [_jsx(TextArea, { ref: textAreaRef, label: t('message_pega_gen_ai_coach', [selectedCoach ?? '']), value: message, onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, autoResize: false }), latestMessage && isCoachMessage(latestMessage) && latestMessage.loading ? (_jsxs(Flex, { container: {
|
|
295
|
+
}
|
|
296
|
+
}, children: messages.map(item => {
|
|
297
|
+
const messageProps = isCoachMessage(item)
|
|
298
|
+
? {
|
|
299
|
+
...item,
|
|
300
|
+
suggestions: messages.findLast(messageItem => isCoachMessage(messageItem))?.id ===
|
|
301
|
+
item.id
|
|
302
|
+
? item.suggestions
|
|
303
|
+
: undefined,
|
|
304
|
+
onSend
|
|
305
|
+
}
|
|
306
|
+
: item;
|
|
307
|
+
return (_jsx(GenAIMessage, { ...messageProps, testId: item.id, announceInteraction: !focusInMessageListRef.current }));
|
|
308
|
+
}) })) })) }), ((isInUtilities(variant) && variant.state !== 'minimized') ||
|
|
309
|
+
!isInUtilities(variant)) && (_jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, children: guidedMode ? (_jsx(_Fragment, { children: suggestions && messages.length > 0 && (_jsxs(_Fragment, { children: [latestMessage && isCoachMessage(latestMessage) && latestMessage.loading ? (_jsxs(Flex, { container: {
|
|
300
310
|
gap: 1,
|
|
301
|
-
justify: '
|
|
311
|
+
justify: 'center',
|
|
302
312
|
alignItems: 'center',
|
|
303
313
|
pad: 1
|
|
304
|
-
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] })) : (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
} })), _jsx(Button, { variant: 'primary', onClick: message
|
|
319
|
-
? () => {
|
|
314
|
+
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline', focusOnVisible: true, message: t('generating_response') })] })) : (_jsx(ThemeOverride, { theme: {
|
|
315
|
+
components: {
|
|
316
|
+
button: {
|
|
317
|
+
color: theme.base.palette.ai,
|
|
318
|
+
'secondary-color': theme.base.palette.ai,
|
|
319
|
+
'secondary-fill-style': 'outline'
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}, children: _jsx(MenuButton, { text: t('ask_coach', [selectedCoach ?? '']), variant: 'primary', icon: 'polaris-solid', ref: setSuggestionMenuButton, menu: {
|
|
323
|
+
items: suggestions,
|
|
324
|
+
onItemClick: id => {
|
|
325
|
+
const selected = menuHelpers.getItem(suggestions, id);
|
|
326
|
+
if (selected)
|
|
320
327
|
onSend({
|
|
321
|
-
id:
|
|
322
|
-
message
|
|
328
|
+
id: selected.id,
|
|
329
|
+
message: selected.primary
|
|
323
330
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
331
|
+
}
|
|
332
|
+
} }) })), _jsx(StyledDisclaimerText, { children: t('ai_disclaimer') })] })) })) : (_jsxs(_Fragment, { children: [_jsx(TextArea, { ref: textAreaRef, label: t('message_pega_gen_ai_coach', [selectedCoach ?? '']), value: message, onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, autoResize: false }), latestMessage && isCoachMessage(latestMessage) && latestMessage.loading ? (_jsxs(Flex, { container: {
|
|
333
|
+
gap: 1,
|
|
334
|
+
justify: 'end',
|
|
335
|
+
alignItems: 'center',
|
|
336
|
+
pad: 1
|
|
337
|
+
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] })) : (_jsxs(Flex, { container: {
|
|
338
|
+
gap: 2,
|
|
339
|
+
justify: 'end',
|
|
340
|
+
pad: [1, undefined, undefined]
|
|
341
|
+
}, children: [suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'text', icon: 'polaris-solid', as: StyledSuggestions, menu: {
|
|
342
|
+
items: suggestions,
|
|
343
|
+
onItemClick: id => {
|
|
344
|
+
const selected = menuHelpers.getItem(suggestions, id);
|
|
345
|
+
if (selected)
|
|
346
|
+
onSend({
|
|
347
|
+
id: selected.id,
|
|
348
|
+
message: selected.primary
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
} })), _jsx(Button, { variant: 'primary', onClick: message
|
|
352
|
+
? () => {
|
|
353
|
+
onSend({
|
|
354
|
+
id: createUID(),
|
|
355
|
+
message
|
|
356
|
+
});
|
|
357
|
+
setMessage('');
|
|
358
|
+
}
|
|
359
|
+
: undefined, children: t('send') })] })), _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') })] })) }))] })) }));
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
if (focusTextArea.current && !conversationHistory && textAreaRef.current) {
|
|
362
|
+
textAreaRef.current.focus();
|
|
363
|
+
focusTextArea.current = false;
|
|
364
|
+
}
|
|
365
|
+
}, [conversationHistory, focusTextArea.current]);
|
|
366
|
+
const historyView = conversationHistory && (_jsx(ConversationHistory, { testId: testIds.root, ...conversationHistory, onItemClick: conversationId => {
|
|
367
|
+
if (condition) {
|
|
368
|
+
focusTextArea.current = true;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
textAreaRef.current?.focus();
|
|
372
|
+
}
|
|
373
|
+
conversationHistory.onItemClick?.(conversationId);
|
|
374
|
+
}, onDismiss: () => {
|
|
375
|
+
focusTextArea.current = true;
|
|
376
|
+
conversationHistory.onDismiss();
|
|
377
|
+
}, inFullPage: !condition, ref: historyViewRef }));
|
|
378
|
+
return (_jsxs(Flex, { container: { direction: 'column' }, as: StyledGenAICoachContainer, "data-testid": testIds.root, variant: variant, ref: genAICoachRef, ...restProps, 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] }))] }));
|
|
341
379
|
};
|
|
342
380
|
export default withTestIds(GenAICoach, getGenAICoachTestIds);
|
|
343
381
|
//# sourceMappingURL=GenAICoach.js.map
|