@pega/cosmos-react-work 9.0.0-build.12.0 → 9.0.0-build.12.10
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/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +2 -2
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +1 -1
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +3 -1
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/Details/Details.d.ts.map +1 -1
- package/lib/components/Details/Details.js +1 -1
- package/lib/components/Details/Details.js.map +1 -1
- package/lib/components/Details/DetailsList.d.ts.map +1 -1
- package/lib/components/Details/DetailsList.js +1 -1
- package/lib/components/Details/DetailsList.js.map +1 -1
- 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 +24 -6
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +7 -0
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +39 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.test-ids.js +1 -0
- package/lib/components/GenAICoach/GenAICoach.test-ids.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +34 -2
- 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 +30 -26
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts +4 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.d.ts.map +1 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.js +19 -0
- package/lib/components/GenAICoach/ToolConfirmationMessage.js.map +1 -0
- package/lib/components/GenAICoach/ToolDetails.d.ts +5 -0
- package/lib/components/GenAICoach/ToolDetails.d.ts.map +1 -0
- package/lib/components/GenAICoach/ToolDetails.js +91 -0
- package/lib/components/GenAICoach/ToolDetails.js.map +1 -0
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.d.ts.map +1 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js +4 -1
- package/lib/components/HierarchicalAssignments/nodeItems/AssignmentItem.js.map +1 -1
- package/package.json +3 -3
|
@@ -31,7 +31,33 @@ export type InitialSuggestedMessageProps = Pick<GenAICoachProps, 'onSend'> & Bas
|
|
|
31
31
|
export interface UserMessageProps extends BaseProps, TestIdProp, MessageProps {
|
|
32
32
|
from: 'user';
|
|
33
33
|
}
|
|
34
|
-
export type
|
|
34
|
+
export type ToolParameters = {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
type: 'text' | 'number' | 'boolean';
|
|
38
|
+
value: string;
|
|
39
|
+
};
|
|
40
|
+
export interface Tool {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
message: string;
|
|
44
|
+
decision: 'accept' | 'modify' | 'reject';
|
|
45
|
+
parameters: ToolParameters[];
|
|
46
|
+
}
|
|
47
|
+
export interface ToolDetailsProps {
|
|
48
|
+
isToolConfirmation: true;
|
|
49
|
+
tools: Tool[];
|
|
50
|
+
onSubmit?: (tools: Tool[]) => void;
|
|
51
|
+
onCancel?: () => void;
|
|
52
|
+
toolsConfirmed: boolean;
|
|
53
|
+
}
|
|
54
|
+
export type CoachMessageProps = RequireAtLeastOne<Partial<Pick<GenAICoachProps, 'onSend'>> & BaseProps & TestIdProp & Pick<MessageProps, 'id' | 'announceInteraction' | 'ref'> & (ToolDetailsProps | {
|
|
55
|
+
isToolConfirmation?: false;
|
|
56
|
+
tools?: never;
|
|
57
|
+
onSubmit?: never;
|
|
58
|
+
onCancel?: never;
|
|
59
|
+
toolsConfirmed?: never;
|
|
60
|
+
}) & {
|
|
35
61
|
from: 'coach';
|
|
36
62
|
coachName: string;
|
|
37
63
|
suggestions?: MessageProps[];
|
|
@@ -50,7 +76,11 @@ export type CoachMessageProps = RequireAtLeastOne<Partial<Pick<GenAICoachProps,
|
|
|
50
76
|
onAnimationCursorUpdate?: (animatedTillCursor: number) => void;
|
|
51
77
|
animationInitialCursorPos?: number;
|
|
52
78
|
}, 'loading' | 'message' | 'error'>;
|
|
53
|
-
export
|
|
79
|
+
export interface SystemMessageProps extends TestIdProp, Pick<MessageProps, 'id' | 'message' | 'ref' | 'announceInteraction'> {
|
|
80
|
+
from: 'system';
|
|
81
|
+
loading?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export type GenAIMessageProps = UserMessageProps | CoachMessageProps | SystemMessageProps;
|
|
54
84
|
export interface ConversationHistoryProps extends TestIdProp {
|
|
55
85
|
/** List of History items. */
|
|
56
86
|
data: {
|
|
@@ -80,6 +110,7 @@ export interface ConversationHistoryProps extends TestIdProp {
|
|
|
80
110
|
}
|
|
81
111
|
export type SendMessageProps = OmitStrict<MessageProps, 'attachments'> & {
|
|
82
112
|
attachmentIds?: string[];
|
|
113
|
+
tools?: Tool[];
|
|
83
114
|
};
|
|
84
115
|
export type GenAICoachProps = WithAttributes<'div', TestIdProp & {
|
|
85
116
|
/** Chat loading indicator */
|
|
@@ -96,6 +127,7 @@ export type GenAICoachProps = WithAttributes<'div', TestIdProp & {
|
|
|
96
127
|
suggestions?: MenuProps['items'];
|
|
97
128
|
/** Send prompts */
|
|
98
129
|
onSend: (message: SendMessageProps) => void;
|
|
130
|
+
stopProcess?: () => void;
|
|
99
131
|
/** Messages to be shown in the chatting window. */
|
|
100
132
|
messages?: GenAIMessageProps[];
|
|
101
133
|
/** Placement of the component */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.types.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE5C,MAAM,MAAM,OAAO,GACf;IACE,SAAS,EAAE,WAAW,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC/D,GACD;IAAE,SAAS,EAAE,UAAU,CAAA;CAAE,GACzB;IAAE,SAAS,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC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CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAC1C,uBAAuB;IACvB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,2BAA2B;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,yBAAyB;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CACF,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC;IACtF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.types.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Dispatch, Ref, SetStateAction } from 'react';\n\nimport type {\n BaseProps,\n MenuProps,\n OmitStrict,\n ProgressProps,\n RequireAtLeastOne,\n TestIdProp,\n WithAttributes,\n ActionsProps,\n FileItemProps,\n FileDisplayProps,\n LightboxProps\n} from '@pega/cosmos-react-core';\nimport type { MDMap } from '@pega/cosmos-react-rte';\n\nexport type State = 'minimized' | 'maximized';\nexport type Reaction = 'liked' | 'disliked';\n\nexport type Variant =\n | {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n setGenAIHeight?: Dispatch<SetStateAction<number | undefined>>;\n }\n | { placement: 'fullpage' }\n | { placement: 'dialog'; onClose: () => void };\n\nexport interface MessageProps {\n id: string;\n message: string;\n announceInteraction?: boolean;\n attachments?: FileDisplayProps[];\n /**\n * Whether the message is a suggestion from the composer\n * @default false\n */\n fromComposer?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLLIElement>;\n}\n\nexport type InitialSuggestedMessageProps = Pick<GenAICoachProps, 'onSend'> &\n BaseProps &\n TestIdProp &\n MessageProps;\n\nexport interface UserMessageProps extends BaseProps, TestIdProp, MessageProps {\n from: 'user';\n}\n\nexport type CoachMessageProps = RequireAtLeastOne<\n Partial<Pick<GenAICoachProps, 'onSend'>> &\n BaseProps &\n TestIdProp &\n Pick<MessageProps, 'id' | 'announceInteraction' | 'ref'> & {\n from: 'coach';\n coachName: string;\n suggestions?: MessageProps[];\n loading?: boolean;\n enableStreaming?: boolean;\n allChunksReceived?: boolean;\n error?: string;\n message?: MessageProps['message'];\n markdownMap?: MDMap;\n onStreamingUpdate?: (isStreamingDone: boolean) => void;\n feedback?: {\n reaction: Reaction | undefined;\n onReaction: (id: MessageProps['id'], reaction: Reaction) => void;\n onFeedbackComplete: (id: MessageProps['id'], comment?: string) => void;\n };\n onAnimationCursorUpdate?: (animatedTillCursor: number) => void;\n animationInitialCursorPos?: number;\n },\n 'loading' | 'message' | 'error'\n>;\n\nexport type GenAIMessageProps = UserMessageProps | CoachMessageProps;\n\nexport interface ConversationHistoryProps extends TestIdProp {\n /** List of History items. */\n data: {\n id: string;\n section: string;\n conversations: {\n id: string;\n title: string;\n }[];\n }[];\n /** Click event for items within the list. */\n onItemClick?: (conversationId: string) => void;\n /** List loading state. */\n loading?: boolean;\n /** Called at scroll trigger to load more items. */\n loadMore?: () => void;\n /** True if History view is rendered in Full page view. */\n inFullPage?: boolean;\n /** Callback triggered when closing the history view. */\n onDismiss: () => void;\n /** Id of the selected item. */\n selectedItemId?: string;\n /** Set if there is an error in retreiving the data. */\n error?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport type SendMessageProps = OmitStrict<MessageProps, 'attachments'> & {\n attachmentIds?: string[];\n};\n\nexport type GenAICoachProps = WithAttributes<\n 'div',\n TestIdProp & {\n /** Chat loading indicator */\n loading?: boolean | ProgressProps['message'];\n /** Set if there is an error in retreiving the data */\n error?: string;\n /** Coaches available in the chat header */\n coachOptions: MenuProps['items'];\n /** Handle the coach selections */\n onCoachChange: (id: MenuProps['id']) => void;\n /** Suggested messages to start the conversation */\n initialSuggestedMessages?: MessageProps[];\n /** Additional suggestions presented at the bottom of the chat window */\n suggestions?: MenuProps['items'];\n /** Send prompts */\n onSend: (message: SendMessageProps) => void;\n /** Messages to be shown in the chatting window. */\n messages?: GenAIMessageProps[];\n /** Placement of the component */\n variant: Variant;\n /** From landing page utilities */\n isInLandingPageUtilities?: boolean;\n /** callback when component is mounted */\n onOpen?: () => void;\n /**\n * User would be guided with selective prompts to enable interaction with coach.\n * @default false\n */\n guidedMode?: boolean;\n /** Pass an array of Action objects to show Action button. */\n actions?: ActionsProps;\n /** Pass data to show history view. */\n conversationHistory?: ConversationHistoryProps;\n /** Callback triggered when the layout component changes. */\n onLayoutChange?: (inFullPage: boolean) => void;\n /** Callback when attachment icon is clicked */\n onAddAttachment?: (files: File[]) => void;\n /** Attachments list */\n attachments?: FileItemProps[];\n /** Error in attachments */\n attachmentsError?: string;\n /** Configuration for the Lightbox component that handles preview of media attachments and files */\n lightboxPreviewProps?: LightboxProps;\n /** Enable full screen */\n allowFullScreen?: boolean;\n }\n>;\n\nexport interface UtilitiesGenAICoachProps extends OmitStrict<GenAICoachProps, 'variant'> {\n onClose?: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GenAICoach.types.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Dispatch, Ref, SetStateAction } from 'react';\n\nimport type {\n BaseProps,\n MenuProps,\n OmitStrict,\n ProgressProps,\n RequireAtLeastOne,\n TestIdProp,\n WithAttributes,\n ActionsProps,\n FileItemProps,\n FileDisplayProps,\n LightboxProps\n} from '@pega/cosmos-react-core';\nimport type { MDMap } from '@pega/cosmos-react-rte';\n\nexport type State = 'minimized' | 'maximized';\nexport type Reaction = 'liked' | 'disliked';\n\nexport type Variant =\n | {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n setGenAIHeight?: Dispatch<SetStateAction<number | undefined>>;\n }\n | { placement: 'fullpage' }\n | { placement: 'dialog'; onClose: () => void };\n\nexport interface MessageProps {\n id: string;\n message: string;\n announceInteraction?: boolean;\n attachments?: FileDisplayProps[];\n /**\n * Whether the message is a suggestion from the composer\n * @default false\n */\n fromComposer?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLLIElement>;\n}\n\nexport type InitialSuggestedMessageProps = Pick<GenAICoachProps, 'onSend'> &\n BaseProps &\n TestIdProp &\n MessageProps;\n\nexport interface UserMessageProps extends BaseProps, TestIdProp, MessageProps {\n from: 'user';\n}\n\nexport type ToolParameters = {\n id: string;\n label: string;\n type: 'text' | 'number' | 'boolean';\n value: string;\n};\n\nexport interface Tool {\n id: string;\n name: string;\n message: string;\n decision: 'accept' | 'modify' | 'reject';\n parameters: ToolParameters[];\n}\n\nexport interface ToolDetailsProps {\n isToolConfirmation: true;\n tools: Tool[];\n onSubmit?: (tools: Tool[]) => void;\n onCancel?: () => void;\n toolsConfirmed: boolean;\n}\n\nexport type CoachMessageProps = RequireAtLeastOne<\n Partial<Pick<GenAICoachProps, 'onSend'>> &\n BaseProps &\n TestIdProp &\n Pick<MessageProps, 'id' | 'announceInteraction' | 'ref'> &\n (\n | ToolDetailsProps\n | {\n isToolConfirmation?: false;\n tools?: never;\n onSubmit?: never;\n onCancel?: never;\n toolsConfirmed?: never;\n }\n ) & {\n from: 'coach';\n coachName: string;\n suggestions?: MessageProps[];\n loading?: boolean;\n enableStreaming?: boolean;\n allChunksReceived?: boolean;\n error?: string;\n message?: MessageProps['message'];\n markdownMap?: MDMap;\n onStreamingUpdate?: (isStreamingDone: boolean) => void;\n feedback?: {\n reaction: Reaction | undefined;\n onReaction: (id: MessageProps['id'], reaction: Reaction) => void;\n onFeedbackComplete: (id: MessageProps['id'], comment?: string) => void;\n };\n onAnimationCursorUpdate?: (animatedTillCursor: number) => void;\n animationInitialCursorPos?: number;\n },\n 'loading' | 'message' | 'error'\n>;\n\nexport interface SystemMessageProps\n extends TestIdProp,\n Pick<MessageProps, 'id' | 'message' | 'ref' | 'announceInteraction'> {\n from: 'system';\n loading?: boolean;\n}\n\nexport type GenAIMessageProps = UserMessageProps | CoachMessageProps | SystemMessageProps;\n\nexport interface ConversationHistoryProps extends TestIdProp {\n /** List of History items. */\n data: {\n id: string;\n section: string;\n conversations: {\n id: string;\n title: string;\n }[];\n }[];\n /** Click event for items within the list. */\n onItemClick?: (conversationId: string) => void;\n /** List loading state. */\n loading?: boolean;\n /** Called at scroll trigger to load more items. */\n loadMore?: () => void;\n /** True if History view is rendered in Full page view. */\n inFullPage?: boolean;\n /** Callback triggered when closing the history view. */\n onDismiss: () => void;\n /** Id of the selected item. */\n selectedItemId?: string;\n /** Set if there is an error in retreiving the data. */\n error?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport type SendMessageProps = OmitStrict<MessageProps, 'attachments'> & {\n attachmentIds?: string[];\n tools?: Tool[];\n};\n\nexport type GenAICoachProps = WithAttributes<\n 'div',\n TestIdProp & {\n /** Chat loading indicator */\n loading?: boolean | ProgressProps['message'];\n /** Set if there is an error in retreiving the data */\n error?: string;\n /** Coaches available in the chat header */\n coachOptions: MenuProps['items'];\n /** Handle the coach selections */\n onCoachChange: (id: MenuProps['id']) => void;\n /** Suggested messages to start the conversation */\n initialSuggestedMessages?: MessageProps[];\n /** Additional suggestions presented at the bottom of the chat window */\n suggestions?: MenuProps['items'];\n /** Send prompts */\n onSend: (message: SendMessageProps) => void;\n\n stopProcess?: () => void;\n /** Messages to be shown in the chatting window. */\n messages?: GenAIMessageProps[];\n /** Placement of the component */\n variant: Variant;\n /** From landing page utilities */\n isInLandingPageUtilities?: boolean;\n /** callback when component is mounted */\n onOpen?: () => void;\n /**\n * User would be guided with selective prompts to enable interaction with coach.\n * @default false\n */\n guidedMode?: boolean;\n /** Pass an array of Action objects to show Action button. */\n actions?: ActionsProps;\n /** Pass data to show history view. */\n conversationHistory?: ConversationHistoryProps;\n /** Callback triggered when the layout component changes. */\n onLayoutChange?: (inFullPage: boolean) => void;\n /** Callback when attachment icon is clicked */\n onAddAttachment?: (files: File[]) => void;\n /** Attachments list */\n attachments?: FileItemProps[];\n /** Error in attachments */\n attachmentsError?: string;\n /** Configuration for the Lightbox component that handles preview of media attachments and files */\n lightboxPreviewProps?: LightboxProps;\n /** Enable full screen */\n allowFullScreen?: boolean;\n }\n>;\n\nexport interface UtilitiesGenAICoachProps extends OmitStrict<GenAICoachProps, 'variant'> {\n onClose?: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAgBL,KAAK,+BAA+B,EACrC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"GenAIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAgBL,KAAK,+BAA+B,EACrC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAuB5D,KAAK,qBAAqB,GAAG;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,uBAAuB;AACvB,eAAO,MAAM,gBAAgB,4DAE3B,CAAC;AAEH,QAAA,MAAM,YAAY,EAAE,+BAA+B,CAAC,iBAAiB,CA8SpE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -8,10 +8,11 @@ import * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Ico
|
|
|
8
8
|
import * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';
|
|
9
9
|
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
10
10
|
import { useAnimatedText } from '@pega/cosmos-react-core';
|
|
11
|
-
import { StyledAttachmentsList, StyledGenAIAvatar, StyledMessage, StyledSuggestion, StyledSuggestionsContainer, StyledUserMessage } from './GenAICoach.styles';
|
|
11
|
+
import { StyledAttachmentsList, StyledGenAIAvatar, StyledMessage, StyledSuggestion, StyledSuggestionsContainer, StyledSystemMessage, StyledUserMessage } from './GenAICoach.styles';
|
|
12
12
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
13
13
|
import { isCoachMessage, isUserMessage } from './GenAICoach.utils';
|
|
14
14
|
import GenAIMessageProgress from './GenAIMessageProgress';
|
|
15
|
+
import ToolConfirmationMessage from './ToolConfirmationMessage';
|
|
15
16
|
registerIcon(polarisSolidIcon, thumbsUpSolidIcon, thumbsUpIcon, thumbsDownSolidIcon, thumbsDownIcon);
|
|
16
17
|
/** Metadata Context */
|
|
17
18
|
export const StreamingContext = createContext({
|
|
@@ -78,31 +79,31 @@ const GenAIMessage = forwardRef(function GenAIMessage(props, ref) {
|
|
|
78
79
|
ariaLabel = `${ariaLabel} ${t('interaction_message')}`;
|
|
79
80
|
}
|
|
80
81
|
const streamingContent = isStreamingMessage && (_jsx(_Fragment, { children: message ? (_jsxs(_Fragment, { children: [_jsx(StreamingContext.Provider, { value: streamingContext, children: _jsx(RichTextViewer, { content: isStreamingMessage ? streamingMessage : message, type: 'markdown', markdownMap: markdownMap }) }), loading && _jsx(Progress, { variant: 'ellipsis', placement: 'inline' })] })) : (loading && _jsx(GenAIMessageProgress, {})) }));
|
|
81
|
-
return (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
82
|
+
return (_jsx(Flex, { as: 'li', "data-testid": testIds.coachMessage, ...restProps, container: { direction: 'row', pad: [1, 0], gap: 0.5 }, type: 'message', "aria-label": ariaLabel, ref: ref, children: _jsxs(_Fragment, { children: [_jsx(StyledGenAIAvatar, { name: coachName, icon: 'polaris-solid', color: theme.base.palette.ai, shape: 'circle', size: 'm' }), props.isToolConfirmation ? (_jsx(ToolConfirmationMessage, { ...props })) : (_jsxs(StyledMessage, { children: [streamingContent, loading || error ? (_jsxs(_Fragment, { children: [loading && !isStreamingMessage && _jsx(GenAIMessageProgress, {}), error && _jsx(ErrorState, { message: error })] })) : (_jsxs(_Fragment, { children: [!isStreamingMessage && message && (_jsx(RichTextViewer, { content: message, type: 'markdown', markdownMap: markdownMap })), feedback && (_jsx(Flex, { container: { pad: [0.5, undefined] }, children: reaction ? (_jsxs(_Fragment, { children: [_jsx(Flex, { container: { pad: 0.5 }, "aria-label": selectedFeedbackResponse, ref: setWrapperEl, tabIndex: -1, children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid' }) }), showDialog ? (onFeedbackComplete &&
|
|
83
|
+
wrapperEl && (_jsx(FormDialog, { target: wrapperEl, heading: t('share_feedback'), onCancel: () => {
|
|
84
|
+
focusOnInteractionRef.current = true;
|
|
85
|
+
setShowDialog(false);
|
|
86
|
+
onFeedbackComplete(messageId);
|
|
87
|
+
}, onSubmit: () => {
|
|
88
|
+
focusOnInteractionRef.current = true;
|
|
89
|
+
setShowDialog(false);
|
|
90
|
+
onFeedbackComplete(messageId, feedbackVal);
|
|
91
|
+
}, onKeyDown: e => e.stopPropagation(), children: _jsx(TextArea, { value: feedbackVal, onChange: e => setFeedbackVal(e.target.value), onKeyDown: (e) => {
|
|
92
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
focusOnInteractionRef.current = true;
|
|
95
|
+
setShowDialog(false);
|
|
96
|
+
onFeedbackComplete(messageId, feedbackVal);
|
|
97
|
+
}
|
|
98
|
+
}, autoResize: false }) }))) : (_jsx(Tooltip, { target: wrapperEl, describeTarget: false, children: reaction === 'liked' ? t('good_response') : t('bad_response') }))] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { label: t('good_response'), variant: 'simple', icon: true, compact: true, onClick: () => {
|
|
99
|
+
onReaction?.(messageId, 'liked');
|
|
100
|
+
focusOnInteractionRef.current = true;
|
|
101
|
+
}, children: _jsx(Icon, { name: 'thumbs-up' }) }), _jsx(Button, { label: t('bad_response'), variant: 'simple', icon: true, compact: true, onClick: () => {
|
|
102
|
+
setShowDialog(true);
|
|
103
|
+
onReaction?.(messageId, 'disliked');
|
|
104
|
+
}, children: _jsx(Icon, { name: 'thumbs-down' }) })] })) })), suggestions && (_jsx(Flex, { as: StyledSuggestionsContainer, container: { direction: 'column', gap: 1 }, children: suggestions.map(({ id, message: prompt }) => {
|
|
105
|
+
return (_jsx(Button, { as: StyledSuggestion, onClick: onSend ? () => onSend({ id, message: prompt }) : undefined, children: prompt }, id));
|
|
106
|
+
}) }))] }))] }))] }) }));
|
|
106
107
|
}
|
|
107
108
|
if (isUserMessage(props)) {
|
|
108
109
|
if (plainTextMessage) {
|
|
@@ -113,6 +114,9 @@ const GenAIMessage = forwardRef(function GenAIMessage(props, ref) {
|
|
|
113
114
|
}
|
|
114
115
|
return (_jsxs(StyledUserMessage, { as: StyledUserMessage, "data-testid": testIds.userMessage, ...restProps, type: 'message', "aria-label": ariaLabel, ref: ref, children: [props.attachments && props.attachments.length > 0 && (_jsx(StyledAttachmentsList, { type: 'display', items: props.attachments })), message && _jsx(RichTextViewer, { content: message, type: 'markdown' })] }));
|
|
115
116
|
}
|
|
117
|
+
if (props.from === 'system') {
|
|
118
|
+
return (_jsx(Flex, { container: { justify: 'center' }, as: StyledSystemMessage, "data-testid": testIds.userMessage, "aria-label": ariaLabel, ref: ref, children: message }));
|
|
119
|
+
}
|
|
116
120
|
return null;
|
|
117
121
|
});
|
|
118
122
|
export default GenAIMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGxF,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,eAAe,EACf,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,gBAAgB,MAAM,sEAAsE,CAAC;AACzG,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,YAAY,CACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,cAAc,CACf,CAAC;AAOF,uBAAuB;AACvB,MAAM,CAAC,MAAM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,EAAE,gBAAgB,EACpB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,YAGlE,MAAM,IAFF,EAAE,CAGA,CACV,CAAC;oCACJ,CAAC,CAAC,GACG,CACR,IACA,CACJ,IACa,IACX,CACR,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,gBAAgB,EAAE,CAAC;YACrB,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,mBAAmB,EAAE,CAAC;YACxB,SAAS,GAAG,GAAG,SAAS,IAAI,CAAC,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACzD,CAAC;QAED,OAAO,CACL,MAAC,iBAAiB,IAChB,EAAE,EAAE,iBAAiB,iBACR,OAAO,CAAC,WAAW,KAC5B,SAAS,EACb,IAAI,EAAC,SAAS,gBACF,SAAS,EACrB,GAAG,EAAE,GAAG,aAEP,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CACpD,KAAC,qBAAqB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,CAAC,WAAW,GAAI,CACnE,EACA,OAAO,IAAI,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,UAAU,GAAG,IAC9C,CACrB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { createContext, forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport type { KeyboardEvent, PropsWithoutRef } from 'react';\n\nimport {\n Button,\n Flex,\n Icon,\n Progress,\n registerIcon,\n useI18n,\n useTheme,\n useTestIds,\n ErrorState,\n useElement,\n Tooltip,\n TextArea,\n FormDialog,\n useElementFocus,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledAttachmentsList,\n StyledGenAIAvatar,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\n\nregisterIcon(\n polarisSolidIcon,\n thumbsUpSolidIcon,\n thumbsUpIcon,\n thumbsDownSolidIcon,\n thumbsDownIcon\n);\n\ntype StreamingContextProps = {\n isStreamingMessage?: boolean;\n isStreamingInProgress?: boolean;\n};\n\n/** Metadata Context */\nexport const StreamingContext = createContext<StreamingContextProps | undefined>({\n isStreamingMessage: false\n});\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const theme = useTheme();\n const t = useI18n();\n const [wrapperEl, setWrapperEl] = useElement<HTMLDivElement>(null);\n const [feedbackVal, setFeedbackVal] = useState('');\n const [showDialog, setShowDialog] = useState(false);\n const focusOnInteractionRef = useRef(false);\n\n const { message, announceInteraction, ...restProps } = props;\n const plainTextMessage = markdownToPlainText(message ?? '');\n let ariaLabel = plainTextMessage;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const {\n text: streamingMessage,\n isAnimationDone: isStreamingDone,\n animatedTillCursor\n } = useAnimatedText({\n text: message ?? '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: enableStreaming,\n tokenizeMarkdown: true,\n cursorStartIndex:\n isCoachMessage(props) && props.animationInitialCursorPos\n ? props.animationInitialCursorPos\n : undefined\n });\n\n useEffect(() => {\n if (isCoachMessage(props) && props.onAnimationCursorUpdate) {\n props.onAnimationCursorUpdate(animatedTillCursor);\n }\n }, [animatedTillCursor]);\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useElementFocus(wrapperEl, { shouldFocus: !showDialog && focusOnInteractionRef.current });\n\n useEffect(() => {\n if (!showDialog && focusOnInteractionRef.current) {\n focusOnInteractionRef.current = false;\n }\n }, [showDialog]);\n\n const streamingContext: StreamingContextProps = useMemo(() => {\n return { isStreamingMessage, isStreamingInProgress: isCoachMessage(props) && props.loading };\n }, [isStreamingMessage, props]);\n\n if (isCoachMessage(props)) {\n const {\n id: messageId,\n coachName,\n suggestions,\n onSend,\n loading,\n error,\n feedback,\n markdownMap\n } = props;\n\n const { reaction, onReaction, onFeedbackComplete } = feedback ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <StreamingContext.Provider value={streamingContext}>\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n markdownMap={markdownMap}\n />\n </StreamingContext.Provider>\n\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n loading && <GenAIMessageProgress />\n )}\n </>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'row', pad: [1, 0], gap: 0.5 }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <StyledGenAIAvatar\n name={coachName}\n icon='polaris-solid'\n color={theme.base.palette.ai}\n shape='circle'\n size='m'\n />\n <StyledMessage>\n {/* Streaming loader and content */}\n {streamingContent}\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && <GenAIMessageProgress />}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage && message && (\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n )}\n {feedback && (\n <Flex container={{ pad: [0.5, undefined] }}>\n {reaction ? (\n <>\n <Flex\n container={{ pad: 0.5 }}\n aria-label={selectedFeedbackResponse}\n ref={setWrapperEl}\n tabIndex={-1}\n >\n <Icon\n name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid'}\n />\n </Flex>\n {showDialog ? (\n onFeedbackComplete &&\n wrapperEl && (\n <FormDialog\n target={wrapperEl}\n heading={t('share_feedback')}\n onCancel={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId);\n }}\n onSubmit={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }}\n onKeyDown={e => e.stopPropagation()}\n >\n <TextArea\n value={feedbackVal}\n onChange={e => setFeedbackVal(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }\n }}\n autoResize={false}\n />\n </FormDialog>\n )\n ) : (\n <Tooltip target={wrapperEl} describeTarget={false}>\n {reaction === 'liked' ? t('good_response') : t('bad_response')}\n </Tooltip>\n )}\n </>\n ) : (\n <>\n <Button\n label={t('good_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction?.(messageId, 'liked');\n focusOnInteractionRef.current = true;\n }}\n >\n <Icon name='thumbs-up' />\n </Button>\n\n <Button\n label={t('bad_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n setShowDialog(true);\n onReaction?.(messageId, 'disliked');\n }}\n >\n <Icon name='thumbs-down' />\n </Button>\n </>\n )}\n </Flex>\n )}\n {suggestions && (\n <Flex as={StyledSuggestionsContainer} container={{ direction: 'column', gap: 1 }}>\n {suggestions.map(({ id, message: prompt }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n return (\n <StyledUserMessage\n as={StyledUserMessage}\n data-testid={testIds.userMessage}\n {...restProps}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {message && <RichTextViewer content={message} type='markdown' />}\n </StyledUserMessage>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGxF,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,eAAe,EACf,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,gBAAgB,MAAM,sEAAsE,CAAC;AACzG,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,YAAY,CACV,gBAAgB,EAChB,iBAAiB,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AI,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAChC,EAAE,EAAE,mBAAmB,iBACV,OAAO,CAAC,WAAW,gBACpB,SAAS,EACrB,GAAG,EAAE,GAAG,YAEP,OAAO,GACH,CACR,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { createContext, forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport type { KeyboardEvent, PropsWithoutRef } from 'react';\n\nimport {\n Button,\n Flex,\n Icon,\n Progress,\n registerIcon,\n useI18n,\n useTheme,\n useTestIds,\n ErrorState,\n useElement,\n Tooltip,\n TextArea,\n FormDialog,\n useElementFocus,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledAttachmentsList,\n StyledGenAIAvatar,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledSystemMessage,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\nimport ToolConfirmationMessage from './ToolConfirmationMessage';\n\nregisterIcon(\n polarisSolidIcon,\n thumbsUpSolidIcon,\n thumbsUpIcon,\n thumbsDownSolidIcon,\n thumbsDownIcon\n);\n\ntype StreamingContextProps = {\n isStreamingMessage?: boolean;\n isStreamingInProgress?: boolean;\n};\n\n/** Metadata Context */\nexport const StreamingContext = createContext<StreamingContextProps | undefined>({\n isStreamingMessage: false\n});\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const theme = useTheme();\n const t = useI18n();\n const [wrapperEl, setWrapperEl] = useElement<HTMLDivElement>(null);\n const [feedbackVal, setFeedbackVal] = useState('');\n const [showDialog, setShowDialog] = useState(false);\n const focusOnInteractionRef = useRef(false);\n\n const { message, announceInteraction, ...restProps } = props;\n const plainTextMessage = markdownToPlainText(message ?? '');\n let ariaLabel = plainTextMessage;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const {\n text: streamingMessage,\n isAnimationDone: isStreamingDone,\n animatedTillCursor\n } = useAnimatedText({\n text: message ?? '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: enableStreaming,\n tokenizeMarkdown: true,\n cursorStartIndex:\n isCoachMessage(props) && props.animationInitialCursorPos\n ? props.animationInitialCursorPos\n : undefined\n });\n\n useEffect(() => {\n if (isCoachMessage(props) && props.onAnimationCursorUpdate) {\n props.onAnimationCursorUpdate(animatedTillCursor);\n }\n }, [animatedTillCursor]);\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useElementFocus(wrapperEl, { shouldFocus: !showDialog && focusOnInteractionRef.current });\n\n useEffect(() => {\n if (!showDialog && focusOnInteractionRef.current) {\n focusOnInteractionRef.current = false;\n }\n }, [showDialog]);\n\n const streamingContext: StreamingContextProps = useMemo(() => {\n return { isStreamingMessage, isStreamingInProgress: isCoachMessage(props) && props.loading };\n }, [isStreamingMessage, props]);\n\n if (isCoachMessage(props)) {\n const {\n id: messageId,\n coachName,\n suggestions,\n onSend,\n loading,\n error,\n feedback,\n markdownMap\n } = props;\n\n const { reaction, onReaction, onFeedbackComplete } = feedback ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <StreamingContext.Provider value={streamingContext}>\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n markdownMap={markdownMap}\n />\n </StreamingContext.Provider>\n\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n loading && <GenAIMessageProgress />\n )}\n </>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'row', pad: [1, 0], gap: 0.5 }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <>\n <StyledGenAIAvatar\n name={coachName}\n icon='polaris-solid'\n color={theme.base.palette.ai}\n shape='circle'\n size='m'\n />\n {props.isToolConfirmation ? (\n <ToolConfirmationMessage {...props} />\n ) : (\n <StyledMessage>\n {/* Streaming loader and content */}\n {streamingContent}\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && <GenAIMessageProgress />}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage && message && (\n <RichTextViewer content={message} type='markdown' markdownMap={markdownMap} />\n )}\n {feedback && (\n <Flex container={{ pad: [0.5, undefined] }}>\n {reaction ? (\n <>\n <Flex\n container={{ pad: 0.5 }}\n aria-label={selectedFeedbackResponse}\n ref={setWrapperEl}\n tabIndex={-1}\n >\n <Icon\n name={\n reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid'\n }\n />\n </Flex>\n {showDialog ? (\n onFeedbackComplete &&\n wrapperEl && (\n <FormDialog\n target={wrapperEl}\n heading={t('share_feedback')}\n onCancel={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId);\n }}\n onSubmit={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }}\n onKeyDown={e => e.stopPropagation()}\n >\n <TextArea\n value={feedbackVal}\n onChange={e => setFeedbackVal(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }\n }}\n autoResize={false}\n />\n </FormDialog>\n )\n ) : (\n <Tooltip target={wrapperEl} describeTarget={false}>\n {reaction === 'liked' ? t('good_response') : t('bad_response')}\n </Tooltip>\n )}\n </>\n ) : (\n <>\n <Button\n label={t('good_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction?.(messageId, 'liked');\n focusOnInteractionRef.current = true;\n }}\n >\n <Icon name='thumbs-up' />\n </Button>\n\n <Button\n label={t('bad_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n setShowDialog(true);\n onReaction?.(messageId, 'disliked');\n }}\n >\n <Icon name='thumbs-down' />\n </Button>\n </>\n )}\n </Flex>\n )}\n {suggestions && (\n <Flex\n as={StyledSuggestionsContainer}\n container={{ direction: 'column', gap: 1 }}\n >\n {suggestions.map(({ id, message: prompt }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n )}\n </>\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n return (\n <StyledUserMessage\n as={StyledUserMessage}\n data-testid={testIds.userMessage}\n {...restProps}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {message && <RichTextViewer content={message} type='markdown' />}\n </StyledUserMessage>\n );\n }\n\n if (props.from === 'system') {\n return (\n <Flex\n container={{ justify: 'center' }}\n as={StyledSystemMessage}\n data-testid={testIds.userMessage}\n aria-label={ariaLabel}\n ref={ref}\n >\n {message}\n </Flex>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CoachMessageProps } from './GenAICoach.types';
|
|
2
|
+
declare const ToolConfirmationMessage: ({ tools, message, onSubmit, onCancel, toolsConfirmed }: CoachMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default ToolConfirmationMessage;
|
|
4
|
+
//# sourceMappingURL=ToolConfirmationMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolConfirmationMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/ToolConfirmationMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,QAAA,MAAM,uBAAuB,GAAI,wDAM9B,iBAAiB,4CAwBnB,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Flex, useI18n, useModalManager } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StyledToolMessageContainer, StyledToolMessage } from './GenAICoach.styles';
|
|
4
|
+
import ToolDetails from './ToolDetails';
|
|
5
|
+
const ToolConfirmationMessage = ({ tools, message, onSubmit, onCancel, toolsConfirmed = false }) => {
|
|
6
|
+
const { create } = useModalManager();
|
|
7
|
+
const t = useI18n();
|
|
8
|
+
return (_jsxs(Flex, { as: StyledToolMessageContainer, container: { direction: 'column' }, children: [_jsx(StyledToolMessage, { children: message }), _jsx(Flex, { container: { justify: 'center', pad: 1 }, children: _jsx(Button, { variant: 'link', onClick: () => {
|
|
9
|
+
if (tools)
|
|
10
|
+
create(ToolDetails, {
|
|
11
|
+
tools,
|
|
12
|
+
onSubmit,
|
|
13
|
+
onCancel,
|
|
14
|
+
toolsConfirmed
|
|
15
|
+
});
|
|
16
|
+
}, children: t('review_label') }) })] }));
|
|
17
|
+
};
|
|
18
|
+
export default ToolConfirmationMessage;
|
|
19
|
+
//# sourceMappingURL=ToolConfirmationMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolConfirmationMessage.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/ToolConfirmationMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGjF,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,uBAAuB,GAAG,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,cAAc,GAAG,KAAK,EACJ,EAAE,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IACrC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,0BAA0B,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aACtE,KAAC,iBAAiB,cAAE,OAAO,GAAqB,EAChD,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,YAC5C,KAAC,MAAM,IACL,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,IAAI,KAAK;4BACP,MAAM,CAAC,WAAW,EAAE;gCAClB,KAAK;gCACL,QAAQ;gCACR,QAAQ;gCACR,cAAc;6BACf,CAAC,CAAC;oBACP,CAAC,YAEA,CAAC,CAAC,cAAc,CAAC,GACX,GACJ,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC","sourcesContent":["import { Button, Flex, useI18n, useModalManager } from '@pega/cosmos-react-core';\n\nimport type { CoachMessageProps } from './GenAICoach.types';\nimport { StyledToolMessageContainer, StyledToolMessage } from './GenAICoach.styles';\nimport ToolDetails from './ToolDetails';\n\nconst ToolConfirmationMessage = ({\n tools,\n message,\n onSubmit,\n onCancel,\n toolsConfirmed = false\n}: CoachMessageProps) => {\n const { create } = useModalManager();\n const t = useI18n();\n return (\n <Flex as={StyledToolMessageContainer} container={{ direction: 'column' }}>\n <StyledToolMessage>{message}</StyledToolMessage>\n <Flex container={{ justify: 'center', pad: 1 }}>\n <Button\n variant='link'\n onClick={() => {\n if (tools)\n create(ToolDetails, {\n tools,\n onSubmit,\n onCancel,\n toolsConfirmed\n });\n }}\n >\n {t('review_label')}\n </Button>\n </Flex>\n </Flex>\n );\n};\n\nexport default ToolConfirmationMessage;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OmitStrict } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { ToolDetailsProps } from './GenAICoach.types';
|
|
3
|
+
declare const ToolDetails: ({ tools: toolProps, onSubmit, onCancel, toolsConfirmed }: OmitStrict<ToolDetailsProps, "isToolConfirmation">) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ToolDetails;
|
|
5
|
+
//# sourceMappingURL=ToolDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolDetails.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/ToolDetails.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAQ,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AA+IjF,QAAA,MAAM,WAAW,GAAI,0DAKlB,UAAU,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,4CAgHpD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Button, Flex, FormField, Grid, Input, Modal, MultiStepForm, RadioButton, RadioButtonGroup, Text, useI18n, useModalContext, useUID } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledConfirmationMsg } from './GenAICoach.styles';
|
|
5
|
+
const CurrentToolContent = ({ tool, baseToolDetails, onDecisionChange, onParameterChange, setHasError, toolsConfirmed }) => {
|
|
6
|
+
const t = useI18n();
|
|
7
|
+
const { decision = 'approve' } = tool;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (tool.decision === 'modify' && tool.parameters) {
|
|
10
|
+
const hasEmptyParam = tool.parameters.some(param => !param.value);
|
|
11
|
+
setHasError?.(hasEmptyParam);
|
|
12
|
+
}
|
|
13
|
+
}, [tool.parameters, tool.decision]);
|
|
14
|
+
const id = useUID();
|
|
15
|
+
const accept = 'accept';
|
|
16
|
+
const modify = 'modify';
|
|
17
|
+
const reject = 'reject';
|
|
18
|
+
return (_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(FormField, { label: t('current_action'), readOnly: true, children: _jsx(StyledConfirmationMsg, { content: tool.message, type: 'markdown' }) }), _jsxs(RadioButtonGroup, { name: 'decision', label: t('tool_decision'), required: true, inline: true, onChange: (e) => {
|
|
19
|
+
if (e.target.checked) {
|
|
20
|
+
const value = e.target.value;
|
|
21
|
+
if (value === accept || value === modify || value === reject) {
|
|
22
|
+
onDecisionChange?.(tool.id, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, readOnly: toolsConfirmed, children: [_jsx(RadioButton, { label: t('accept'), checked: decision === 'accept', id: `${id}-${accept}-${tool.id}`, value: accept }), _jsx(RadioButton, { label: t('modify'), checked: decision === 'modify', id: `${id}-${modify}-${tool.id}`, value: modify }), _jsx(RadioButton, { label: t('reject'), checked: decision === 'reject', id: `${id}-${reject}-${tool.id}`, value: reject })] }), tool.decision === modify && tool.parameters && (_jsxs(Flex, { container: { direction: 'column' }, children: [_jsx(Text, { variant: 'h2', children: t('modify_details') }), _jsx(Grid, { container: { gap: 1, cols: 'repeat(2, minmax(0, 1fr))' }, children: tool.parameters.map(param => {
|
|
26
|
+
const baseParamInfo = baseToolDetails?.parameters?.find(currentParam => currentParam.id === param.id);
|
|
27
|
+
const info = baseParamInfo ? t('current_details', [baseParamInfo.value]) : undefined;
|
|
28
|
+
if (param.type === 'text' || param.type === 'number') {
|
|
29
|
+
return (_jsx(Input, { required: true, label: param.label, defaultValue: param.value, readOnly: toolsConfirmed, type: param.type, status: !param.value ? 'error' : undefined, info: !param.value ? t('value_cannot_be_blank') : info, onChange: e => {
|
|
30
|
+
onParameterChange?.(tool.id, param.id, e.target.value);
|
|
31
|
+
} }, param.id));
|
|
32
|
+
}
|
|
33
|
+
if (param.type === 'boolean') {
|
|
34
|
+
return (_jsxs(RadioButtonGroup, { name: param.label, label: param.label, required: true, inline: true, onChange: (e) => {
|
|
35
|
+
if (e.target.checked) {
|
|
36
|
+
onParameterChange?.(tool.id, param.id, e.target.value);
|
|
37
|
+
}
|
|
38
|
+
}, readOnly: toolsConfirmed, info: !toolsConfirmed ? info : undefined, children: [_jsx(RadioButton, { label: t('true'), checked: param.value === 'true', id: `${id}-true`, value: 'true' }), _jsx(RadioButton, { label: t('false'), checked: param.value === 'false', id: `${id}-false`, value: 'false' })] }));
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}) })] }))] }));
|
|
42
|
+
};
|
|
43
|
+
const ToolDetails = ({ tools: toolProps, onSubmit, onCancel, toolsConfirmed }) => {
|
|
44
|
+
const t = useI18n();
|
|
45
|
+
const { dismiss } = useModalContext();
|
|
46
|
+
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
|
47
|
+
const finalStep = currentStepIndex === (toolProps ? toolProps.length - 1 : 0);
|
|
48
|
+
const [tools, setTools] = useState(toolProps || []);
|
|
49
|
+
const [hasError, setHasError] = useState(false);
|
|
50
|
+
const handleDecisionChange = (toolId, currentDecision) => {
|
|
51
|
+
setTools(prevTools => prevTools.map(tool => (tool.id === toolId ? { ...tool, decision: currentDecision } : tool)));
|
|
52
|
+
};
|
|
53
|
+
const handleParameterChange = (toolId, parameterId, currentVal) => {
|
|
54
|
+
setTools(prevTools => prevTools.map(tool => {
|
|
55
|
+
if (tool.id === toolId && tool.parameters) {
|
|
56
|
+
const updatedParameters = tool.parameters.map(param => param.id === parameterId ? { ...param, value: currentVal } : param);
|
|
57
|
+
return { ...tool, parameters: updatedParameters };
|
|
58
|
+
}
|
|
59
|
+
return tool;
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
const stepActions = useMemo(() => {
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => {
|
|
64
|
+
if (!toolsConfirmed)
|
|
65
|
+
onCancel?.();
|
|
66
|
+
dismiss();
|
|
67
|
+
}, children: toolsConfirmed ? t('close') : t('cancel') }), currentStepIndex > 0 && (_jsx(Button, { onClick: () => {
|
|
68
|
+
if (!hasError)
|
|
69
|
+
setCurrentStepIndex(currentStepIndex - 1);
|
|
70
|
+
}, children: t('previous') }))] }), _jsxs(_Fragment, { children: [!finalStep && (_jsx(Button, { variant: 'primary', onClick: () => {
|
|
71
|
+
if (!hasError)
|
|
72
|
+
setCurrentStepIndex(currentStepIndex + 1);
|
|
73
|
+
}, children: t('pagination_next') })), finalStep && !toolsConfirmed && (_jsx(Button, { type: 'submit', variant: 'primary', onClick: () => {
|
|
74
|
+
if (!hasError) {
|
|
75
|
+
if (tools)
|
|
76
|
+
onSubmit?.(tools);
|
|
77
|
+
dismiss();
|
|
78
|
+
}
|
|
79
|
+
}, children: t('submit') }))] })] }));
|
|
80
|
+
}, [currentStepIndex, hasError, tools]);
|
|
81
|
+
const stepData = useMemo(() => {
|
|
82
|
+
return tools.map(tool => ({
|
|
83
|
+
id: tool.id,
|
|
84
|
+
name: tool.name,
|
|
85
|
+
content: (_jsx(CurrentToolContent, { tool: tool, baseToolDetails: toolProps?.find(toolVal => toolVal.id === tool.id), setHasError: setHasError, toolsConfirmed: toolsConfirmed, onDecisionChange: handleDecisionChange, onParameterChange: handleParameterChange }))
|
|
86
|
+
}));
|
|
87
|
+
}, [tools]);
|
|
88
|
+
return (_jsx(Modal, { heading: t('confirm_details'), actions: stepActions, children: _jsx(MultiStepForm, { steps: stepData, currentStepId: stepData[currentStepIndex].id, stepIndicator: 'horizontal' }) }));
|
|
89
|
+
};
|
|
90
|
+
export default ToolDetails;
|
|
91
|
+
//# sourceMappingURL=ToolDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolDetails.js","sour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;oCAC7B,OAAO,EAAE,CAAC;gCACZ,CAAC;4BACH,CAAC,YAEA,CAAC,CAAC,QAAQ,CAAC,GACL,CACV,IACA,IACF,CACJ,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAExC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,CACP,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,EACnE,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,oBAAoB,EACtC,iBAAiB,EAAE,qBAAqB,GACxC,CACH;SACF,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,KAAC,KAAK,IAAC,OAAO,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,WAAW,YACxD,KAAC,aAAa,IACZ,KAAK,EAAE,QAAQ,EACf,aAAa,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAC5C,aAAa,EAAC,YAAY,GAC1B,GACI,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport type { ChangeEvent, Dispatch, SetStateAction } from 'react';\n\nimport {\n Button,\n Flex,\n FormField,\n Grid,\n Input,\n Modal,\n MultiStepForm,\n RadioButton,\n RadioButtonGroup,\n Text,\n useI18n,\n useModalContext,\n useUID\n} from '@pega/cosmos-react-core';\nimport type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport type { Tool, ToolDetailsProps, ToolParameters } from './GenAICoach.types';\nimport { StyledConfirmationMsg } from './GenAICoach.styles';\n\nconst CurrentToolContent = ({\n tool,\n baseToolDetails,\n onDecisionChange,\n onParameterChange,\n setHasError,\n toolsConfirmed\n}: {\n tool: Tool;\n baseToolDetails?: Tool;\n toolsConfirmed?: boolean;\n setHasError?: Dispatch<SetStateAction<boolean>>;\n onDecisionChange: (toolId: Tool['id'], currentDecision: Tool['decision']) => void;\n onParameterChange?: (\n toolId: Tool['id'],\n parameterId: ToolParameters['id'],\n currentVal: ToolParameters['value']\n ) => void;\n}) => {\n const t = useI18n();\n const { decision = 'approve' } = tool;\n\n useEffect(() => {\n if (tool.decision === 'modify' && tool.parameters) {\n const hasEmptyParam = tool.parameters.some(param => !param.value);\n\n setHasError?.(hasEmptyParam);\n }\n }, [tool.parameters, tool.decision]);\n\n const id = useUID();\n const accept = 'accept';\n const modify = 'modify';\n const reject = 'reject';\n return (\n <Flex container={{ direction: 'column', gap: 1 }}>\n <FormField label={t('current_action')} readOnly>\n <StyledConfirmationMsg content={tool.message} type='markdown' />\n </FormField>\n\n <RadioButtonGroup\n name='decision'\n label={t('tool_decision')}\n required\n inline\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n const value = e.target.value;\n if (value === accept || value === modify || value === reject) {\n onDecisionChange?.(tool.id, value);\n }\n }\n }}\n readOnly={toolsConfirmed}\n >\n <RadioButton\n label={t('accept')}\n checked={decision === 'accept'}\n id={`${id}-${accept}-${tool.id}`}\n value={accept}\n />\n <RadioButton\n label={t('modify')}\n checked={decision === 'modify'}\n id={`${id}-${modify}-${tool.id}`}\n value={modify}\n />\n <RadioButton\n label={t('reject')}\n checked={decision === 'reject'}\n id={`${id}-${reject}-${tool.id}`}\n value={reject}\n />\n </RadioButtonGroup>\n\n {tool.decision === modify && tool.parameters && (\n <Flex container={{ direction: 'column' }}>\n <Text variant='h2'>{t('modify_details')}</Text>\n <Grid container={{ gap: 1, cols: 'repeat(2, minmax(0, 1fr))' }}>\n {tool.parameters.map(param => {\n const baseParamInfo = baseToolDetails?.parameters?.find(\n currentParam => currentParam.id === param.id\n );\n const info = baseParamInfo ? t('current_details', [baseParamInfo.value]) : undefined;\n if (param.type === 'text' || param.type === 'number') {\n return (\n <Input\n key={param.id}\n required\n label={param.label}\n defaultValue={param.value}\n readOnly={toolsConfirmed}\n type={param.type}\n status={!param.value ? 'error' : undefined}\n info={!param.value ? t('value_cannot_be_blank') : info}\n onChange={e => {\n onParameterChange?.(tool.id, param.id, e.target.value);\n }}\n />\n );\n }\n if (param.type === 'boolean') {\n return (\n <RadioButtonGroup\n name={param.label}\n label={param.label}\n required\n inline\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n onParameterChange?.(tool.id, param.id, e.target.value);\n }\n }}\n readOnly={toolsConfirmed}\n info={!toolsConfirmed ? info : undefined}\n >\n <RadioButton\n label={t('true')}\n checked={param.value === 'true'}\n id={`${id}-true`}\n value='true'\n />\n <RadioButton\n label={t('false')}\n checked={param.value === 'false'}\n id={`${id}-false`}\n value='false'\n />\n </RadioButtonGroup>\n );\n }\n return null;\n })}\n </Grid>\n </Flex>\n )}\n </Flex>\n );\n};\n\nconst ToolDetails = ({\n tools: toolProps,\n onSubmit,\n onCancel,\n toolsConfirmed\n}: OmitStrict<ToolDetailsProps, 'isToolConfirmation'>) => {\n const t = useI18n();\n const { dismiss } = useModalContext();\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const finalStep = currentStepIndex === (toolProps ? toolProps.length - 1 : 0);\n\n const [tools, setTools] = useState<Tool[]>(toolProps || []);\n const [hasError, setHasError] = useState(false);\n\n const handleDecisionChange = (toolId: Tool['id'], currentDecision: Tool['decision']) => {\n setTools(prevTools =>\n prevTools.map(tool => (tool.id === toolId ? { ...tool, decision: currentDecision } : tool))\n );\n };\n\n const handleParameterChange = (\n toolId: Tool['id'],\n parameterId: ToolParameters['id'],\n currentVal: ToolParameters['value']\n ) => {\n setTools(prevTools =>\n prevTools.map(tool => {\n if (tool.id === toolId && tool.parameters) {\n const updatedParameters = tool.parameters.map(param =>\n param.id === parameterId ? { ...param, value: currentVal } : param\n );\n return { ...tool, parameters: updatedParameters };\n }\n return tool;\n })\n );\n };\n\n const stepActions = useMemo(() => {\n return (\n <>\n <>\n <Button\n onClick={() => {\n if (!toolsConfirmed) onCancel?.();\n dismiss();\n }}\n >\n {toolsConfirmed ? t('close') : t('cancel')}\n </Button>\n {currentStepIndex > 0 && (\n <Button\n onClick={() => {\n if (!hasError) setCurrentStepIndex(currentStepIndex - 1);\n }}\n >\n {t('previous')}\n </Button>\n )}\n </>\n\n <>\n {!finalStep && (\n <Button\n variant='primary'\n onClick={() => {\n if (!hasError) setCurrentStepIndex(currentStepIndex + 1);\n }}\n >\n {t('pagination_next')}\n </Button>\n )}\n {finalStep && !toolsConfirmed && (\n <Button\n type='submit'\n variant='primary'\n onClick={() => {\n if (!hasError) {\n if (tools) onSubmit?.(tools);\n dismiss();\n }\n }}\n >\n {t('submit')}\n </Button>\n )}\n </>\n </>\n );\n }, [currentStepIndex, hasError, tools]);\n\n const stepData = useMemo(() => {\n return tools.map(tool => ({\n id: tool.id,\n name: tool.name,\n content: (\n <CurrentToolContent\n tool={tool}\n baseToolDetails={toolProps?.find(toolVal => toolVal.id === tool.id)}\n setHasError={setHasError}\n toolsConfirmed={toolsConfirmed}\n onDecisionChange={handleDecisionChange}\n onParameterChange={handleParameterChange}\n />\n )\n }));\n }, [tools]);\n\n return (\n <Modal heading={t('confirm_details')} actions={stepActions}>\n <MultiStepForm\n steps={stepData}\n currentStepId={stepData[currentStepIndex].id}\n stepIndicator='horizontal'\n />\n </Modal>\n );\n};\n\nexport default ToolDetails;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssignmentItem.d.ts","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAc,MAAM,OAAO,CAAC;AAgC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAQxE,UAAU,mBAAoB,SAAQ,eAAe;IACnD,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"AssignmentItem.d.ts","sourceRoot":"","sources":["../../../../src/components/HierarchicalAssignments/nodeItems/AssignmentItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAc,MAAM,OAAO,CAAC;AAgC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAQxE,UAAU,mBAAoB,SAAQ,eAAe;IACnD,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAOlE,CAAC;gJAeC,mBAAmB;;;AA0NtB,wBAAiE"}
|
|
@@ -11,6 +11,9 @@ import useNodeFocus from './useNodeFocus';
|
|
|
11
11
|
const StyledHiddenText = styled(VisuallyHiddenText) `
|
|
12
12
|
width: 0;
|
|
13
13
|
`;
|
|
14
|
+
const StyledVisuallyHiddenText = styled(VisuallyHiddenText) `
|
|
15
|
+
position: fixed;
|
|
16
|
+
`;
|
|
14
17
|
export const PauseTextNode = ({ children }) => {
|
|
15
18
|
return (_jsxs(_Fragment, { children: [children, _jsx(StyledHiddenText, { children: ", " })] }));
|
|
16
19
|
};
|
|
@@ -94,7 +97,7 @@ const AssignmentItem = ({ name, processName, assigneeName, urgency, sla, depth,
|
|
|
94
97
|
cols: isMediumOrAbove ? '2fr 2fr auto' : '2fr 0.5fr',
|
|
95
98
|
colGap: isMediumOrAbove ? 3 : 0,
|
|
96
99
|
rows: isMediumOrAbove ? 'repeat(1, auto)' : 'repeat(2, auto)'
|
|
97
|
-
}, as: StyledAssignmentItem, children: [_jsx(
|
|
100
|
+
}, as: StyledAssignmentItem, children: [_jsx(StyledVisuallyHiddenText, { children: `${t('assignment_announcement_label')}` }), _jsx(Flex, { "data-testid": testIds.label, container: { alignItems: 'center' }, as: StyledProcessContainer, depth: styledElementDepth, children: _jsx(PauseTextNode, { children: _jsx(AssignmentDetails, { processName: processName, name: name }) }) }), _jsx(Flex, { "data-testid": testIds.assignee, container: { justify: isMediumOrAbove ? 'end' : 'start' }, as: StyledAssigneeContainer, isMediumOrAbove: isMediumOrAbove, depth: styledElementDepth, variant: 'secondary', children: _jsx(StyledAssignmentItemMetaList, { wrapItems: true, isMediumOrAbove: isMediumOrAbove, items: [
|
|
98
101
|
_jsxs(_Fragment, { children: [_jsx(StyledAssigneeText, { onClick: (e) => {
|
|
99
102
|
onAssigneeClick(assigneeId, e);
|
|
100
103
|
}, variant: 'link', ref: setAssigneeElement, "data-testid": testIds.assignee, tabIndex: childElementsTabIndex, isMediumOrAbove: isMediumOrAbove, children: _jsx(PauseTextNode, { children: assigneeName }) }), _jsx(Tooltip, { target: assigneeEl, smart: true, children: assigneeName })] }),
|