@pega/cosmos-react-work 8.8.0 → 8.9.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/ArticleList/ArticleBuddy.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddy.js +5 -1
- package/lib/components/ArticleList/ArticleBuddy.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +15 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.d.ts +1 -0
- package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.js +54 -31
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +12 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +71 -6
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +15 -0
- package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAIMessage.js +9 -44
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts +4 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.d.ts.map +1 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.js +92 -0
- package/lib/components/GenAICoach/GenAIMessageFeedback.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleBuddy.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAgB9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArticleBuddy.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAgB9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,eAAO,MAAM,oBAAoB,yGAUhC,CAAC;AAQF,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAuHrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { Flex, defaultThemeProp, useI18n, Button, useLiveLog, TextArea, AIButton, Progress, getFocusables, MenuButton, AdditionalInfo } from '@pega/cosmos-react-core';
|
|
5
|
+
import GenAICoach from '../GenAICoach';
|
|
5
6
|
import ArticleBuddyResponse from './ArticleBuddyResponse';
|
|
6
7
|
export const StyledQueryContainer = styled.div(({ theme: { base: { spacing } } }) => {
|
|
7
8
|
return css `
|
|
@@ -12,7 +13,7 @@ StyledQueryContainer.defaultProps = defaultThemeProp;
|
|
|
12
13
|
const StyledBuddyContainer = styled(Flex) `
|
|
13
14
|
height: 100%;
|
|
14
15
|
`;
|
|
15
|
-
const ArticleBuddy = ({ query, onClear, onSubmit, buddyOptions, response, list, loading, ...restProps }) => {
|
|
16
|
+
const ArticleBuddy = ({ query, onClear, onSubmit, buddyOptions, response, list, loading, renderAgent, agentOptions, ...restProps }) => {
|
|
16
17
|
const t = useI18n();
|
|
17
18
|
const buddyRef = useRef(null);
|
|
18
19
|
const queryRef = useRef(null);
|
|
@@ -34,6 +35,9 @@ const ArticleBuddy = ({ query, onClear, onSubmit, buddyOptions, response, list,
|
|
|
34
35
|
queryRef.current?.focus();
|
|
35
36
|
}
|
|
36
37
|
}, [response?.content, loading, announceResult]);
|
|
38
|
+
if (renderAgent) {
|
|
39
|
+
return (_jsx(Flex, { ...restProps, ref: buddyRef, container: { direction: 'column' }, as: StyledBuddyContainer, children: _jsx(GenAICoach, { ...agentOptions }) }));
|
|
40
|
+
}
|
|
37
41
|
return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, ref: buddyRef, "aria-busy": loading, as: StyledBuddyContainer, children: [_jsxs(Flex, { as: StyledQueryContainer, container: { direction: 'column', gap: 1 }, children: [buddyOptions && (_jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(MenuButton, { ...buddyOptions.list, ...(buddyOptions.list.contextualLabel && {
|
|
38
42
|
'aria-label': buddyOptions.list.contextualLabel
|
|
39
43
|
}) }), buddyOptions.buddyInfo?.title && (_jsx(AdditionalInfo, { heading: buddyOptions.buddyInfo.title, children: buddyOptions.buddyInfo.description }))] })), _jsx(TextArea, { ...query, "aria-label": query.placeholder || t('ask_buddy'), ref: queryRef, autoResize: false, onKeyDown: (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleBuddy.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleBuddy.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,yBAAyB,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1B,OAAO,EAAE,GAAG,EAAE;oCACZ,iBAAiB,CAAC,IAAI,CAAC,CAAC;oCACxB,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;oCAC1B,QAAQ,EAAE,CAAC;gCACb,CAAC,GACD,IACG,IACF,EAEP,KAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,cAAc,SAAG,EAEvF,CAAC,OAAO,IAAI,QAAQ,IAAI,KAAC,oBAAoB,OAAK,QAAQ,GAAI,IAC1D,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { FunctionComponent, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n defaultThemeProp,\n useI18n,\n Button,\n useLiveLog,\n TextArea,\n AIButton,\n Progress,\n getFocusables,\n MenuButton,\n AdditionalInfo\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\n\nimport GenAICoach from '../GenAICoach';\n\nimport type { ArticleBuddyProps } from './ArticleList.types';\nimport ArticleBuddyResponse from './ArticleBuddyResponse';\n\nexport const StyledQueryContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n padding: calc(2 * ${spacing});\n `;\n }\n);\n\nStyledQueryContainer.defaultProps = defaultThemeProp;\n\nconst StyledBuddyContainer = styled(Flex)`\n height: 100%;\n`;\n\nconst ArticleBuddy: FunctionComponent<ArticleBuddyProps & ForwardProps> = ({\n query,\n onClear,\n onSubmit,\n buddyOptions,\n response,\n list,\n loading,\n renderAgent,\n agentOptions,\n ...restProps\n}) => {\n const t = useI18n();\n const buddyRef = useRef<HTMLDivElement>(null);\n const queryRef = useRef<HTMLTextAreaElement>(null);\n const { announcePolite } = useLiveLog();\n const [announceResult, setannounceResult] = useState(false);\n\n useEffect(() => {\n const focusables = getFocusables(buddyRef);\n if (focusables.length > 0) {\n focusables[0].focus();\n }\n }, []);\n\n useEffect(() => {\n if (response?.content && !loading && announceResult) {\n announcePolite({\n message: t('result_available'),\n type: 'acknowledgement'\n });\n setannounceResult(false);\n queryRef.current?.focus();\n }\n }, [response?.content, loading, announceResult]);\n\n if (renderAgent) {\n return (\n <Flex\n {...restProps}\n ref={buddyRef}\n container={{ direction: 'column' }}\n as={StyledBuddyContainer}\n >\n <GenAICoach {...agentOptions} />\n </Flex>\n );\n }\n\n return (\n <Flex\n {...restProps}\n container={{ direction: 'column' }}\n ref={buddyRef}\n aria-busy={loading}\n as={StyledBuddyContainer}\n >\n <Flex as={StyledQueryContainer} container={{ direction: 'column', gap: 1 }}>\n {buddyOptions && (\n <Flex container={{ gap: 0.5 }}>\n <MenuButton\n {...buddyOptions.list}\n {...(buddyOptions.list.contextualLabel && {\n 'aria-label': buddyOptions.list.contextualLabel\n })}\n />\n {buddyOptions.buddyInfo?.title && (\n <AdditionalInfo heading={buddyOptions.buddyInfo.title}>\n {buddyOptions.buddyInfo.description}\n </AdditionalInfo>\n )}\n </Flex>\n )}\n\n <TextArea\n {...query}\n aria-label={query.placeholder || t('ask_buddy')}\n ref={queryRef}\n autoResize={false}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (query.value?.trim()) {\n setannounceResult(true);\n onSubmit();\n }\n }\n }}\n />\n\n <Flex container={{ gap: 1, justify: 'end' }}>\n {query.value && onClear && (\n <Button\n variant='link'\n onClick={() => {\n onClear();\n }}\n >\n {t('clear')}\n </Button>\n )}\n <AIButton\n label={t('ask')}\n disabled={loading}\n aria-label={t('ask_buddy')}\n onClick={() => {\n setannounceResult(true);\n queryRef.current?.focus();\n onSubmit();\n }}\n />\n </Flex>\n </Flex>\n\n <Progress visible={!!loading} placement='block' message={t('loading')} focusOnVisible />\n\n {!loading && response && <ArticleBuddyResponse {...response} />}\n </Flex>\n );\n};\n\nexport default ArticleBuddy;\n"]}
|
|
@@ -4,6 +4,7 @@ import type { SearchFilter } from '@pega/cosmos-react-core/lib/components/Search
|
|
|
4
4
|
import type { ArticleRatingProps } from '../Article/ArticleRating';
|
|
5
5
|
import type { ArticleMetaProps } from '../Article/ArticleMeta';
|
|
6
6
|
import type { ArticleProps } from '../Article/Article';
|
|
7
|
+
import type { GenAICoachProps } from '../GenAICoach';
|
|
7
8
|
import type { RelatedQuestionsProps } from './RelatedQuestions';
|
|
8
9
|
export interface ArticleSummaryProps extends BaseProps {
|
|
9
10
|
/** Unique id of article */
|
|
@@ -120,7 +121,9 @@ export interface ArticleBuddyListProps extends MenuButtonProps {
|
|
|
120
121
|
/** Aria label for screen readers. */
|
|
121
122
|
contextualLabel?: string;
|
|
122
123
|
}
|
|
123
|
-
export interface
|
|
124
|
+
export interface ArticleBuddyStandardProps {
|
|
125
|
+
renderAgent?: false;
|
|
126
|
+
agentOptions?: never;
|
|
124
127
|
query: Required<Pick<TextAreaProps, 'label' | 'value' | 'placeholder' | 'onChange'>> & Pick<TextAreaProps, 'labelHidden'>;
|
|
125
128
|
buddyOptions?: {
|
|
126
129
|
list: ArticleBuddyListProps;
|
|
@@ -134,6 +137,17 @@ export interface ArticleBuddyProps {
|
|
|
134
137
|
loading?: boolean;
|
|
135
138
|
response?: BuddyResponseProps;
|
|
136
139
|
}
|
|
140
|
+
export interface ArticleBuddyAgentProps {
|
|
141
|
+
renderAgent: true;
|
|
142
|
+
agentOptions: OmitStrict<GenAICoachProps, 'initialSuggestedMessages' | 'attachments' | 'attachmentsError' | 'onAddAttachment' | 'lightboxPreviewProps'>;
|
|
143
|
+
query?: never;
|
|
144
|
+
buddyOptions?: never;
|
|
145
|
+
onSubmit?: never;
|
|
146
|
+
onClear?: never;
|
|
147
|
+
loading?: never;
|
|
148
|
+
response?: never;
|
|
149
|
+
}
|
|
150
|
+
export type ArticleBuddyProps = ArticleBuddyStandardProps | ArticleBuddyAgentProps;
|
|
137
151
|
export declare const isExternalLink: (reference: Reference) => reference is ExternalLinkProps;
|
|
138
152
|
export declare const isInternalArticle: (reference: Reference) => reference is InternalArticleProps;
|
|
139
153
|
export interface Articles {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleList.types.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,eAAe,EACf,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gEAAgE,CAAC;AAEnG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ArticleList.types.d.ts","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,eAAe,EACf,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gEAA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EAEpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,KAAK,QAAQ,GAAG,sBAAsB,GAAG,SAAS,KACjD,GAAG,IAAI,sBAET,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleList.types.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"AA4LA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAkC,EAAE;IACrF,OAAO,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC3F,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,CAAC;AACrC,CAAC,CAAC;AAkJF,MAAM,UAAU,eAAe,CAC7B,IAAiD;IAEjD,OAAO,UAAU,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,SAA0D,EACpB,EAAE;IACxC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAkD,EACnB,EAAE;IACjC,OAAQ,GAA8B,EAAE,cAAc,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import type { MouseEvent, MouseEventHandler, ReactNode, KeyboardEvent } from 'react';\n\nimport type {\n ActionsProps,\n AdditionalInfoProps,\n BaseProps,\n ComboBoxProps,\n MenuButtonProps,\n MenuProps,\n NoChildrenProp,\n NumberDisplayProps,\n OmitStrict,\n RequireAtLeastOne,\n SearchInputProps,\n TextAreaProps,\n WithAttributes\n} from '@pega/cosmos-react-core';\nimport type { SearchFilter } from '@pega/cosmos-react-core/lib/components/SearchInput/SearchInput';\n\nimport type { ArticleRatingProps } from '../Article/ArticleRating';\nimport type { ArticleMetaProps } from '../Article/ArticleMeta';\nimport type { ArticleProps } from '../Article/Article';\n\nimport type { RelatedQuestionsProps } from './RelatedQuestions';\n\nexport interface ArticleSummaryProps extends BaseProps {\n /** Unique id of article */\n articleId: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Article title */\n title: string;\n /** Article content */\n abstract: string;\n /** Callback fired when article title is clicked */\n onTitleClick?: (id?: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** Primary actions which needs to be displayed with an icon */\n actions?: ActionsProps;\n /** A list of elements to be rendered within a MetaList. */\n meta?: ArticleMetaProps;\n /** Rating - likes and dislikes of the article. */\n feedback?: OmitStrict<ArticleRatingProps, 'onReaction'> & {\n onReaction: (\n articleId: ArticleSummaryProps['articleId'],\n reaction: ArticleRatingProps['reaction']\n ) => void;\n };\n /** Quick filters to filter articles. */\n quickFilters?: QuickFilter[];\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: ArticleListProps['onQuickFilterClick'];\n}\n\nexport type AIArticleSummaryProps = WithAttributes<\n 'li',\n NoChildrenProp & {\n score?: NumberDisplayProps['value'];\n /**\n * Indicates whether semantic search functionality to be used.\n * @default false\n */\n semanticSearch: boolean;\n abstract?: ArticleSummaryProps['abstract'];\n } & Pick<\n ArticleSummaryProps,\n | 'articleId'\n | 'href'\n | 'title'\n | 'onTitleClick'\n | 'actions'\n | 'quickFilters'\n | 'onQuickFilterClick'\n >\n>;\n\nexport type SearchArticle = AIArticleSummaryProps | ArticleSummaryProps;\n\nexport interface BaseReferenceProps {\n id: string;\n name: string;\n confidence?: number;\n}\n\nexport type ExternalLinkProps = BaseReferenceProps & { type: 'link'; href: string };\n\nexport type InternalArticleProps = BaseReferenceProps & {\n type: 'object';\n onClick: (id: BaseReferenceProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n};\n\ntype Reference = ExternalLinkProps | InternalArticleProps;\n\n/** Handles reaction */\nexport type Reaction = 'liked' | 'disliked' | undefined;\n\nexport type ArticleFeedbackProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n /** Question to be displayed */\n question: string;\n /** Handles reaction */\n reaction: Reaction;\n /** Callback to handle reaction */\n onReaction: (reaction: Reaction) => void;\n /** Handles comment section */\n comment?: Required<Pick<TextAreaProps, 'value' | 'placeholder' | 'onChange' | 'labelHidden'>>;\n /** Callback on the click of submit */\n onSubmit?: (\n feedback: { reaction: Reaction; comment: string },\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void;\n /**\n * Sets the visibility of acknowledgement text\n * @default false\n */\n showThankYouMessage?: boolean;\n }\n>;\n\nexport interface BuddyResponseProps {\n /** title of the search content */\n title?: string;\n /** Main body of search content */\n content?: ReactNode;\n /** Action for share and copy */\n actions?: ActionsProps;\n /** References with confidence level */\n references?: Reference[];\n /** Disclaimer for the genAI response */\n disclaimer?: string;\n /** back button from the response */\n backNavigation?: ArticleProps['backNavigation'];\n /**\n * error state\n * @default false\n */\n error?: boolean;\n /** Feedback for buddy response */\n feedback?: ArticleFeedbackProps;\n /** Recent search suggestion from buddy */\n relatedQuestions?: RelatedQuestionsProps;\n}\n\nexport interface AutoAnsweredItem {\n id: string;\n query: string;\n onTitleClick: (id: string) => void;\n actions?: ActionsProps;\n abstract: string;\n}\n\nexport interface DetectedItem extends OmitStrict<AutoAnsweredItem, 'abstract'> {\n confidence?: number;\n}\n\nexport type BuddySuggestedArticlesProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n autoAnswered?: AutoAnsweredItem[];\n detected?: DetectedItem[];\n pastQuestions?: string[];\n notRelevantQuestions?: string[];\n showMore?: boolean;\n onShowMoreToggle?: () => void;\n }\n>;\n\nexport interface ArticleBuddyListProps extends MenuButtonProps {\n /** Aria label for screen readers. */\n contextualLabel?: string;\n}\n\nexport interface ArticleBuddyProps {\n query: Required<Pick<TextAreaProps, 'label' | 'value' | 'placeholder' | 'onChange'>> &\n Pick<TextAreaProps, 'labelHidden'>;\n buddyOptions?: {\n list: ArticleBuddyListProps;\n buddyInfo?: {\n title: AdditionalInfoProps['heading'];\n description: AdditionalInfoProps['children'];\n };\n };\n onSubmit: () => void;\n onClear: () => void;\n loading?: boolean;\n response?: BuddyResponseProps;\n}\n\nexport const isExternalLink = (reference: Reference): reference is ExternalLinkProps => {\n return reference.type === 'link';\n};\n\nexport const isInternalArticle = (reference: Reference): reference is InternalArticleProps => {\n return reference.type === 'object';\n};\n\nexport interface Articles {\n /** List of articles */\n articles: ArticleSummaryProps[];\n /** count of articles */\n count?: number;\n /** Active article if one is open/selected */\n activeArticle?: ArticleProps | BuddyResponseProps;\n /** Props related to the Search Input. */\n searchInput: OmitStrict<\n SearchInputProps,\n 'searchResults' | 'recentSearches' | 'advancedSearchLink' | 'resultsPopover'\n > & {\n searchFilter?: MenuButtonProps;\n filterInfo?: {\n title: AdditionalInfoProps['heading'];\n description: AdditionalInfoProps['children'];\n };\n } & SearchFilter;\n /** Props related to the Category Input. */\n category?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'actions'\n | 'additionalInfo'\n >;\n\n /** Props related to the SortBy Input. */\n sortBy?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'mode'\n | 'actions'\n | 'additionalInfo'\n | 'onChange'\n | 'value'\n >;\n /** Callback fired when clear button is clicked */\n onClearClick?: MouseEventHandler<HTMLButtonElement>;\n /** Quick filters to filter articles */\n quickFilters?: QuickFilter[];\n /** Callback fired when applied quick filter is removed */\n handleQuickFilterRemove?: (id: string) => void;\n /** Prop to enable show / hide results */\n showResults?: boolean;\n}\n\nexport interface ArticleListHeaderProps {\n /** Title of article list */\n title: string;\n /** Article list header icon */\n icon?: string;\n /** Actions which needs to be displayed with an icon */\n actions?: ActionsProps;\n}\n\nexport type SemanticSearchArticles = OmitStrict<Articles, 'articles'> & {\n semanticFilter?: MenuProps;\n} & ArticleSemanticSearchProps;\n\ntype SuggestedArticles = Pick<Articles, 'count' | 'activeArticle'> & {\n articles: ArticleSummaryProps[] | BuddySuggestedArticlesProps;\n aiSuggestedArticles?: AIArticleSummaryProps[];\n};\n\nexport type ArticleListProps = RequireAtLeastOne<\n {\n /** Props related to article list header */\n header?: ArticleListHeaderProps;\n /** Data of suggested articles */\n suggested?: SuggestedArticles;\n /** Data of followed articles */\n followed?: Articles;\n /** Data of search articles */\n search?: Articles | SemanticSearchArticles;\n buddy?: {\n title: string;\n content: ArticleBuddyProps;\n };\n /** current active tab whose list has to be rendered */\n activeTab: string;\n /** Callback fired when tab is clicked */\n onTabClick?: (name: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /**\n * Optionally renders an indeterminate progress indicator while articles are being fetched.\n * @default false\n */\n loading?: boolean;\n /**\n * Optionally renders an indeterminate progress indicator while progressively fetching articles\n * @default false\n */\n loadingMore?: boolean;\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: (\n quickFilterParam: QuickFilter,\n event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>\n ) => void;\n /** Callback to fetch more rows */\n onLoadMore?: () => void;\n },\n 'suggested' | 'followed' | 'search' | 'buddy'\n>;\n\nexport interface QuickFilter {\n /** Unique id of quick Filter */\n id: string;\n /** Name of quick Filter */\n name: string;\n}\n\nexport type ArticleSemanticSearchProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n semanticSearch: boolean;\n /** list of semantic articles */\n articles?: AIArticleSummaryProps[];\n /** Handles feedback section */\n feedback?: ArticleFeedbackProps;\n /**\n * Handles error\n * @default false\n */\n error?: boolean;\n /**\n * Sets the initial message\n * @default false\n */\n initialMessage?: boolean;\n relatedQuestions?: RelatedQuestionsProps;\n }\n>;\n\nexport function isSearchArticle(\n item: AIArticleSummaryProps | ArticleSummaryProps\n): item is ArticleSummaryProps {\n return 'abstract' in item;\n}\n\nexport const isSemanticSearchArticle = (\n fileItems: (AIArticleSummaryProps | ArticleSummaryProps)[]\n): fileItems is AIArticleSummaryProps[] => {\n return fileItems.every(item => 'semanticSearch' in item);\n};\n\nexport const isSemanticSearch = (\n obj: Articles | SemanticSearchArticles | undefined\n): obj is SemanticSearchArticles => {\n return (obj as SemanticSearchArticles)?.semanticSearch;\n};\n\nexport type ArticleListTabId = 'Suggested' | 'Followed' | 'Search' | 'Buddy';\n"]}
|
|
1
|
+
{"version":3,"file":"ArticleList.types.js","sourceRoot":"","sources":["../../../src/components/ArticleList/ArticleList.types.ts"],"names":[],"mappings":"AAmNA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAoB,EAAkC,EAAE;IACrF,OAAO,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC3F,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,CAAC;AACrC,CAAC,CAAC;AAkJF,MAAM,UAAU,eAAe,CAC7B,IAAiD;IAEjD,OAAO,UAAU,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,SAA0D,EACpB,EAAE;IACxC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,GAAkD,EACnB,EAAE;IACjC,OAAQ,GAA8B,EAAE,cAAc,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import type { MouseEvent, MouseEventHandler, ReactNode, KeyboardEvent } from 'react';\n\nimport type {\n ActionsProps,\n AdditionalInfoProps,\n BaseProps,\n ComboBoxProps,\n MenuButtonProps,\n MenuProps,\n NoChildrenProp,\n NumberDisplayProps,\n OmitStrict,\n RequireAtLeastOne,\n SearchInputProps,\n TextAreaProps,\n WithAttributes\n} from '@pega/cosmos-react-core';\nimport type { SearchFilter } from '@pega/cosmos-react-core/lib/components/SearchInput/SearchInput';\n\nimport type { ArticleRatingProps } from '../Article/ArticleRating';\nimport type { ArticleMetaProps } from '../Article/ArticleMeta';\nimport type { ArticleProps } from '../Article/Article';\nimport type { GenAICoachProps } from '../GenAICoach';\n\nimport type { RelatedQuestionsProps } from './RelatedQuestions';\n\nexport interface ArticleSummaryProps extends BaseProps {\n /** Unique id of article */\n articleId: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Article title */\n title: string;\n /** Article content */\n abstract: string;\n /** Callback fired when article title is clicked */\n onTitleClick?: (id?: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** Primary actions which needs to be displayed with an icon */\n actions?: ActionsProps;\n /** A list of elements to be rendered within a MetaList. */\n meta?: ArticleMetaProps;\n /** Rating - likes and dislikes of the article. */\n feedback?: OmitStrict<ArticleRatingProps, 'onReaction'> & {\n onReaction: (\n articleId: ArticleSummaryProps['articleId'],\n reaction: ArticleRatingProps['reaction']\n ) => void;\n };\n /** Quick filters to filter articles. */\n quickFilters?: QuickFilter[];\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: ArticleListProps['onQuickFilterClick'];\n}\n\nexport type AIArticleSummaryProps = WithAttributes<\n 'li',\n NoChildrenProp & {\n score?: NumberDisplayProps['value'];\n /**\n * Indicates whether semantic search functionality to be used.\n * @default false\n */\n semanticSearch: boolean;\n abstract?: ArticleSummaryProps['abstract'];\n } & Pick<\n ArticleSummaryProps,\n | 'articleId'\n | 'href'\n | 'title'\n | 'onTitleClick'\n | 'actions'\n | 'quickFilters'\n | 'onQuickFilterClick'\n >\n>;\n\nexport type SearchArticle = AIArticleSummaryProps | ArticleSummaryProps;\n\nexport interface BaseReferenceProps {\n id: string;\n name: string;\n confidence?: number;\n}\n\nexport type ExternalLinkProps = BaseReferenceProps & { type: 'link'; href: string };\n\nexport type InternalArticleProps = BaseReferenceProps & {\n type: 'object';\n onClick: (id: BaseReferenceProps['id'], e: MouseEvent<HTMLButtonElement>) => void;\n};\n\ntype Reference = ExternalLinkProps | InternalArticleProps;\n\n/** Handles reaction */\nexport type Reaction = 'liked' | 'disliked' | undefined;\n\nexport type ArticleFeedbackProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n /** Question to be displayed */\n question: string;\n /** Handles reaction */\n reaction: Reaction;\n /** Callback to handle reaction */\n onReaction: (reaction: Reaction) => void;\n /** Handles comment section */\n comment?: Required<Pick<TextAreaProps, 'value' | 'placeholder' | 'onChange' | 'labelHidden'>>;\n /** Callback on the click of submit */\n onSubmit?: (\n feedback: { reaction: Reaction; comment: string },\n e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void;\n /**\n * Sets the visibility of acknowledgement text\n * @default false\n */\n showThankYouMessage?: boolean;\n }\n>;\n\nexport interface BuddyResponseProps {\n /** title of the search content */\n title?: string;\n /** Main body of search content */\n content?: ReactNode;\n /** Action for share and copy */\n actions?: ActionsProps;\n /** References with confidence level */\n references?: Reference[];\n /** Disclaimer for the genAI response */\n disclaimer?: string;\n /** back button from the response */\n backNavigation?: ArticleProps['backNavigation'];\n /**\n * error state\n * @default false\n */\n error?: boolean;\n /** Feedback for buddy response */\n feedback?: ArticleFeedbackProps;\n /** Recent search suggestion from buddy */\n relatedQuestions?: RelatedQuestionsProps;\n}\n\nexport interface AutoAnsweredItem {\n id: string;\n query: string;\n onTitleClick: (id: string) => void;\n actions?: ActionsProps;\n abstract: string;\n}\n\nexport interface DetectedItem extends OmitStrict<AutoAnsweredItem, 'abstract'> {\n confidence?: number;\n}\n\nexport type BuddySuggestedArticlesProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n autoAnswered?: AutoAnsweredItem[];\n detected?: DetectedItem[];\n pastQuestions?: string[];\n notRelevantQuestions?: string[];\n showMore?: boolean;\n onShowMoreToggle?: () => void;\n }\n>;\n\nexport interface ArticleBuddyListProps extends MenuButtonProps {\n /** Aria label for screen readers. */\n contextualLabel?: string;\n}\n\nexport interface ArticleBuddyStandardProps {\n renderAgent?: false;\n agentOptions?: never;\n query: Required<Pick<TextAreaProps, 'label' | 'value' | 'placeholder' | 'onChange'>> &\n Pick<TextAreaProps, 'labelHidden'>;\n buddyOptions?: {\n list: ArticleBuddyListProps;\n buddyInfo?: {\n title: AdditionalInfoProps['heading'];\n description: AdditionalInfoProps['children'];\n };\n };\n onSubmit: () => void;\n onClear: () => void;\n loading?: boolean;\n response?: BuddyResponseProps;\n}\n\nexport interface ArticleBuddyAgentProps {\n renderAgent: true;\n agentOptions: OmitStrict<\n GenAICoachProps,\n | 'initialSuggestedMessages'\n | 'attachments'\n | 'attachmentsError'\n | 'onAddAttachment'\n | 'lightboxPreviewProps'\n >;\n query?: never;\n buddyOptions?: never;\n onSubmit?: never;\n onClear?: never;\n loading?: never;\n response?: never;\n}\n\nexport type ArticleBuddyProps = ArticleBuddyStandardProps | ArticleBuddyAgentProps;\n\nexport const isExternalLink = (reference: Reference): reference is ExternalLinkProps => {\n return reference.type === 'link';\n};\n\nexport const isInternalArticle = (reference: Reference): reference is InternalArticleProps => {\n return reference.type === 'object';\n};\n\nexport interface Articles {\n /** List of articles */\n articles: ArticleSummaryProps[];\n /** count of articles */\n count?: number;\n /** Active article if one is open/selected */\n activeArticle?: ArticleProps | BuddyResponseProps;\n /** Props related to the Search Input. */\n searchInput: OmitStrict<\n SearchInputProps,\n 'searchResults' | 'recentSearches' | 'advancedSearchLink' | 'resultsPopover'\n > & {\n searchFilter?: MenuButtonProps;\n filterInfo?: {\n title: AdditionalInfoProps['heading'];\n description: AdditionalInfoProps['children'];\n };\n } & SearchFilter;\n /** Props related to the Category Input. */\n category?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'actions'\n | 'additionalInfo'\n >;\n\n /** Props related to the SortBy Input. */\n sortBy?: OmitStrict<\n ComboBoxProps,\n | 'id'\n | 'labelHidden'\n | 'required'\n | 'disabled'\n | 'readOnly'\n | 'status'\n | 'info'\n | 'mode'\n | 'actions'\n | 'additionalInfo'\n | 'onChange'\n | 'value'\n >;\n /** Callback fired when clear button is clicked */\n onClearClick?: MouseEventHandler<HTMLButtonElement>;\n /** Quick filters to filter articles */\n quickFilters?: QuickFilter[];\n /** Callback fired when applied quick filter is removed */\n handleQuickFilterRemove?: (id: string) => void;\n /** Prop to enable show / hide results */\n showResults?: boolean;\n}\n\nexport interface ArticleListHeaderProps {\n /** Title of article list */\n title: string;\n /** Article list header icon */\n icon?: string;\n /** Actions which needs to be displayed with an icon */\n actions?: ActionsProps;\n}\n\nexport type SemanticSearchArticles = OmitStrict<Articles, 'articles'> & {\n semanticFilter?: MenuProps;\n} & ArticleSemanticSearchProps;\n\ntype SuggestedArticles = Pick<Articles, 'count' | 'activeArticle'> & {\n articles: ArticleSummaryProps[] | BuddySuggestedArticlesProps;\n aiSuggestedArticles?: AIArticleSummaryProps[];\n};\n\nexport type ArticleListProps = RequireAtLeastOne<\n {\n /** Props related to article list header */\n header?: ArticleListHeaderProps;\n /** Data of suggested articles */\n suggested?: SuggestedArticles;\n /** Data of followed articles */\n followed?: Articles;\n /** Data of search articles */\n search?: Articles | SemanticSearchArticles;\n buddy?: {\n title: string;\n content: ArticleBuddyProps;\n };\n /** current active tab whose list has to be rendered */\n activeTab: string;\n /** Callback fired when tab is clicked */\n onTabClick?: (name: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /**\n * Optionally renders an indeterminate progress indicator while articles are being fetched.\n * @default false\n */\n loading?: boolean;\n /**\n * Optionally renders an indeterminate progress indicator while progressively fetching articles\n * @default false\n */\n loadingMore?: boolean;\n /** callback fired when quick filter is clicked */\n onQuickFilterClick?: (\n quickFilterParam: QuickFilter,\n event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>\n ) => void;\n /** Callback to fetch more rows */\n onLoadMore?: () => void;\n },\n 'suggested' | 'followed' | 'search' | 'buddy'\n>;\n\nexport interface QuickFilter {\n /** Unique id of quick Filter */\n id: string;\n /** Name of quick Filter */\n name: string;\n}\n\nexport type ArticleSemanticSearchProps = WithAttributes<\n 'div',\n NoChildrenProp & {\n semanticSearch: boolean;\n /** list of semantic articles */\n articles?: AIArticleSummaryProps[];\n /** Handles feedback section */\n feedback?: ArticleFeedbackProps;\n /**\n * Handles error\n * @default false\n */\n error?: boolean;\n /**\n * Sets the initial message\n * @default false\n */\n initialMessage?: boolean;\n relatedQuestions?: RelatedQuestionsProps;\n }\n>;\n\nexport function isSearchArticle(\n item: AIArticleSummaryProps | ArticleSummaryProps\n): item is ArticleSummaryProps {\n return 'abstract' in item;\n}\n\nexport const isSemanticSearchArticle = (\n fileItems: (AIArticleSummaryProps | ArticleSummaryProps)[]\n): fileItems is AIArticleSummaryProps[] => {\n return fileItems.every(item => 'semanticSearch' in item);\n};\n\nexport const isSemanticSearch = (\n obj: Articles | SemanticSearchArticles | undefined\n): obj is SemanticSearchArticles => {\n return (obj as SemanticSearchArticles)?.semanticSearch;\n};\n\nexport type ArticleListTabId = 'Suggested' | 'Followed' | 'Search' | 'Buddy';\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'react';
|
|
2
2
|
import { type GenAICoachProps } from '.';
|
|
3
|
+
export declare const AgentIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
declare const _default: FunctionComponent<GenAICoachProps> & {
|
|
4
5
|
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["user-message", "coach-message", "actions", "attachments"]>;
|
|
5
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,OAAO,CAAC;AA0E5D,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAahF,eAAO,MAAM,SAAS,+CAmDrB,CAAC;;;;AA4zBF,wBAA6D"}
|
|
@@ -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,
|
|
3
|
+
import { Button, Flex, Icon, MenuButton, Progress, Text, createUID, menuHelpers, useI18n, useTestIds, useTheme, withTestIds, registerIcon, usePrevious, getFocusables, isMenuGroupProps, ErrorState, useArrows, focusableSelector, useLiveLog, useOuterEvent, ThemeOverride, hasProp, getActiveElement, useElement, Actions, useBreakpoint, Grid, useRefMap, VisuallyHiddenText, FileList, Lightbox, useUID, FormField } 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,13 +8,21 @@ 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 * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
|
|
10
10
|
import * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';
|
|
11
|
+
import * as chatTypingIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chat-typing.icon';
|
|
11
12
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
12
13
|
import { isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
|
|
13
|
-
import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer,
|
|
14
|
+
import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledMenuSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper, StyledErrorContainer, StyledInput, StyledGuidedSuggestions, StyledComposerSection, StyledGenAIFormControl, StyledGenAITextArea, StyledSendButton, StyledGenAIFooter, StyledActionsContainer, StyledAgentIcon } from './GenAICoach.styles';
|
|
14
15
|
import ConversationHistory from './ConversationHistory';
|
|
15
16
|
import { GenAIMessage, InitialSuggestedMessage } from '.';
|
|
16
|
-
registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon);
|
|
17
|
-
const
|
|
17
|
+
registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon, chatTypingIcon);
|
|
18
|
+
export const AgentIcon = () => {
|
|
19
|
+
const uid = useUID();
|
|
20
|
+
const idA = `agent-gradient-a-${uid}`;
|
|
21
|
+
const idB = `agent-gradient-b-${uid}`;
|
|
22
|
+
const idC = `agent-clip-${uid}`;
|
|
23
|
+
return (_jsxs(StyledAgentIcon, { xmlns: 'http://www.w3.org/2000/svg', filter: 'drop-shadow(0 .125rem .125rem rgba(0,0,0,.03)) drop-shadow(.125rem .5rem .5rem rgba(0,0,0,.05)) drop-shadow(.125rem 1rem 1rem rgba(0,0,0,.08))', viewBox: '0 0 60 60', children: [_jsxs("linearGradient", { id: idA, x1: '30.586', x2: '3.059', y1: '58.111', y2: '30.584', gradientUnits: 'userSpaceOnUse', children: [_jsx("stop", { offset: '.115', stopColor: '#681fc3' }), _jsx("stop", { offset: '.418', stopColor: '#9795f3' }), _jsx("stop", { offset: '.591', stopColor: '#b3d2ff' }), _jsx("stop", { offset: '.966', stopColor: '#a467f0' })] }), _jsxs("linearGradient", { id: idB, x1: '7.137', x2: '29.565', y1: '0', y2: '60.151', gradientUnits: 'userSpaceOnUse', children: [_jsx("stop", { offset: '.457', stopColor: '#8165d2', stopOpacity: '0' }), _jsx("stop", { offset: '.524', stopColor: '#280096', stopOpacity: '.4' })] }), _jsx("clipPath", { id: idC, children: _jsx("path", { d: 'M0 0h60v60H0z' }) }), _jsxs("g", { fillRule: 'evenodd', clipPath: `url(#${idC})`, clipRule: 'evenodd', children: [_jsx("path", { fill: `url(#${idA})`, d: 'M60 30.002c-9.023.937-16.054 3.632-20.86 8.203C33.633 43.242 30.586 50.508 30 60c-1.173-9.61-4.453-16.875-9.727-21.914C15.35 33.516 8.555 30.82 0 30c9.023-.703 16.054-3.515 21.093-8.438C26.132 16.523 29.063 9.376 29.999 0c.704 10.43 4.102 18.164 10.313 23.202C45.352 27.186 51.914 29.413 60 30zm-3.75-18.75c-2.228.235-3.984.936-5.391 2.226-1.289 1.289-1.992 3.047-2.109 5.274-.235-2.227-.937-3.983-2.108-5.155-1.289-1.288-3.048-2.109-5.391-2.344 2.227-.116 3.867-.82 5.156-1.991 1.288-1.289 2.108-3.164 2.343-5.508.117 2.46.937 4.336 2.344 5.508 1.288 1.171 2.93 1.875 5.156 1.991zM18.75 48.75c-2.345.236-4.103.937-5.392 2.227-1.288 1.172-1.992 2.93-2.108 5.274-.235-2.46-1.055-4.218-2.46-5.507-1.056-1.055-2.812-1.758-5.04-1.992 1.993-.116 3.633-.703 4.804-1.758 1.524-1.172 2.46-3.047 2.696-5.743.116 1.992.703 3.751 1.875 5.156 1.172 1.288 3.047 2.108 5.626 2.344z' }), _jsx("path", { fill: `url(#${idB})`, d: 'M60 30.002c-9.023.937-16.054 3.632-20.86 8.203C33.633 43.242 30.586 50.508 30 60c-1.173-9.61-4.453-16.875-9.727-21.914C15.35 33.516 8.555 30.82 0 30c9.023-.703 16.054-3.515 21.093-8.438C26.132 16.523 29.063 9.376 29.999 0c.704 10.43 4.102 18.164 10.313 23.202C45.352 27.186 51.914 29.413 60 30zm-3.75-18.75c-2.228.235-3.984.936-5.391 2.226-1.289 1.289-1.992 3.047-2.109 5.274-.235-2.227-.937-3.983-2.108-5.155-1.289-1.288-3.048-2.109-5.391-2.344 2.227-.116 3.867-.82 5.156-1.991 1.288-1.289 2.108-3.164 2.343-5.508.117 2.46.937 4.336 2.344 5.508 1.288 1.171 2.93 1.875 5.156 1.991zM18.75 48.75c-2.345.236-4.103.937-5.392 2.227-1.288 1.172-1.992 2.93-2.108 5.274-.235-2.46-1.055-4.218-2.46-5.507-1.056-1.055-2.812-1.758-5.04-1.992 1.993-.116 3.633-.703 4.804-1.758 1.524-1.172 2.46-3.047 2.696-5.743.116 1.992.703 3.751 1.875 5.156 1.172 1.288 3.047 2.108 5.626 2.344z' })] })] }));
|
|
24
|
+
};
|
|
25
|
+
const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, conversationHistory, onLayoutChange, onAddAttachment, attachments, attachmentsError, lightboxPreviewProps, showSalutation = true, salutation, ...restProps }) => {
|
|
18
26
|
const theme = useTheme();
|
|
19
27
|
const t = useI18n();
|
|
20
28
|
const elementRef = useRef(null);
|
|
@@ -39,9 +47,11 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
39
47
|
const [message, setMessage] = useState('');
|
|
40
48
|
const [coachOptions, setCoachOptions] = useState(coachOptionsProps);
|
|
41
49
|
const [arrowKey, setArrowKey] = useState(null);
|
|
50
|
+
const [isComposerFocused, setIsComposerFocused] = useState(false);
|
|
42
51
|
const previousMessages = usePrevious(messages);
|
|
43
52
|
const testIds = useTestIds(testId, getGenAICoachTestIds);
|
|
44
53
|
const { announcePolite } = useLiveLog();
|
|
54
|
+
const composerId = useUID();
|
|
45
55
|
const latestMessage = messages.at(-1);
|
|
46
56
|
const condition = variant.placement === 'dialog' ||
|
|
47
57
|
variant.placement === 'utilities' ||
|
|
@@ -112,7 +122,7 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
112
122
|
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: () => {
|
|
113
123
|
variant.onStateChange('maximized');
|
|
114
124
|
isUserTriggered.current = true;
|
|
115
|
-
}, 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: () => {
|
|
125
|
+
}, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: true, as: StyledActionsContainer, children: [isInUtilities(variant) && (_jsx(Button, { icon: true, label: t('minimize'), "aria-label": t('agent_noun', [t('minimize')]), variant: 'simple', onClick: () => {
|
|
116
126
|
variant.onStateChange('minimized');
|
|
117
127
|
isUserTriggered.current = true;
|
|
118
128
|
}, 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' }) }))] })] }));
|
|
@@ -238,6 +248,37 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
238
248
|
onAddAttachment?.(newFiles);
|
|
239
249
|
}
|
|
240
250
|
};
|
|
251
|
+
const genAIFooter = (_jsxs(Flex, { container: { direction: 'column' }, as: StyledGenAIFooter, children: [_jsx(FormField, { label: t('message_pega_gen_ai_coach'), labelHidden: true, labelFor: composerId, children: _jsx(StyledGenAIFormControl, { focused: isComposerFocused, children: _jsxs(Flex, { container: { direction: 'column', gap: 0.25 }, children: [_jsx(StyledGenAITextArea, { id: composerId, ref: textAreaRef, value: message, placeholder: t('write_message'), onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: () => {
|
|
252
|
+
setIsComposerFocused(true);
|
|
253
|
+
}, onBlur: () => {
|
|
254
|
+
setIsComposerFocused(false);
|
|
255
|
+
}, autoResize: true }), _jsxs(Flex, { container: {
|
|
256
|
+
direction: 'row',
|
|
257
|
+
justify: 'between',
|
|
258
|
+
gap: 1,
|
|
259
|
+
pad: [undefined, 1, 1, 1]
|
|
260
|
+
}, children: [_jsxs(Flex, { container: { alignItems: 'center' }, children: [suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'simple', icon: 'chat-typing', iconOnly: true, as: StyledMenuSuggestions, menu: {
|
|
261
|
+
items: suggestions,
|
|
262
|
+
onItemClick: id => {
|
|
263
|
+
const selected = menuHelpers.getItem(suggestions, id);
|
|
264
|
+
if (selected) {
|
|
265
|
+
onSend({
|
|
266
|
+
id: selected.id,
|
|
267
|
+
message: selected.primary
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, showArrow: false })), onAddAttachment && (_jsxs(_Fragment, { children: [_jsx(Button, { icon: true, onClick: () => {
|
|
272
|
+
if (fileUploadInputRef.current) {
|
|
273
|
+
fileUploadInputRef.current.value = '';
|
|
274
|
+
}
|
|
275
|
+
fileUploadInputRef.current?.click();
|
|
276
|
+
}, variant: 'simple', label: t('add_attachment'), children: _jsx(Icon, { name: 'paper-clip' }) }), _jsx(StyledInput, { type: 'file', ref: fileUploadInputRef, onChange: onFileChange, multiple: false, "data-testid": testIds.attachments })] }))] }), latestMessage && isCoachMessage(latestMessage) && latestMessage.loading ? (_jsxs(Flex, { container: {
|
|
277
|
+
gap: 1,
|
|
278
|
+
justify: 'end',
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
pad: 1
|
|
281
|
+
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] })) : (_jsx(StyledSendButton, { variant: 'primary', onClick: handleSendMessage, icon: true, label: t('send'), "aria-label": t('send_message'), children: _jsx(Icon, { name: 'send-solid' }) }))] })] }) }) }), attachments && attachments.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Flex, { as: FileList, type: 'item', "aria-label": `${t('attachments')}`, items: attachments, container: { pad: [1, 0] } }), attachmentsError && (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, as: StyledErrorContainer, children: [_jsx(Icon, { name: 'warn-solid' }), _jsx(VisuallyHiddenText, { children: `${t('error')} ` }), attachmentsError] }))] })), _jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) })] }));
|
|
241
282
|
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
|
|
242
283
|
? { direction: 'column', pad: [0, 2], justify: 'center' }
|
|
243
284
|
: { 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: {
|
|
@@ -245,7 +286,13 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
245
286
|
direction: 'column',
|
|
246
287
|
gap: 8
|
|
247
288
|
}, item: { grow: 1 }, children: [((isInUtilities(variant) && variant.state === 'maximized') ||
|
|
248
|
-
!isInUtilities(variant)) &&
|
|
289
|
+
!isInUtilities(variant)) &&
|
|
290
|
+
showSalutation && (_jsxs(Flex, { container: {
|
|
291
|
+
direction: 'column',
|
|
292
|
+
alignItems: 'center',
|
|
293
|
+
justify: 'center',
|
|
294
|
+
gap: 1
|
|
295
|
+
}, children: [_jsx(AgentIcon, {}), _jsx(Text, { variant: 'h3', children: salutation ?? t('welcome_text') })] })), _jsx(Flex, { container: { direction: 'column', gap: 1.5, alignItems: 'center' }, children: initialSuggestedMessages?.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
|
|
249
296
|
onSend(initialMessage);
|
|
250
297
|
isUserTriggered.current = true;
|
|
251
298
|
}, testId: initialSuggestedMessage.id }))) })] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onFocus: () => {
|
|
@@ -355,31 +402,7 @@ const GenAICoach = ({ testId, coachOptions: coachOptionsProps, onCoachChange: on
|
|
|
355
402
|
message: selected.primary
|
|
356
403
|
});
|
|
357
404
|
}
|
|
358
|
-
} }) })), _jsx(Flex, { container: { justify: '
|
|
359
|
-
gap: 1,
|
|
360
|
-
justify: 'end',
|
|
361
|
-
alignItems: 'center',
|
|
362
|
-
pad: 1
|
|
363
|
-
}, children: [t('generating_response'), _jsx(Progress, { placement: 'inline' })] })) : (_jsxs(Flex, { container: {
|
|
364
|
-
gap: 2,
|
|
365
|
-
justify: 'between',
|
|
366
|
-
pad: [1, undefined, undefined]
|
|
367
|
-
}, children: [suggestions && (_jsx(MenuButton, { text: t('suggestions'), variant: 'text', icon: 'polaris-solid', as: StyledSuggestions, menu: {
|
|
368
|
-
items: suggestions,
|
|
369
|
-
onItemClick: id => {
|
|
370
|
-
const selected = menuHelpers.getItem(suggestions, id);
|
|
371
|
-
if (selected)
|
|
372
|
-
onSend({
|
|
373
|
-
id: selected.id,
|
|
374
|
-
message: selected.primary
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
} })), _jsxs(Flex, { container: { gap: 1, justify: 'end' }, children: [onAddAttachment && (_jsxs(_Fragment, { children: [_jsx(Button, { icon: true, onClick: () => {
|
|
378
|
-
if (fileUploadInputRef.current) {
|
|
379
|
-
fileUploadInputRef.current.value = '';
|
|
380
|
-
}
|
|
381
|
-
fileUploadInputRef.current?.click();
|
|
382
|
-
}, variant: 'simple', label: t('add_attachment'), children: _jsx(Icon, { name: 'paper-clip' }) }), _jsx(StyledInput, { type: 'file', ref: fileUploadInputRef, onChange: onFileChange, multiple: false, "data-testid": testIds.attachments })] })), _jsx(Button, { variant: 'primary', onClick: handleSendMessage, children: t('send') })] })] })), _jsx(Flex, { container: { justify: 'start' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) })] })) }) }))] })) }));
|
|
405
|
+
} }) })), _jsx(Flex, { container: { justify: 'center' }, children: _jsx(StyledDisclaimerText, { inFullPage: !condition, children: t('ai_disclaimer') }) })] })) })) : (genAIFooter) }) }))] })) }));
|
|
383
406
|
useEffect(() => {
|
|
384
407
|
if (focusTextArea.current && !conversationHistory && textAreaRef.current) {
|
|
385
408
|
textAreaRef.current.focus();
|