@pega/cosmos-react-work 9.5.4 → 9.5.5-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts +2 -0
  2. package/lib/components/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  3. package/lib/components/AppAnnouncement/AppAnnouncement.js +8 -3
  4. package/lib/components/AppAnnouncement/AppAnnouncement.js.map +1 -1
  5. package/lib/components/GenAICoach/GenAICoach.d.ts.map +1 -1
  6. package/lib/components/GenAICoach/GenAICoach.js +183 -34
  7. package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
  8. package/lib/components/GenAICoach/GenAICoach.styles.d.ts +216 -9
  9. package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
  10. package/lib/components/GenAICoach/GenAICoach.styles.js +148 -57
  11. package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
  12. package/lib/components/GenAICoach/GenAICoach.types.d.ts +19 -3
  13. package/lib/components/GenAICoach/GenAICoach.types.d.ts.map +1 -1
  14. package/lib/components/GenAICoach/GenAICoach.types.js.map +1 -1
  15. package/lib/components/GenAICoach/GenAICoach.utils.d.ts +2 -1
  16. package/lib/components/GenAICoach/GenAICoach.utils.d.ts.map +1 -1
  17. package/lib/components/GenAICoach/GenAICoach.utils.js +1 -0
  18. package/lib/components/GenAICoach/GenAICoach.utils.js.map +1 -1
  19. package/lib/components/GenAICoach/GenAIMessage.d.ts.map +1 -1
  20. package/lib/components/GenAICoach/GenAIMessage.js +35 -17
  21. package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
  22. package/lib/components/GenAICoach/Questionnaire.d.ts.map +1 -1
  23. package/lib/components/GenAICoach/Questionnaire.js +20 -21
  24. package/lib/components/GenAICoach/Questionnaire.js.map +1 -1
  25. package/lib/components/Shortcuts/Shortcuts.d.ts.map +1 -1
  26. package/lib/components/Shortcuts/Shortcuts.js +20 -10
  27. package/lib/components/Shortcuts/Shortcuts.js.map +1 -1
  28. package/lib/components/Shortcuts/Shortcuts.styles.d.ts +1 -0
  29. package/lib/components/Shortcuts/Shortcuts.styles.d.ts.map +1 -1
  30. package/lib/components/Shortcuts/Shortcuts.styles.js +6 -1
  31. package/lib/components/Shortcuts/Shortcuts.styles.js.map +1 -1
  32. package/lib/components/Tasks/TaskCard.js +1 -1
  33. package/lib/components/Tasks/TaskCard.js.map +1 -1
  34. package/lib/components/Tasks/TaskList.d.ts +2 -1
  35. package/lib/components/Tasks/TaskList.d.ts.map +1 -1
  36. package/lib/components/Tasks/TaskList.js +25 -17
  37. package/lib/components/Tasks/TaskList.js.map +1 -1
  38. package/lib/components/Tasks/Tasks.d.ts +5 -0
  39. package/lib/components/Tasks/Tasks.d.ts.map +1 -1
  40. package/lib/components/Tasks/Tasks.js +7 -5
  41. package/lib/components/Tasks/Tasks.js.map +1 -1
  42. package/package.json +3 -3
@@ -11,6 +11,8 @@ export interface AppAnnouncementProps extends BaseProps, NoChildrenProp {
11
11
  whatsNewLink?: string;
12
12
  /** Content to populate the announcement button. */
13
13
  whatsNewText?: string;
14
+ /** When provided, the heading renders as a link to this URL and the What's new button is hidden. */
15
+ headingUrl?: string;
14
16
  /** An image source for the decorative background. */
15
17
  image?: string;
16
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AppAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAelD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAOD,eAAO,MAAM,4BAA4B,6NAiCvC,CAAC;AAIH,eAAO,MAAM,qBAAqB,kRA4EhC,CAAC;AAIH,QAAA,MAAM,eAAe,EAAE,+BAA+B,CAAC,oBAAoB,CAwD1E,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"AppAnnouncement.d.ts","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAelD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAaD,eAAO,MAAM,4BAA4B,6NAiCvC,CAAC;AAIH,eAAO,MAAM,qBAAqB,kRA4EhC,CAAC;AAIH,QAAA,MAAM,eAAe,EAAE,+BAA+B,CAAC,oBAAoB,CAwE1E,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -8,6 +8,10 @@ const StyledDismissButton = styled.button `
8
8
  font-size: 1.25rem;
9
9
  border: none;
10
10
  `;
11
+ const StyledHeadingLink = styled(Button) `
12
+ color: inherit;
13
+ `;
14
+ StyledHeadingLink.defaultProps = defaultThemeProp;
11
15
  export const StyledAppAnnouncementContent = styled.div(props => {
12
16
  const { theme: { base: { spacing } } } = props;
13
17
  return css `
@@ -105,12 +109,13 @@ export const StyledAppAnnouncement = styled.article(props => {
105
109
  StyledAppAnnouncement.defaultProps = defaultThemeProp;
106
110
  const AppAnnouncement = forwardRef(function AppAnnouncement(props, ref) {
107
111
  const t = useI18n();
108
- const { heading, description, details, whatsNewLink, whatsNewText = t('app_announcement_whats_new_button_label'), image, onDismiss, ...restProps } = props;
109
- return (_jsxs(StyledAppAnnouncement, { ...restProps, ref: ref, image: image, children: [onDismiss && (_jsx(Button, { as: StyledDismissButton, variant: 'simple', icon: true, onClick: onDismiss, "aria-label": t('app_announcement_dismiss_button_label_a11y'), children: _jsx(Icon, { name: 'times' }) })), _jsx(Text, { variant: 'h2', children: heading || t('app_announcement_details_list_header') }), _jsxs("div", { children: [_jsxs(StyledAppAnnouncementContent, { children: [description && _jsx(HTML, { as: 'p', content: description }), !!details?.length && (_jsx("ul", { children: details.map((item, index) => {
112
+ const { heading, description, details, whatsNewLink, whatsNewText = t('app_announcement_whats_new_button_label'), headingUrl, image, onDismiss, ...restProps } = props;
113
+ const resolvedHeading = heading || t('app_announcement_details_list_header');
114
+ return (_jsxs(StyledAppAnnouncement, { ...restProps, ref: ref, image: image, children: [onDismiss && (_jsx(Button, { as: StyledDismissButton, variant: 'simple', icon: true, onClick: onDismiss, "aria-label": t('app_announcement_dismiss_button_label_a11y'), children: _jsx(Icon, { name: 'times' }) })), _jsx(Text, { variant: 'h2', children: headingUrl ? (_jsx(StyledHeadingLink, { variant: 'link', href: headingUrl, target: '_blank', rel: 'noopener noreferrer', children: resolvedHeading })) : (resolvedHeading) }), _jsxs("div", { children: [_jsxs(StyledAppAnnouncementContent, { children: [description && _jsx(HTML, { as: 'p', content: description }), !!details?.length && (_jsx("ul", { children: details.map((item, index) => {
110
115
  return (
111
116
  // eslint-disable-next-line react/no-array-index-key
112
117
  _jsx("li", { children: _jsx(HTML, { content: item }) }, index));
113
- }) }))] }), whatsNewLink && (_jsx(Button, { variant: 'secondary', href: whatsNewLink, target: '_blank', children: whatsNewText }))] })] }));
118
+ }) }))] }), !headingUrl && whatsNewLink && (_jsx(Button, { variant: 'secondary', href: whatsNewLink, target: '_blank', children: whatsNewText }))] })] }));
114
119
  });
115
120
  export default AppAnnouncement;
116
121
  //# sourceMappingURL=AppAnnouncement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppAnnouncement.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,YAAY,CAAC,SAAS,CAAC,CAAC;AAwBxB,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAA;;;CAGxC,CA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AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n StyledButton,\n Text,\n Icon,\n registerIcon,\n useI18n,\n defaultThemeProp,\n useDirection,\n calculateForegroundColor,\n HTML\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nregisterIcon(timesIcon);\n\nexport interface AppAnnouncementProps extends BaseProps, NoChildrenProp {\n /** Heading text for the announcement. */\n heading?: string;\n /** Description text for the announcement. */\n description?: string;\n /** Announcement details to be displayed in form of bulleted list. */\n details?: string[];\n /** Url to open with What's new link. */\n whatsNewLink?: string;\n /** Content to populate the announcement button. */\n whatsNewText?: string;\n /** An image source for the decorative background. */\n image?: string;\n /**\n * Whether to fit AppAnnouncement widget in the parent element.\n */\n fitToParent?: boolean;\n /** Callback when user dismisses the announcements. */\n onDismiss?: () => void;\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledDismissButton = styled.button`\n font-size: 1.25rem;\n border: none;\n`;\n\nexport const StyledAppAnnouncementContent = styled.div(props => {\n const {\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n max-height: 12rem;\n overflow-y: auto;\n margin-block-start: calc(1.5 * ${spacing});\n margin-inline: calc(-2 * ${spacing});\n padding-inline: calc(2 * ${spacing});\n\n p,\n ul {\n line-height: 1.4;\n }\n\n ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n\n p + ul {\n margin-block-start: calc(1.5 * ${spacing});\n }\n\n li {\n &:not(:last-child) {\n margin-block-end: ${spacing};\n }\n }\n `;\n});\n\nStyledAppAnnouncementContent.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncement = styled.article<\n Pick<AppAnnouncementProps, 'image' | 'fitToParent'>\n>(props => {\n const {\n theme: {\n base: { shadow, spacing },\n components: {\n card: { 'border-radius': borderRadius },\n announcement: { background, 'foreground-color': foregroundColor }\n }\n },\n image\n } = props;\n\n const { end } = useDirection();\n const color = calculateForegroundColor(background, foregroundColor);\n\n return css`\n padding: calc(2 * ${spacing});\n background: ${background};\n border-radius: ${borderRadius};\n color: ${color};\n position: relative;\n\n ${props.fitToParent && 'block-size: 100%;'};\n\n &::after {\n background: url('${image}') no-repeat;\n background-position: ${end} bottom;\n background-size: contain;\n background-origin: content-box;\n opacity: 0.2;\n content: '';\n display: block;\n position: absolute;\n width: 50%;\n height: 100%;\n inset-inline-end: 0;\n bottom: 0;\n padding: calc(2 * ${spacing});\n }\n\n h2 {\n position: relative;\n z-index: 2;\n }\n\n ${StyledDismissButton} {\n position: absolute;\n top: 0.75rem;\n inset-inline-end: 0.75rem;\n color: inherit;\n z-index: 3;\n &:enabled:hover {\n background: #ffffff19;\n }\n &:enabled:focus {\n box-shadow: ${shadow.focus};\n }\n }\n\n > div {\n position: relative;\n z-index: 2;\n\n ${StyledButton} {\n margin-top: calc(2 * ${spacing});\n white-space: normal;\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${shadow.focus};\n }\n }\n }\n `;\n});\n\nStyledAppAnnouncement.defaultProps = defaultThemeProp;\n\nconst AppAnnouncement: ForwardRefForwardPropsComponent<AppAnnouncementProps> = forwardRef(\n function AppAnnouncement(\n props: PropsWithoutRef<AppAnnouncementProps>,\n ref: AppAnnouncementProps['ref']\n ) {\n const t = useI18n();\n const {\n heading,\n description,\n details,\n whatsNewLink,\n whatsNewText = t('app_announcement_whats_new_button_label'),\n image,\n onDismiss,\n ...restProps\n } = props;\n\n return (\n <StyledAppAnnouncement {...restProps} ref={ref} image={image}>\n {onDismiss && (\n <Button\n as={StyledDismissButton}\n variant='simple'\n icon\n onClick={onDismiss}\n aria-label={t('app_announcement_dismiss_button_label_a11y')}\n >\n <Icon name='times' />\n </Button>\n )}\n <Text variant='h2'>{heading || t('app_announcement_details_list_header')}</Text>\n <div>\n <StyledAppAnnouncementContent>\n {description && <HTML as='p' content={description} />}\n {!!details?.length && (\n <ul>\n {details.map((item, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <li key={index}>\n <HTML content={item} />\n </li>\n );\n })}\n </ul>\n )}\n </StyledAppAnnouncementContent>\n {whatsNewLink && (\n <Button variant='secondary' href={whatsNewLink} target='_blank'>\n {whatsNewText}\n </Button>\n )}\n </div>\n </StyledAppAnnouncement>\n );\n }\n);\n\nexport default AppAnnouncement;\n"]}
1
+ {"version":3,"file":"AppAnnouncement.js","sourceRoot":"","sources":["../../../src/components/AppAnnouncement/AppAnnouncement.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,YAAY,CAAC,SAAS,CAAC,CAAC;AA0BxB,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAA;;;CAGxC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;CAEvC,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;IAC7D,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,EACF,GAAG,KAAK,CAAC;IAEV,OAAO,GAAG,CAAA;;;qCAGyB,OAAO;+BACb,OAAO;+BACP,OAAO;;;;;;;;uCAQC,O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F,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n StyledButton,\n Text,\n Icon,\n registerIcon,\n useI18n,\n defaultThemeProp,\n useDirection,\n calculateForegroundColor,\n HTML\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nregisterIcon(timesIcon);\n\nexport interface AppAnnouncementProps extends BaseProps, NoChildrenProp {\n /** Heading text for the announcement. */\n heading?: string;\n /** Description text for the announcement. */\n description?: string;\n /** Announcement details to be displayed in form of bulleted list. */\n details?: string[];\n /** Url to open with What's new link. */\n whatsNewLink?: string;\n /** Content to populate the announcement button. */\n whatsNewText?: string;\n /** When provided, the heading renders as a link to this URL and the What's new button is hidden. */\n headingUrl?: string;\n /** An image source for the decorative background. */\n image?: string;\n /**\n * Whether to fit AppAnnouncement widget in the parent element.\n */\n fitToParent?: boolean;\n /** Callback when user dismisses the announcements. */\n onDismiss?: () => void;\n ref?: Ref<HTMLElement>;\n}\n\nconst StyledDismissButton = styled.button`\n font-size: 1.25rem;\n border: none;\n`;\n\nconst StyledHeadingLink = styled(Button)`\n color: inherit;\n`;\n\nStyledHeadingLink.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncementContent = styled.div(props => {\n const {\n theme: {\n base: { spacing }\n }\n } = props;\n\n return css`\n max-height: 12rem;\n overflow-y: auto;\n margin-block-start: calc(1.5 * ${spacing});\n margin-inline: calc(-2 * ${spacing});\n padding-inline: calc(2 * ${spacing});\n\n p,\n ul {\n line-height: 1.4;\n }\n\n ul {\n padding-inline-start: calc(2 * ${spacing});\n }\n\n p + ul {\n margin-block-start: calc(1.5 * ${spacing});\n }\n\n li {\n &:not(:last-child) {\n margin-block-end: ${spacing};\n }\n }\n `;\n});\n\nStyledAppAnnouncementContent.defaultProps = defaultThemeProp;\n\nexport const StyledAppAnnouncement = styled.article<\n Pick<AppAnnouncementProps, 'image' | 'fitToParent'>\n>(props => {\n const {\n theme: {\n base: { shadow, spacing },\n components: {\n card: { 'border-radius': borderRadius },\n announcement: { background, 'foreground-color': foregroundColor }\n }\n },\n image\n } = props;\n\n const { end } = useDirection();\n const color = calculateForegroundColor(background, foregroundColor);\n\n return css`\n padding: calc(2 * ${spacing});\n background: ${background};\n border-radius: ${borderRadius};\n color: ${color};\n position: relative;\n\n ${props.fitToParent && 'block-size: 100%;'};\n\n &::after {\n background: url('${image}') no-repeat;\n background-position: ${end} bottom;\n background-size: contain;\n background-origin: content-box;\n opacity: 0.2;\n content: '';\n display: block;\n position: absolute;\n width: 50%;\n height: 100%;\n inset-inline-end: 0;\n bottom: 0;\n padding: calc(2 * ${spacing});\n }\n\n h2 {\n position: relative;\n z-index: 2;\n }\n\n ${StyledDismissButton} {\n position: absolute;\n top: 0.75rem;\n inset-inline-end: 0.75rem;\n color: inherit;\n z-index: 3;\n &:enabled:hover {\n background: #ffffff19;\n }\n &:enabled:focus {\n box-shadow: ${shadow.focus};\n }\n }\n\n > div {\n position: relative;\n z-index: 2;\n\n ${StyledButton} {\n margin-top: calc(2 * ${spacing});\n white-space: normal;\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${shadow.focus};\n }\n }\n }\n `;\n});\n\nStyledAppAnnouncement.defaultProps = defaultThemeProp;\n\nconst AppAnnouncement: ForwardRefForwardPropsComponent<AppAnnouncementProps> = forwardRef(\n function AppAnnouncement(\n props: PropsWithoutRef<AppAnnouncementProps>,\n ref: AppAnnouncementProps['ref']\n ) {\n const t = useI18n();\n const {\n heading,\n description,\n details,\n whatsNewLink,\n whatsNewText = t('app_announcement_whats_new_button_label'),\n headingUrl,\n image,\n onDismiss,\n ...restProps\n } = props;\n\n const resolvedHeading = heading || t('app_announcement_details_list_header');\n\n return (\n <StyledAppAnnouncement {...restProps} ref={ref} image={image}>\n {onDismiss && (\n <Button\n as={StyledDismissButton}\n variant='simple'\n icon\n onClick={onDismiss}\n aria-label={t('app_announcement_dismiss_button_label_a11y')}\n >\n <Icon name='times' />\n </Button>\n )}\n <Text variant='h2'>\n {headingUrl ? (\n <StyledHeadingLink\n variant='link'\n href={headingUrl}\n target='_blank'\n rel='noopener noreferrer'\n >\n {resolvedHeading}\n </StyledHeadingLink>\n ) : (\n resolvedHeading\n )}\n </Text>\n <div>\n <StyledAppAnnouncementContent>\n {description && <HTML as='p' content={description} />}\n {!!details?.length && (\n <ul>\n {details.map((item, index) => {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <li key={index}>\n <HTML content={item} />\n </li>\n );\n })}\n </ul>\n )}\n </StyledAppAnnouncementContent>\n {!headingUrl && whatsNewLink && (\n <Button variant='secondary' href={whatsNewLink} target='_blank'>\n {whatsNewText}\n </Button>\n )}\n </div>\n </StyledAppAnnouncement>\n );\n }\n);\n\nexport default AppAnnouncement;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AAuGA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAmBhF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCAipDyB,eAAe;;;AAQ1C,wBAA6D"}
1
+ {"version":3,"file":"GenAICoach.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.tsx"],"names":[],"mappings":"AA2GA,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,GAAG,CAAC;AAyChF,eAAO,MAAM,SAAS,+CA2GrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAQ5B,CAAC;iCA81DyB,eAAe;;;AAQ1C,wBAA6D"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
3
  import { getLuminance } from 'polished';
4
4
  import { Button, Flex, Icon, MenuButton, Progress, Text, createUID, menuHelpers, useI18n, useSpeechRecognition, useTestIds, useTheme, withTestIds, registerIcon, usePrevious, getFocusables, isMenuGroupProps, ErrorState, useArrows, useFocusTrap, useLiveLog, useOuterEvent, ThemeOverride, hasProp, getActiveElement, useElement, Actions, useFullscreenContext, useBreakpoint, Grid, useRefMap, VisuallyHiddenText, FileList, Lightbox, FormField, useUID, SpeechToTextButton, Toaster, useToaster, throttle } from '@pega/cosmos-react-core';
5
5
  import * as caretUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-up.icon';
@@ -12,19 +12,37 @@ import * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icon
12
12
  import * as sendSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/send-solid.icon';
13
13
  import * as squareSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/square-solid.icon';
14
14
  import * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
15
+ import * as moreAltIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/more-alt.icon';
15
16
  import * as dockIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/dock.icon';
16
17
  import * as undockIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/undock.icon';
17
18
  import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
18
19
  import * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';
19
20
  import { getGenAICoachTestIds } from './GenAICoach.test-ids';
20
- import { isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
21
- import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledMenuSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper, StyledErrorContainer, StyledInput, StyledGuidedSuggestions, StyledComposerSection, StyledSendButton, StyledStopGeneratingButton, StyledGenAIFormControl, StyledGenAITextArea, StyledInitialMessageGrid, StyledGenAIFooter, StyledAgentIcon, StyledActionsContainer, StyledFullscreenWrapper, StyledScrollButton, StyledSuggestionCardsView, StyledSuggestionCardsBottomHalf, StyledStickyComposer, StyledAISuggestedBadge, StyledSalutation, StyledComposerWrapper } from './GenAICoach.styles';
21
+ import { getSelectedKeys, isCoachMessage, isInUtilities, isUserMessage } from './GenAICoach.utils';
22
+ import { StyledMessagesContainer, StyledDisclaimerText, StyledGenAICoachContainer, StyledGenAIOptionsMenu, StyledInitialMessageContainer, StyledInputContainer, StyledMenuSuggestions, StyledMessagesList, StyledGridContainer, StyledFlexWrapper, StyledErrorContainer, StyledInput, StyledGuidedSuggestions, StyledComposerSection, StyledSendButton, StyledStopGeneratingButton, StyledGenAIFormControl, StyledGenAITextArea, StyledInitialMessageGrid, StyledGenAIFooter, StyledAgentIcon, StyledActionsContainer, StyledHeaderContainer, StyledFullscreenWrapper, StyledScrollButton, StyledSuggestionCardsView, StyledSuggestionCardsBottomHalf, StyledStickyComposer, StyledAISuggestedBadge, StyledSalutation, StyledSubHeading, StyledComposerWrapper, StyledBannerSalutationBlock } from './GenAICoach.styles';
22
23
  import ActiveCases from './ActiveCases';
23
24
  import CaseWorkflow from './CaseWorkflow';
24
25
  import ConversationHistory from './ConversationHistory';
25
26
  import Questionnaire from './Questionnaire';
26
27
  import { GenAIMessage, InitialSuggestedMessage } from '.';
27
- registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon, squareSolidIcon, sendSolidIcon, plusIcon, dockIcon, undockIcon, caretLeftIcon, caretRightIcon);
28
+ registerIcon(caretUpIcon, timesIcon, caretDownIcon, minusIcon, polarisSolidIcon, paperClipIcon, warnSolidIcon, squareSolidIcon, sendSolidIcon, plusIcon, dockIcon, undockIcon, caretLeftIcon, caretRightIcon, moreAltIcon);
29
+ const onHeightTransitionEnd = (el, callback) => {
30
+ const handler = (e) => {
31
+ if (e.propertyName !== 'height' || e.target !== el)
32
+ return;
33
+ el.removeEventListener('transitionend', handler);
34
+ callback();
35
+ };
36
+ el.addEventListener('transitionend', handler);
37
+ return () => el.removeEventListener('transitionend', handler);
38
+ };
39
+ const buildInitialFormAnswers = (questions = []) => Object.fromEntries(questions.map(question => [
40
+ question.field,
41
+ {
42
+ value: getSelectedKeys(question),
43
+ questionText: question.questionText
44
+ }
45
+ ]));
28
46
  export const AgentIcon = () => {
29
47
  const theme = useTheme();
30
48
  const uid = useUID();
@@ -38,11 +56,11 @@ export const AISuggestedBadge = () => {
38
56
  const t = useI18n();
39
57
  return (_jsxs(StyledAISuggestedBadge, { container: { alignItems: 'center', gap: 0.5 }, children: [_jsx(Icon, { name: 'polaris-solid', "aria-hidden": true, size: 'font-size' }), _jsx(Text, { children: t('ai_suggestion') })] }));
40
58
  };
41
- const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef, onFullscreenToggle, isFullscreen, selectedCoach, actionsTestId }) => {
59
+ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef, onFullscreenToggle, isFullscreen, selectedCoach, actionsTestId, simplifiedAgent }) => {
42
60
  const t = useI18n();
43
61
  const fullscreenIcon = isFullscreen ? 'dock' : 'undock';
44
62
  const extraItems = [
45
- ...(allowFullScreen
63
+ ...(allowFullScreen && !simplifiedAgent
46
64
  ? [
47
65
  {
48
66
  id: 'fullscreen',
@@ -69,15 +87,25 @@ const HeaderActions = ({ actions, allowFullScreen, variant, isUserTriggeredRef,
69
87
  const mergedItems = [...(actions?.items ?? []), ...extraItems];
70
88
  if (mergedItems.length === 0)
71
89
  return null;
90
+ if (simplifiedAgent) {
91
+ return (_jsx(MenuButton, { "data-testid": actionsTestId, text: t('actions'), "aria-label": selectedCoach ? t('actions_for', [selectedCoach]) : undefined, iconOnly: true, icon: 'more-alt', variant: 'simple', menu: {
92
+ items: mergedItems.map(({ text, onClick, ...rest }) => ({
93
+ ...rest,
94
+ primary: text,
95
+ onClick: onClick ? (id, e) => onClick(id, e) : undefined
96
+ }))
97
+ } }));
98
+ }
72
99
  return (_jsx(Actions, { ...(actions ?? {}), menuAt: 1, "data-testid": actionsTestId, contextualLabel: selectedCoach, items: mergedItems }));
73
100
  };
74
- const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, onNewChat, conversationHistory, onLayoutChange, onAddAttachment, attachments, attachmentsError, lightboxPreviewProps, allowFullScreen = true, isInLandingPageUtilities, stopProcess, voiceToTextProps, salutation, showSalutation = true, isPortalAgent = false, pagePanel, suggestionCardsView, draftMessage, caseWorkflow, activeCases, onStop, isCreatingConversation, conversationError, questionnaireData, onQuestionnaireDismiss, ...restProps }) => {
101
+ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachChange: onCoachChangeProp, messages = [], onSend, initialSuggestedMessages, suggestions, loading, error, variant, onOpen, guidedMode = false, actions, onNewChat, conversationHistory, onLayoutChange, onAddAttachment, attachments, attachmentsError, lightboxPreviewProps, allowFullScreen = true, isInLandingPageUtilities, stopProcess, voiceToTextProps, salutation, showSalutation = true, isPortalAgent = false, pagePanel, suggestionCardsView, draftMessage, caseWorkflow, activeCases, onStop, isCreatingConversation, conversationError, questionnaireData, onQuestionnaireDismiss, simplifiedAgent = false, subHeading, operatorName, ...restProps }) => {
75
102
  const scrollTolerancePx = 2;
76
103
  const scrollThresholdPx = 50;
77
- const streamBufferLh = 5;
104
+ const streamBufferLh = simplifiedAgent ? 15 : 5;
78
105
  const bufferExtensionLh = 2;
79
106
  const scrollThrottleMs = 50;
80
107
  const resizeThrottleMs = 33;
108
+ const bannerTransitionMs = 600;
81
109
  const theme = useTheme();
82
110
  const t = useI18n();
83
111
  const testIds = useTestIds(testId, getGenAICoachTestIds);
@@ -86,9 +114,16 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
86
114
  const conversationRef = useRef(null);
87
115
  const genAICoachRef = useRef(null);
88
116
  const [messageEls, getMessageCbRef] = useRefMap();
117
+ const [showInitialScreen, setShowInitialScreen] = useState(true);
118
+ const prevExpandedHeightRef = useRef(0);
119
+ const agentInBanner = simplifiedAgent && variant.placement === 'fullpage';
120
+ const agentExpanded = simplifiedAgent && messages.length > 0;
89
121
  const focusInMessageListRef = useRef(false);
90
122
  const mouseTriggeredFocusRef = useRef(false);
91
123
  const isUserTriggered = useRef(false);
124
+ const userInitiatedSendRef = useRef(false);
125
+ const userInitiatedNewChatRef = useRef(false);
126
+ const showNextCoachSender = useRef(true);
92
127
  const lastFocusedMessageRef = useRef(null);
93
128
  const initialFocusedElementRef = useRef(null);
94
129
  const inputContainerRef = useRef(null);
@@ -133,6 +168,7 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
133
168
  const [ctxFullscreen, toggleFullscreen] = useFullscreenContext() ?? [];
134
169
  const fullScreen = !!ctxFullscreen;
135
170
  const questionnaireKey = questionnaireData?.questions?.map(q => q.field).join(',') ?? '';
171
+ const initialFormAnswers = useMemo(() => buildInitialFormAnswers(questionnaireData?.questions), [questionnaireData?.questions]);
136
172
  const [showScrollToBottom, setShowScrollToBottom] = useState(false);
137
173
  const prevFullScreen = usePrevious(fullScreen);
138
174
  const prevIsSmallOrAbove = usePrevious(isSmallOrAbove);
@@ -435,6 +471,9 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
435
471
  isCoachMessageLoading ||
436
472
  (latestMessage && isCoachMessage(latestMessage) && latestMessage.isToolConfirmation))
437
473
  return;
474
+ if (simplifiedAgent) {
475
+ userInitiatedSendRef.current = true;
476
+ }
438
477
  onSend({
439
478
  id: createUID(),
440
479
  message,
@@ -472,11 +511,33 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
472
511
  } }));
473
512
  }, [coachOptions, selectedCoach, isPortalAgent, pagePanel?.visible]);
474
513
  const headerContent = useMemo(() => {
514
+ if (simplifiedAgent && showInitialScreen)
515
+ return null;
475
516
  return isInUtilities(variant) && variant.state === 'minimized' ? (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'h2', 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: () => {
476
517
  variant.onStateChange('maximized');
477
518
  isUserTriggered.current = true;
478
- }, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: { gap: 0.5 }, as: StyledActionsContainer, children: [activeCases && _jsx(ActiveCases, { activeCases: activeCases }), onNewChat && (_jsx(Button, { icon: true, variant: 'simple', label: t('new_chat'), "aria-label": t('new_chat'), onClick: onNewChat, children: _jsx(Icon, { name: 'plus' }) })), _jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions }), variant.placement === 'dialog' && !fullScreen && (_jsx(Button, { icon: true, label: t('close'), "aria-label": t('close_chat_with_ai'), variant: 'simple', onClick: variant.onClose, children: _jsx(Icon, { name: 'times' }) }))] })] }));
479
- }, [variant, coachOptions, activeCases, actions, allowFullScreen, onNewChat]);
519
+ }, children: _jsx(Icon, { name: 'caret-up' }) }) })] })) : (_jsxs(_Fragment, { children: [renderCoachOptions, _jsxs(Flex, { container: { gap: 0.5 }, as: StyledActionsContainer, children: [activeCases && _jsx(ActiveCases, { activeCases: activeCases }), simplifiedAgent && (_jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions, simplifiedAgent: true })), onNewChat && (_jsx(Button, { icon: true, variant: 'simple', label: simplifiedAgent ? t('close') : t('new_chat'), "aria-label": simplifiedAgent ? t('close_chat_with_ai') : t('new_chat'), onClick: () => {
520
+ if (simplifiedAgent && genAICoachRef.current) {
521
+ prevExpandedHeightRef.current =
522
+ genAICoachRef.current.getBoundingClientRect().height;
523
+ }
524
+ userInitiatedNewChatRef.current = true;
525
+ if (simplifiedAgent && conversationHistory) {
526
+ conversationHistory.onDismiss();
527
+ }
528
+ onNewChat?.();
529
+ }, children: _jsx(Icon, { name: simplifiedAgent ? 'times' : 'plus' }) })), !simplifiedAgent && (_jsx(HeaderActions, { actions: actions, allowFullScreen: allowFullScreen, variant: variant, isUserTriggeredRef: isUserTriggered, onFullscreenToggle: toggleFullscreen, isFullscreen: fullScreen, selectedCoach: selectedCoach, actionsTestId: testIds.actions })), variant.placement === 'dialog' && !fullScreen && (_jsx(Button, { icon: true, label: t('close'), "aria-label": t('close_chat_with_ai'), variant: 'simple', onClick: variant.onClose, children: _jsx(Icon, { name: 'times' }) }))] })] }));
530
+ }, [
531
+ variant,
532
+ coachOptions,
533
+ activeCases,
534
+ actions,
535
+ allowFullScreen,
536
+ onNewChat,
537
+ simplifiedAgent,
538
+ showInitialScreen,
539
+ messages.length
540
+ ]);
480
541
  const getMessageContainingElement = (element) => {
481
542
  if (element)
482
543
  return Array.from(messageEls.values()).find(el => el && el.contains(element));
@@ -509,9 +570,11 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
509
570
  useEffect(() => {
510
571
  if (questionnaireData) {
511
572
  setQuestionnaireDismissed(false);
512
- setFormAnswers(undefined);
573
+ setFormAnswers(initialFormAnswers);
574
+ return;
513
575
  }
514
- }, [questionnaireData]);
576
+ setFormAnswers(undefined);
577
+ }, [initialFormAnswers, questionnaireData, questionnaireKey]);
515
578
  useEffect(() => {
516
579
  if (draftMessage !== undefined) {
517
580
  setMessage(draftMessage);
@@ -519,9 +582,70 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
519
582
  textAreaRef.current?.focus();
520
583
  }
521
584
  }, [draftMessage, suggestionCardsView]);
585
+ useLayoutEffect(() => {
586
+ if (!agentInBanner ||
587
+ !genAICoachRef.current ||
588
+ messages.length !== 0 ||
589
+ (loading && conversationHistory))
590
+ return;
591
+ const el = genAICoachRef.current;
592
+ const currentHeight = el.getBoundingClientRect().height;
593
+ const storedHeight = parseFloat(el.style.getPropertyValue('--compact-height')) || 0;
594
+ if (storedHeight > 0 && Math.abs(currentHeight - storedHeight) > scrollTolerancePx)
595
+ return;
596
+ el.style.removeProperty('--compact-height');
597
+ const naturalHeight = el.getBoundingClientRect().height;
598
+ el.style.setProperty('--compact-height', `${naturalHeight}px`);
599
+ });
600
+ useLayoutEffect(() => {
601
+ if (!agentInBanner || messages.length !== 0)
602
+ return;
603
+ if (!userInitiatedNewChatRef.current || !genAICoachRef.current)
604
+ return;
605
+ userInitiatedNewChatRef.current = false;
606
+ const el = genAICoachRef.current;
607
+ const fromHeight = prevExpandedHeightRef.current;
608
+ const toHeight = parseFloat(el.style.getPropertyValue('--compact-height')) || 0;
609
+ if (!fromHeight || !toHeight)
610
+ return;
611
+ el.style.height = `${fromHeight}px`;
612
+ el.style.transition = 'none';
613
+ const removeListener = onHeightTransitionEnd(el, () => {
614
+ el.style.removeProperty('height');
615
+ prevExpandedHeightRef.current = 0;
616
+ });
617
+ const rafId = requestAnimationFrame(() => {
618
+ el.getBoundingClientRect();
619
+ el.style.removeProperty('transition');
620
+ el.style.height = `${toHeight}px`;
621
+ });
622
+ return () => {
623
+ cancelAnimationFrame(rafId);
624
+ removeListener();
625
+ };
626
+ }, [messages.length, agentInBanner]);
522
627
  useEffect(() => {
523
- setFormAnswers(undefined);
524
- }, [questionnaireKey]);
628
+ if (!agentInBanner)
629
+ return;
630
+ if (messages.length === 0) {
631
+ if (!(loading && conversationHistory)) {
632
+ setShowInitialScreen(true);
633
+ }
634
+ userInitiatedSendRef.current = false;
635
+ return;
636
+ }
637
+ if (!showInitialScreen)
638
+ return;
639
+ if (!userInitiatedSendRef.current) {
640
+ setShowInitialScreen(false);
641
+ return;
642
+ }
643
+ const timer = setTimeout(() => {
644
+ setShowInitialScreen(false);
645
+ userInitiatedSendRef.current = false;
646
+ }, bannerTransitionMs);
647
+ return () => clearTimeout(timer);
648
+ }, [messages.length, agentInBanner, showInitialScreen]);
525
649
  useEffect(() => {
526
650
  if (isUserTriggered.current) {
527
651
  if (isInUtilities(variant) &&
@@ -711,10 +835,10 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
711
835
  if (!(e.relatedTarget instanceof Node) || !e.currentTarget.contains(e.relatedTarget)) {
712
836
  setFocused(false);
713
837
  }
714
- }, children: [questionnaireData && !questionnaireDismissed && !questionnaireData.inline && (_jsx(Questionnaire, { data: questionnaireData, onChange: handleFormChange, onCancel: handleFormCancel }, questionnaireKey)), _jsx(FormField, { label: t('message_pega_gen_ai_coach'), labelHidden: true, labelFor: composerId, info: conversationError || undefined, status: conversationError ? 'error' : undefined, children: _jsx(StyledGenAIFormControl, { focused: (!questionnaireData || questionnaireDismissed) && focused, status: conversationError ? 'error' : undefined, children: _jsxs(Flex, { container: { direction: 'column', gap: 0.25 }, children: [_jsx(StyledGenAITextArea, { id: composerId, ref: textAreaRef, value: interimMessage ? `${message}${interimMessage}` : message, placeholder: t('write_message'), onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: () => {
838
+ }, children: [questionnaireData && !questionnaireDismissed && !questionnaireData.inline && (_jsx(Questionnaire, { data: questionnaireData, onChange: handleFormChange, onCancel: handleFormCancel }, questionnaireKey)), _jsx(FormField, { label: t('message_pega_gen_ai_coach'), labelHidden: true, labelFor: composerId, info: conversationError || undefined, status: conversationError ? 'error' : undefined, children: _jsx(StyledGenAIFormControl, { focused: (!questionnaireData || questionnaireDismissed) && focused, status: conversationError ? 'error' : undefined, children: _jsxs(Flex, { container: { direction: 'column', gap: 0.25 }, children: [_jsx(StyledGenAITextArea, { id: composerId, ref: textAreaRef, value: interimMessage ? `${message}${interimMessage}` : message, placeholder: simplifiedAgent ? t('ask_anything', [selectedCoach ?? '']) : t('write_message'), onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: () => {
715
839
  if (active)
716
840
  stop();
717
- }, autoResize: true }), _jsxs(Flex, { container: {
841
+ }, autoResize: true, simplified: simplifiedAgent }), _jsxs(Flex, { container: {
718
842
  direction: 'row',
719
843
  justify: 'between',
720
844
  gap: 1,
@@ -756,13 +880,13 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
756
880
  return (_jsx(StyledStopGeneratingButton, { variant: 'primary', icon: true, label: t('stop'), "aria-label": t('stop'), onClick: () => {
757
881
  textAreaRef.current?.focus();
758
882
  onStopFn?.();
759
- }, children: _jsx(Icon, { name: 'square-solid' }) }));
883
+ }, simplified: simplifiedAgent, children: _jsx(Icon, { name: 'square-solid' }) }));
760
884
  }
761
885
  const isLoading = latestMessage &&
762
886
  isCoachMessage(latestMessage) &&
763
887
  latestMessage.loading &&
764
888
  !latestMessage.error;
765
- const sendButton = (_jsx(StyledSendButton, { variant: 'primary', onClick: isCreatingConversation ? undefined : handleSendMessage, icon: true, label: t('send'), "aria-label": t('send_message'), children: _jsx(Icon, { name: 'send-solid' }) }));
889
+ const sendButton = (_jsx(StyledSendButton, { variant: 'primary', onClick: isCreatingConversation ? undefined : handleSendMessage, icon: true, label: t('send'), "aria-label": t('send_message'), simplified: simplifiedAgent, children: _jsx(Icon, { name: 'send-solid' }) }));
766
890
  if (isLoading) {
767
891
  if (isCreatingConversation) {
768
892
  return sendButton;
@@ -779,28 +903,35 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
779
903
  const isCompact = variant.placement === 'fullpage' &&
780
904
  !fullScreen &&
781
905
  !isInLandingPageUtilities &&
782
- messages.length === 0;
906
+ messages.length === 0 &&
907
+ !(simplifiedAgent && loading && conversationHistory);
783
908
  const fullPageAndInitialScreen = (fullScreen || (variant.placement === 'fullpage' && !isInLandingPageUtilities)) &&
784
909
  messages.length === 0;
785
- const renderTextArea = fullPageAndInitialScreen ? null : genAIFooter;
786
- const GenAICoachElement = (_jsx(_Fragment, { children: ((isInUtilities(variant) && variant.state !== 'minimized') || !isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column' }, as: StyledFlexWrapper, children: [caseWorkflow && _jsx(CaseWorkflow, { ...caseWorkflow }), _jsx(Flex, { as: StyledMessagesContainer, ref: setMessageContainerRef, withSuggestionCards: !loading && !error && messages.length === 0 && !!suggestionCardsView, container: loading || error
910
+ const renderTextArea = agentInBanner || !fullPageAndInitialScreen ? genAIFooter : null;
911
+ const GenAICoachElement = (_jsx(_Fragment, { children: ((isInUtilities(variant) && variant.state !== 'minimized') || !isInUtilities(variant)) && (_jsxs(Flex, { container: { direction: 'column' }, as: StyledFlexWrapper, isExpanded: agentInBanner && agentExpanded, children: [caseWorkflow && _jsx(CaseWorkflow, { ...caseWorkflow }), _jsx(Flex, { as: StyledMessagesContainer, ref: setMessageContainerRef, withSuggestionCards: !loading && !error && messages.length === 0 && !!suggestionCardsView, container: loading || error
787
912
  ? { direction: 'column', pad: [0, 2], justify: 'center' }
788
913
  : { direction: 'column', pad: [0, 2] }, ...(!loading && !error && messages.length === 0 && suggestionCardsView
789
914
  ? {}
790
- : { item: { grow: 1 } }), onScroll: updateScrollStateOnScrollEvent, 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: {
915
+ : { item: { grow: 1 } }), onScroll: updateScrollStateOnScrollEvent, children: loading || error ? (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, children: loading ? (_jsx(ThemeOverride, { theme: {
916
+ base: {
917
+ palette: {
918
+ 'primary-background': theme.components.agent.background
919
+ }
920
+ }
921
+ }, children: _jsx(Progress, { variant: 'ring', placement: 'block', message: typeof loading === 'string' ? loading : t('loading') }) })) : (_jsx(ErrorState, { message: error })) })) : (_jsx(_Fragment, { children: (agentInBanner ? showInitialScreen : messages.length === 0) ? (_jsxs(Flex, { as: StyledInitialMessageContainer, container: {
791
922
  justify: suggestionCardsView ? undefined : 'center',
792
923
  direction: 'column',
793
924
  alignItems: 'center',
794
- gap: 4,
795
- pad: [6, 0, 2, 0]
925
+ gap: simplifiedAgent ? 2 : 4,
926
+ pad: simplifiedAgent ? [0, 0, 2, 0] : [6, 0, 2, 0]
796
927
  }, ...(suggestionCardsView ? {} : { item: { grow: 1 } }), children: [((isInUtilities(variant) && variant.state === 'maximized') ||
797
928
  !isInUtilities(variant)) &&
798
929
  showSalutation && (_jsxs(Flex, { container: {
799
930
  direction: 'column',
800
931
  alignItems: 'center',
801
- gap: 2,
802
- pad: [0, 2]
803
- }, children: [_jsx(AgentIcon, {}), _jsx(Text, { variant: 'h3', as: StyledSalutation, children: salutation ?? t('welcome_text') })] })), initialSuggestedMessages && initialSuggestedMessages.length > 0 && (_jsx(Grid, { as: StyledInitialMessageGrid, container: { cols: getGridColumns(), gap: 1.5 }, children: initialSuggestedMessages.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
932
+ gap: simplifiedAgent ? 2.5 : 2,
933
+ pad: simplifiedAgent ? [0, 2, 1, 2] : [0, 2]
934
+ }, as: simplifiedAgent ? StyledBannerSalutationBlock : undefined, isExpanded: agentExpanded, children: [!simplifiedAgent && _jsx(AgentIcon, {}), _jsx(StyledSalutation, { variant: simplifiedAgent ? 'h1' : 'h3', simplified: simplifiedAgent, children: salutation ?? t('welcome_text') }), simplifiedAgent && (_jsx(StyledSubHeading, { variant: 'primary', as: 'p', children: subHeading ?? t('what_can_i_help_you_with') }))] })), initialSuggestedMessages && initialSuggestedMessages.length > 0 && (_jsx(Grid, { as: StyledInitialMessageGrid, container: { cols: getGridColumns(), gap: 1.5 }, children: initialSuggestedMessages.map(initialSuggestedMessage => (_jsx(InitialSuggestedMessage, { ...initialSuggestedMessage, onSend: initialMessage => {
804
935
  if (guidedMode) {
805
936
  onSend({
806
937
  id: initialMessage.id,
@@ -812,7 +943,11 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
812
943
  }
813
944
  isUserTriggered.current = true;
814
945
  textAreaRef.current?.focus();
815
- }, testId: initialSuggestedMessage.id }))) })), fullPageAndInitialScreen && !guidedMode && !suggestionCardsView && genAIFooter] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onMouseDown: (e) => {
946
+ }, testId: initialSuggestedMessage.id }))) })), fullPageAndInitialScreen &&
947
+ !guidedMode &&
948
+ !suggestionCardsView &&
949
+ !agentInBanner &&
950
+ genAIFooter] })) : (_jsx(Flex, { as: StyledMessagesList, ref: conversationRef, simplified: simplifiedAgent, "aria-label": `${t('conversation')} ${t('view')}`, container: { direction: 'column' }, onMouseDown: (e) => {
816
951
  mouseTriggeredFocusRef.current = true;
817
952
  const target = e.target instanceof Element ? e.target : null;
818
953
  const clickedMessage = getMessageContainingElement(target);
@@ -904,11 +1039,13 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
904
1039
  }
905
1040
  }
906
1041
  }, children: messages.map(item => {
907
- const messageProps = isCoachMessage(item)
908
- ? {
1042
+ let messageProps;
1043
+ if (isCoachMessage(item)) {
1044
+ messageProps = {
909
1045
  ...item,
910
1046
  suggestions: latestMessage?.id === item.id ? item.suggestions : undefined,
911
1047
  onSend,
1048
+ showSenderInfo: simplifiedAgent ? showNextCoachSender.current : undefined,
912
1049
  onSubmit: item.isToolConfirmation
913
1050
  ? (tools) => {
914
1051
  onSend({
@@ -918,13 +1055,21 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
918
1055
  });
919
1056
  }
920
1057
  : undefined
921
- }
922
- : item;
1058
+ };
1059
+ showNextCoachSender.current = false;
1060
+ }
1061
+ else if (isUserMessage(item) && simplifiedAgent) {
1062
+ showNextCoachSender.current = true;
1063
+ messageProps = { ...item, userName: operatorName };
1064
+ }
1065
+ else {
1066
+ messageProps = item;
1067
+ }
923
1068
  return (_jsx(GenAIMessage, { ...messageProps, ref: getMessageCbRef(item.id), testId: item.id, announceInteraction: !focusInMessageListRef.current, onAnimationCursorUpdate: animatedTillCursor => {
924
1069
  if (isCoachMessage(item)) {
925
1070
  setAnimationInitialCursorPos(animatedTillCursor);
926
1071
  }
927
- }, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
1072
+ }, simplifiedAgent: simplifiedAgent, ...(prevFullScreen !== fullScreen ? { animationInitialCursorPos } : {}) }));
928
1073
  }) })) })) }), showScrollToBottom && (_jsx(StyledScrollButton, { ref: scrollButtonRef, icon: true, onClick: handleScrollToBottomClick, ariaLabel: t('scroll_to_latest_message'), onKeyDown: focusLastMessageLi, children: _jsx(Icon, { name: 'caret-down' }) })), !loading && messages.length === 0 && suggestionCardsView ? (_jsxs(_Fragment, { children: [((isInUtilities(variant) && variant.state !== 'minimized') ||
929
1074
  !isInUtilities(variant)) &&
930
1075
  !guidedMode && (_jsx(StyledStickyComposer, { children: _jsx(Flex, { container: { direction: 'column' }, as: StyledInputContainer, ref: setInputContainerRef, children: _jsx(StyledComposerSection, { children: genAIFooter }) }) })), _jsx(Flex, { container: { direction: 'column' }, as: StyledSuggestionCardsBottomHalf, children: _jsx(StyledSuggestionCardsView, { ref: setSuggestionCardsViewRef, children: suggestionCardsView }) })] })) : (((isInUtilities(variant) && variant.state !== 'minimized') ||
@@ -994,7 +1139,11 @@ const GenAICoachContent = ({ testId, coachOptions: coachOptionsProps, onCoachCha
994
1139
  focusTextArea.current = true;
995
1140
  conversationHistory.onDismiss();
996
1141
  }, inFullPage: !condition, ref: historyViewRef }));
997
- return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, as: StyledGenAICoachContainer, "data-testid": testIds.root, variant: variant, fullScreen: fullScreen, isCompact: isCompact, isPortalAgent: isPortalAgent, ref: genAICoachRef, children: [_jsx(Flex, { container: { justify: 'between', alignItems: 'center', pad: [1.5, 2, 0.5] }, children: headerContent }), condition ? (_jsx(_Fragment, { children: conversationHistory ? historyView : GenAICoachElement })) : (_jsxs(Grid, { container: { gap: 0.5, cols: '2fr 3fr' }, as: StyledGridContainer, conversationHistory: !!conversationHistory, children: [historyView, GenAICoachElement] })), lightboxPreviewProps && _jsx(Lightbox, { ...lightboxPreviewProps })] }));
1142
+ return (_jsxs(Flex, { ...restProps, container: { direction: 'column' }, as: StyledGenAICoachContainer, "data-testid": testIds.root, variant: variant, fullScreen: fullScreen, isCompact: isCompact, isPortalAgent: isPortalAgent, simplifiedAgent: simplifiedAgent, ref: genAICoachRef, children: [_jsx(Flex, { as: agentExpanded ? StyledHeaderContainer : undefined, container: {
1143
+ justify: 'between',
1144
+ alignItems: 'center',
1145
+ pad: simplifiedAgent ? [0, 2, 0.5] : [1.5, 2, 0.5]
1146
+ }, children: headerContent }), condition ? (_jsx(_Fragment, { children: conversationHistory ? historyView : GenAICoachElement })) : (_jsxs(Grid, { container: { gap: 0.5, cols: '2fr 3fr' }, as: StyledGridContainer, conversationHistory: !!conversationHistory, children: [historyView, GenAICoachElement] })), lightboxPreviewProps && _jsx(Lightbox, { ...lightboxPreviewProps })] }));
998
1147
  };
999
1148
  const GenAICoach = (props) => (_jsx(Toaster, { children: _jsx(StyledFullscreenWrapper, { children: _jsx(GenAICoachContent, { ...props }) }) }));
1000
1149
  export default withTestIds(GenAICoach, getGenAICoachTestIds);