@pega/cosmos-react-work 9.0.0-build.10.0 → 9.0.0-build.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/ArticleList/ArticleBuddyResponse.d.ts.map +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js +1 -1
- package/lib/components/ArticleList/ArticleBuddyResponse.js.map +1 -1
- package/lib/components/ArticleList/ArticleList.types.d.ts +2 -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/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +4 -1
- package/lib/components/CaseView/CaseView.styles.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 +92 -50
- package/lib/components/GenAICoach/GenAICoach.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts +19 -2
- package/lib/components/GenAICoach/GenAICoach.styles.d.ts.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.styles.js +124 -21
- package/lib/components/GenAICoach/GenAICoach.styles.js.map +1 -1
- package/lib/components/GenAICoach/GenAICoach.types.d.ts +6 -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 +13 -5
- package/lib/components/GenAICoach/GenAIMessage.js.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.d.ts.map +1 -1
- package/lib/components/GenAICoach/InitialSuggestedMessage.js +5 -6
- package/lib/components/GenAICoach/InitialSuggestedMessage.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js +3 -2
- package/lib/components/UtilitiesLayout/UtilitiesLayout.js.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.d.ts.map +1 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js +2 -1
- package/lib/components/UtilitiesLayout/UtilitiesLayout.styles.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.styles.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenAICoach.styles.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.styles.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,eAAO,MAAM,oBAAoB,wGAAc,CAAC;AAGhD,eAAO,MAAM,qBAAqB,yGAAe,CAAC;AAElD,eAAO,MAAM,uBAAuB,yGAYnC,CAAC;AAIF,eAAO,MAAM,yBAAyB;aAC3B,eAAe,CAAC,SAAS,CAAC;gBACvB,eAAe,CAAC,iBAAiB,CAAC;eACnC,OAAO;SA2EnB,CAAC;AAIF,eAAO,MAAM,sBAAsB;2BAxEgB,CAAC;uDA6FlD,CAAC;AAIH,eAAO,MAAM,qBAAqB;2BAjGiB,CAAC;uDA6GlD,CAAC;AAIH,eAAO,MAAM,oBAAoB;gBAA8B,OAAO;SAgBpE,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAY7B,CAAC;AAIF,eAAO,MAAM,mBAAmB;yBAAqC,OAAO;SAa3E,CAAC;AAIF,eAAO,MAAM,6BAA6B,yGAOxC,CAAC;AAIH,eAAO,MAAM,oBAAoB,kNAe/B,CAAC;AAIH,eAAO,MAAM,gBAAgB,oNAe3B,CAAC;AAIH,eAAO,MAAM,0BAA0B,yGAUtC,CAAC;AAIF,eAAO,MAAM,eAAe,kNAK1B,CAAC;AAIH,eAAO,MAAM,aAAa,uGAQxB,CAAC;AAIH,eAAO,MAAM,iBAAiB,wGAqB7B,CAAC;AAIF,eAAO,MAAM,sBAAsB,yGAoBjC,CAAC;AAIH,eAAO,MAAM,kBAAkB,wGA4B9B,CAAC;AAIF,eAAO,MAAM,sBAAsB;gBAA8B,OAAO;SAcvE,CAAC;AAIF,eAAO,MAAM,UAAU,kNAMtB,CAAC;AAIF,eAAO,MAAM,4BAA4B;2BAzVnC,CAAF;uDA6WF,CAAC;AAIH,eAAO,MAAM,iBAAiB,wGAI7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,yGAQ5B,CAAC;AAIH,eAAO,MAAM,oBAAoB,yGAI/B,CAAC;AAIH,eAAO,MAAM,WAAW,2GAItB,CAAC;AAEH,eAAO,MAAM,qBAAqB,+QAIhC,CAAC;AAIH,eAAO,MAAM,uBAAuB;2BAvae,CAAC;uDA6anD,CAAC;AAEF,eAAO,MAAM,eAAe,yGAG3B,CAAC;AAIF,eAAO,MAAM,sBAAsB;cAAmC,OAAO;SAmB3E,CAAC;AAIH,eAAO,MAAM,mBAAmB;2BA3ehB,CAAC;uDAyff,CAAC;AAIH,eAAO,MAAM,gBAAgB,oNAgB3B,CAAC;AAIH,eAAO,MAAM,wBAAwB,yGAGpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,oNAiBrC,CAAC;AAIH,eAAO,MAAM,wBAAwB,0GAEpC,CAAC;AAEF,eAAO,MAAM,iBAAiB;2BA9fA,CAAC;uDA0gB7B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAG7B,CAAC"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { mix } from 'polished';
|
|
4
|
-
import { AppShellContext, Button, FileList, Flex, MenuButton, StyledEmptyState, StyledErrorState, StyledIcon, StyledText, SummaryItem, Text, calculateFontSize, defaultThemeProp, tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
import { AppShellContext, Button, FileList, Flex, FormControl, MenuButton, StyledEmptyState, StyledErrorState, StyledIcon, StyledText, SummaryItem, Text, TextArea, calculateFontSize, defaultThemeProp, tryCatch, Avatar } from '@pega/cosmos-react-core';
|
|
5
5
|
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
6
6
|
import { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';
|
|
7
7
|
import { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';
|
|
8
8
|
import { StyledProgress } from '@pega/cosmos-react-core/lib/components/Progress/Progress.styles';
|
|
9
9
|
import { resizeDrawerMaxWidth } from '@pega/cosmos-react-core/lib/styles/constants';
|
|
10
|
+
import { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';
|
|
10
11
|
import { isInUtilities } from './GenAICoach.utils';
|
|
11
12
|
export const StyledMessageWrapper = styled.li ``;
|
|
12
13
|
const maxWidthMessage = '46rem';
|
|
13
14
|
export const StyledComposerSection = styled.div ``;
|
|
14
|
-
export const
|
|
15
|
+
export const StyledMessagesContainer = styled.div(({ theme: { base: { spacing } } }) => {
|
|
16
|
+
return css `
|
|
17
|
+
margin-block-end: calc(2 * ${spacing});
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
`;
|
|
21
|
+
});
|
|
22
|
+
StyledMessagesContainer.defaultProps = defaultThemeProp;
|
|
23
|
+
export const StyledGenAICoachContainer = styled.div(({ theme: { base: { palette, 'z-index': zIndex, spacing, breakpoints, animation }, components: { card: { 'border-radius': borderRadius }, 'accent-card': { 'primary-background': agentBackground } } }, variant, fullScreen, isCompact }) => {
|
|
15
24
|
const { previewActive } = useContext(AppShellContext);
|
|
16
25
|
return css `
|
|
17
|
-
background: ${
|
|
26
|
+
background: ${agentBackground};
|
|
18
27
|
min-width: var(--utilities-drawer-min-width);
|
|
19
28
|
border-radius: ${borderRadius};
|
|
29
|
+
transition: height ${animation.speed} ${animation.timing.ease};
|
|
30
|
+
|
|
20
31
|
${isInUtilities(variant) &&
|
|
32
|
+
!fullScreen &&
|
|
21
33
|
css `
|
|
22
34
|
min-height: 3rem;
|
|
23
35
|
max-width: 31.25rem;
|
|
@@ -47,12 +59,27 @@ export const StyledGenAICoachContainer = styled.div(({ theme: { base: { palette,
|
|
|
47
59
|
FIXME: This is a stopgap to address issue in Android web views via React Native where VH units do not work
|
|
48
60
|
*/
|
|
49
61
|
${((isInUtilities(variant) && variant.state === 'maximized') || !isInUtilities(variant)) &&
|
|
62
|
+
!fullScreen &&
|
|
50
63
|
css `
|
|
51
64
|
height: calc(0.85 * var(--case-view-height, 95vh));
|
|
52
65
|
@media (pointer: coarse) and (max-width: ${breakpoints.md}) {
|
|
53
66
|
height: 40rem;
|
|
54
67
|
}
|
|
55
68
|
`}
|
|
69
|
+
|
|
70
|
+
${isCompact &&
|
|
71
|
+
css `
|
|
72
|
+
height: 26rem;
|
|
73
|
+
${StyledMessagesContainer} {
|
|
74
|
+
margin-block-end: 0;
|
|
75
|
+
}
|
|
76
|
+
`}
|
|
77
|
+
|
|
78
|
+
${fullScreen &&
|
|
79
|
+
css `
|
|
80
|
+
height: 100vh;
|
|
81
|
+
border-radius: 0;
|
|
82
|
+
`}
|
|
56
83
|
`;
|
|
57
84
|
});
|
|
58
85
|
StyledGenAICoachContainer.defaultProps = defaultThemeProp;
|
|
@@ -70,14 +97,13 @@ export const StyledGenAIOptionsMenu = styled(MenuButton)(({ theme: { base: { 'fo
|
|
|
70
97
|
`;
|
|
71
98
|
});
|
|
72
99
|
StyledGenAIOptionsMenu.defaultProps = defaultThemeProp;
|
|
73
|
-
export const
|
|
74
|
-
const { xxs: buttonFontSize } = calculateFontSize(fontSize, fontScale);
|
|
100
|
+
export const StyledMenuSuggestions = styled(MenuButton)(({ theme: { base: { 'border-radius': baseBorderRadius, spacing }, components: { button: { 'border-radius': borderRadius } } } }) => {
|
|
75
101
|
return css `
|
|
76
|
-
|
|
77
|
-
|
|
102
|
+
padding: calc(0.75 * ${spacing});
|
|
103
|
+
border-radius: calc(${baseBorderRadius} * ${borderRadius});
|
|
78
104
|
`;
|
|
79
105
|
});
|
|
80
|
-
|
|
106
|
+
StyledMenuSuggestions.defaultProps = defaultThemeProp;
|
|
81
107
|
export const StyledDisclaimerText = styled(Text)(({ inFullPage, theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, spacing } } }) => {
|
|
82
108
|
const systemFontSize = calculateFontSize(fontSize, fontScale).xs;
|
|
83
109
|
return css `
|
|
@@ -91,14 +117,6 @@ export const StyledDisclaimerText = styled(Text)(({ inFullPage, theme: { base: {
|
|
|
91
117
|
`;
|
|
92
118
|
});
|
|
93
119
|
StyledDisclaimerText.defaultProps = defaultThemeProp;
|
|
94
|
-
export const StyledMessagesContainer = styled.div(({ theme: { base: { spacing } } }) => {
|
|
95
|
-
return css `
|
|
96
|
-
margin-block-end: calc(2 * ${spacing});
|
|
97
|
-
height: 100%;
|
|
98
|
-
overflow-y: auto;
|
|
99
|
-
`;
|
|
100
|
-
});
|
|
101
|
-
StyledMessagesContainer.defaultProps = defaultThemeProp;
|
|
102
120
|
export const StyledFlexWrapper = styled.div(({ theme: { base: { spacing } } }) => {
|
|
103
121
|
return css `
|
|
104
122
|
margin-block-start: ${spacing};
|
|
@@ -120,10 +138,13 @@ export const StyledGridContainer = styled.div(({ theme: { base }, conversationHi
|
|
|
120
138
|
`;
|
|
121
139
|
});
|
|
122
140
|
StyledGridContainer.defaultProps = defaultThemeProp;
|
|
123
|
-
export const StyledInitialMessageContainer = styled.div((
|
|
141
|
+
export const StyledInitialMessageContainer = styled.div(() => {
|
|
124
142
|
return css `
|
|
125
|
-
|
|
126
|
-
|
|
143
|
+
${StyledFormField} {
|
|
144
|
+
width: 100%;
|
|
145
|
+
max-width: ${maxWidthMessage};
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
127
148
|
});
|
|
128
149
|
StyledInitialMessageContainer.defaultProps = defaultThemeProp;
|
|
129
150
|
export const StyledInputContainer = styled(Flex)(({ theme: { base: { spacing } } }) => {
|
|
@@ -175,10 +196,10 @@ export const StyledMessage = styled.p(({ theme }) => {
|
|
|
175
196
|
`;
|
|
176
197
|
});
|
|
177
198
|
StyledMessage.defaultProps = defaultThemeProp;
|
|
178
|
-
export const StyledUserMessage = styled.li(({ theme: { base: { 'border-radius': borderRadius, spacing,
|
|
199
|
+
export const StyledUserMessage = styled.li(({ theme: { base: { 'border-radius': borderRadius, spacing }, components: { 'accent-card': { 'secondary-background': agentUserMessageBackground } } } }) => {
|
|
179
200
|
return css `
|
|
180
201
|
overflow-wrap: break-word;
|
|
181
|
-
background: ${
|
|
202
|
+
background: ${agentUserMessageBackground};
|
|
182
203
|
margin-inline-start: calc(4 * ${spacing});
|
|
183
204
|
margin-block-end: calc(0.5 * ${spacing});
|
|
184
205
|
padding: calc(0.5 * ${spacing});
|
|
@@ -314,4 +335,86 @@ export const StyledGuidedSuggestions = styled(MenuButton) `
|
|
|
314
335
|
justify-content: center;
|
|
315
336
|
}
|
|
316
337
|
`;
|
|
338
|
+
export const StyledAgentIcon = styled.svg `
|
|
339
|
+
width: 3rem;
|
|
340
|
+
height: 3rem;
|
|
341
|
+
`;
|
|
342
|
+
StyledAgentIcon.defaultProps = defaultThemeProp;
|
|
343
|
+
export const StyledGenAIFormControl = styled(FormControl)(({ theme, focused }) => {
|
|
344
|
+
return css `
|
|
345
|
+
overflow: hidden;
|
|
346
|
+
|
|
347
|
+
${focused &&
|
|
348
|
+
css `
|
|
349
|
+
&:not([disabled]) {
|
|
350
|
+
border-color: ${theme.components['form-control'][':focus']['border-color']};
|
|
351
|
+
box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {
|
|
355
|
+
border-color: transparent;
|
|
356
|
+
}
|
|
357
|
+
`}
|
|
358
|
+
`;
|
|
359
|
+
});
|
|
360
|
+
StyledGenAIFormControl.defaultProps = defaultThemeProp;
|
|
361
|
+
export const StyledGenAITextArea = styled(TextArea)(({ theme: { components } }) => {
|
|
362
|
+
return css `
|
|
363
|
+
border: none;
|
|
364
|
+
box-shadow: none;
|
|
365
|
+
min-height: ${components.input.height};
|
|
366
|
+
max-height: 6rem;
|
|
367
|
+
overflow-y: auto;
|
|
368
|
+
padding-block-end: 0;
|
|
369
|
+
&:focus:not([disabled]) {
|
|
370
|
+
border: none;
|
|
371
|
+
box-shadow: none;
|
|
372
|
+
background-color: transparent;
|
|
373
|
+
}
|
|
374
|
+
`;
|
|
375
|
+
});
|
|
376
|
+
StyledGenAITextArea.defaultProps = defaultThemeProp;
|
|
377
|
+
export const StyledSendButton = styled(Button)(({ theme: { base: { palette, 'border-radius': baseBorderRadius }, components: { 'form-control': { 'border-radius': formControlBorderRadius } } } }) => {
|
|
378
|
+
return css `
|
|
379
|
+
border-radius: calc(${baseBorderRadius} * ${formControlBorderRadius});
|
|
380
|
+
margin-inline-start: auto;
|
|
381
|
+
|
|
382
|
+
${StyledIcon} {
|
|
383
|
+
color: ${palette.light};
|
|
384
|
+
}
|
|
385
|
+
`;
|
|
386
|
+
});
|
|
387
|
+
StyledSendButton.defaultProps = defaultThemeProp;
|
|
388
|
+
export const StyledInitialMessageGrid = styled.div `
|
|
389
|
+
max-width: ${maxWidthMessage};
|
|
390
|
+
width: 100%;
|
|
391
|
+
`;
|
|
392
|
+
export const StyledInitialMessageButton = styled(Button)(({ theme: { base: { spacing } } }) => {
|
|
393
|
+
return css `
|
|
394
|
+
white-space: normal;
|
|
395
|
+
text-align: left;
|
|
396
|
+
min-width: unset;
|
|
397
|
+
padding-block: ${spacing};
|
|
398
|
+
padding-inline: calc(2 * ${spacing});
|
|
399
|
+
align-items: start;
|
|
400
|
+
|
|
401
|
+
& + & {
|
|
402
|
+
margin-inline-start: 0;
|
|
403
|
+
}
|
|
404
|
+
`;
|
|
405
|
+
});
|
|
406
|
+
StyledInitialMessageButton.defaultProps = defaultThemeProp;
|
|
407
|
+
export const StyledInitialMessageText = styled.span `
|
|
408
|
+
${lineClamp(3)};
|
|
409
|
+
`;
|
|
410
|
+
export const StyledGenAIAvatar = styled(Avatar)(({ theme: { components: { 'accent-card': { avatar: { background: avatarBackground } } } } }) => {
|
|
411
|
+
return css `
|
|
412
|
+
background: ${avatarBackground};
|
|
413
|
+
`;
|
|
414
|
+
});
|
|
415
|
+
StyledGenAIAvatar.defaultProps = defaultThemeProp;
|
|
416
|
+
export const StyledGenAIFooter = styled.div `
|
|
417
|
+
width: 100%;
|
|
418
|
+
max-width: ${maxWidthMessage};
|
|
419
|
+
`;
|
|
317
420
|
//# sourceMappingURL=GenAICoach.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.styles.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4EAA4E,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,iEAAiE,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAGpF,OAAO,E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AAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClE,OAAO,GAAG,CAAA;eACG,KAAK,CAAC,IAAI,CAAC,OAAO;GAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;;eAE1C,eAAe;;;;CAI7B,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { useContext } from 'react';\nimport { mix } from 'polished';\n\nimport {\n AppShellContext,\n Button,\n FileList,\n Flex,\n MenuButton,\n StyledEmptyState,\n StyledErrorState,\n StyledIcon,\n StyledText,\n SummaryItem,\n Text,\n calculateFontSize,\n defaultThemeProp,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\nimport { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';\nimport { StyledProgress } from '@pega/cosmos-react-core/lib/components/Progress/Progress.styles';\nimport { resizeDrawerMaxWidth } from '@pega/cosmos-react-core/lib/styles/constants';\n\nimport type { GenAICoachProps } from './GenAICoach.types';\nimport { isInUtilities } from './GenAICoach.utils';\n\nexport const StyledMessageWrapper = styled.li``;\nconst maxWidthMessage = '46rem';\n\nexport const StyledComposerSection = styled.div``;\n\nexport const StyledGenAICoachContainer = styled.div<{\n variant: GenAICoachProps['variant'];\n}>(\n ({\n theme: {\n base: { palette, 'z-index': zIndex, spacing, breakpoints },\n components: {\n card: { 'border-radius': borderRadius }\n }\n },\n variant\n }) => {\n const { previewActive } = useContext(AppShellContext);\n return css`\n background: ${palette['primary-background']};\n min-width: var(--utilities-drawer-min-width);\n border-radius: ${borderRadius};\n ${isInUtilities(variant) &&\n css`\n min-height: 3rem;\n max-width: 31.25rem;\n box-shadow: 0 -1rem 1rem ${palette['app-background']};\n border-radius: ${borderRadius} ${borderRadius} 0 0;\n position: fixed;\n inset-block-end: 0;\n inset-inline-end: calc(2 * ${spacing});\n z-index: calc(${zIndex.drawer} + 1);\n width: 25rem;\n\n ${previewActive &&\n css`\n @media (min-width: ${breakpoints.xl}) {\n margin-inline-end: min(var(--resize-drawer-width), ${resizeDrawerMaxWidth});\n }\n `}\n\n ${variant.state === 'minimized' &&\n css`\n height: 3rem;\n `}\n `}\n\n /*\n ~85% of Utilities height and fixed height if screen size less than md and devices with coarse pointer\n FIXME: This is a stopgap to address issue in Android web views via React Native where VH units do not work\n */\n ${((isInUtilities(variant) && variant.state === 'maximized') || !isInUtilities(variant)) &&\n css`\n height: calc(0.85 * var(--case-view-height, 95vh));\n @media (pointer: coarse) and (max-width: ${breakpoints.md}) {\n height: 40rem;\n }\n `}\n `;\n }\n);\n\nStyledGenAICoachContainer.defaultProps = defaultThemeProp;\n\nexport const StyledGenAIOptionsMenu = styled(MenuButton)(({\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'font-weight': fontWeight,\n palette: { ai }\n }\n }\n}) => {\n const { l } = calculateFontSize(fontSize, fontScale);\n return css`\n color: inherit;\n ${StyledIcon}:first-child {\n color: ${ai};\n }\n ${StyledText} {\n font-weight: ${fontWeight['semi-bold']};\n font-size: ${l};\n }\n `;\n});\n\nStyledGenAIOptionsMenu.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestions = styled(MenuButton)(({\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { ai }\n }\n }\n}) => {\n const { xxs: buttonFontSize } = calculateFontSize(fontSize, fontScale);\n return css`\n color: ${ai};\n font-size: ${buttonFontSize};\n `;\n});\n\nStyledSuggestions.defaultProps = defaultThemeProp;\n\nexport const StyledDisclaimerText = styled(Text)<{ inFullPage: boolean }>(({\n inFullPage,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing }\n }\n}) => {\n const systemFontSize = calculateFontSize(fontSize, fontScale).xs;\n return css`\n font-size: ${systemFontSize};\n margin-block-start: ${spacing};\n ${inFullPage &&\n css`\n padding-block-end: calc(2 * ${spacing});\n `}\n opacity: 0.7;\n `;\n});\n\nStyledDisclaimerText.defaultProps = defaultThemeProp;\n\nexport const StyledMessagesContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-end: calc(2 * ${spacing});\n height: 100%;\n overflow-y: auto;\n `;\n }\n);\n\nStyledMessagesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlexWrapper = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-start: ${spacing};\n height: 100%;\n overflow-y: auto;\n `;\n }\n);\n\nStyledFlexWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledGridContainer = styled.div<{ conversationHistory: boolean }>(\n ({ theme: { base }, conversationHistory }) => {\n return css`\n height: 100%;\n min-height: 0;\n ${conversationHistory &&\n css`\n border: 0.0625rem solid ${base.palette['border-line']};\n margin: calc(2 * ${base.spacing});\n border-radius: ${base['border-radius']};\n `}\n `;\n }\n);\n\nStyledGridContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInitialMessageContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block: calc(2 * ${spacing});\n `;\n }\n);\n\nStyledInitialMessageContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInputContainer = styled(Flex)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n margin-block-end: calc(2 * ${spacing});\n margin-inline: calc(2 * ${spacing});\n align-items: center;\n\n ${StyledFormField}, ${StyledComposerSection} {\n width: 100%;\n max-width: ${maxWidthMessage};\n }\n `;\n});\n\nStyledInputContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestion = styled(Button)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n width: fit-content;\n padding: ${spacing};\n white-space: normal;\n word-break: break-word;\n & + & {\n margin-inline-start: 0;\n text-align: left;\n }\n `;\n});\n\nStyledSuggestion.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestionsContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-start: calc(1.5 * ${spacing});\n `;\n }\n);\n\nStyledSuggestionsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledTimeStamp = styled(Text)(() => {\n return css`\n display: flex;\n align-items: center;\n `;\n});\n\nStyledTimeStamp.defaultProps = defaultThemeProp;\n\nexport const StyledMessage = styled.p(({ theme }) => {\n return css`\n margin-block-start: calc(0.5 * ${theme.base.spacing});\n overflow-wrap: break-word;\n ${StyledEditorContainer} {\n padding: 0;\n }\n `;\n});\n\nStyledMessage.defaultProps = defaultThemeProp;\n\nexport const StyledUserMessage = styled.li(\n ({\n theme: {\n base: {\n 'border-radius': borderRadius,\n spacing,\n palette: { 'secondary-background': secondaryBackground }\n }\n }\n }) => {\n return css`\n overflow-wrap: break-word;\n background: ${secondaryBackground};\n margin-inline-start: calc(4 * ${spacing});\n margin-block-end: calc(0.5 * ${spacing});\n padding: calc(0.5 * ${spacing});\n border-start-start-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n border-start-end-radius: min(${borderRadius}, 0.5rem);\n border-end-start-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n border-end-end-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n `;\n }\n);\n\nStyledUserMessage.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedMessage = styled.div(({ theme }) => {\n return css`\n column-gap: calc(2 * ${theme.base.spacing});\n min-height: 2rem;\n max-width: calc(0.8 * ${maxWidthMessage});\n width: 100%;\n text-align: left;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding-inline-end: calc(2 * ${theme.base.spacing});\n cursor: pointer;\n &:hover,\n &:focus {\n border: 0.0625rem solid ${theme.base.palette.interactive};\n }\n ${StyledCardContent} {\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledSuggestedMessage.defaultProps = defaultThemeProp;\n\nexport const StyledMessagesList = styled.ul(\n ({\n theme: {\n base: { shadow, spacing }\n }\n }) => {\n return css`\n padding-block-start: ${spacing};\n list-style-type: none;\n align-self: center;\n max-width: ${maxWidthMessage};\n width: 100%;\n & > li {\n max-width: calc(0.8 * ${maxWidthMessage});\n }\n & > li[from='user'] {\n margin-inline-start: auto;\n margin-block-end: ${spacing};\n }\n & > li[type='message'] {\n &:focus-visible {\n outline: none;\n box-shadow: ${shadow.focus};\n }\n margin-block-end: ${spacing};\n }\n `;\n }\n);\n\nStyledMessagesList.defaultProps = defaultThemeProp;\n\nexport const StyledHistoryContainer = styled(Flex)<{ inFullPage: boolean }>(\n ({ theme, inFullPage }) => css`\n height: 100%;\n min-height: 0;\n ${inFullPage &&\n css`\n border-inline-end: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n\n ${StyledEmptyState}, ${StyledErrorState} {\n justify-content: flex-start;\n padding-inline: calc(2 * ${theme.base.spacing});\n }\n `\n);\n\nStyledHistoryContainer.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled(Flex)(\n ({ theme }) => css`\n height: 100%;\n overflow-y: auto;\n margin-block-end: calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledHistorySummaryListItem = styled(SummaryItem)(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n return css`\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block: ${theme.base.spacing};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n\n &:hover {\n background-color: ${hoverColor};\n cursor: pointer;\n }\n &[aria-selected='true'] {\n background-color: ${hoverColor};\n }\n &:focus {\n border: 0.0625rem solid ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledHistorySummaryListItem.defaultProps = defaultThemeProp;\n\nexport const StyledLoadingItem = styled.li`\n ${StyledProgress} {\n margin: 0;\n }\n`;\n\nexport const StyledGroupHeader = styled.div(({ theme }) => {\n return css`\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block-start: calc(2 * ${theme.base.spacing});\n padding-block-end: calc(0.5 * ${theme.base.spacing});\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `;\n});\n\nStyledGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledErrorContainer = styled.div(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledErrorContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input(() => {\n return css`\n display: none;\n `;\n});\n\nexport const StyledAttachmentsList = styled(FileList)(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n `;\n});\n\nStyledAttachmentsList.defaultProps = defaultThemeProp;\n\nexport const StyledGuidedSuggestions = styled(MenuButton)`\n width: 100%;\n max-width: ${maxWidthMessage};\n > span {\n justify-content: center;\n }\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"GenAICoach.styles.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,eAAe,EACf,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,MA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AC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAA;IAC/C,SAAS,CAAC,CAAC,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAC/C,KAAK,EAAE,EACL,UAAU,EAAE,EACV,aAAa,EAAE,EACb,MAAM,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EACzC,EACF,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;kBACM,gBAAgB;GAC/B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;eAE5B,eAAe;CAC7B,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { useContext } from 'react';\nimport { mix } from 'polished';\n\nimport {\n AppShellContext,\n Button,\n FileList,\n Flex,\n FormControl,\n MenuButton,\n StyledEmptyState,\n StyledErrorState,\n StyledIcon,\n StyledText,\n SummaryItem,\n Text,\n TextArea,\n calculateFontSize,\n defaultThemeProp,\n tryCatch,\n Avatar\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\nimport { StyledEditorContainer } from '@pega/cosmos-react-rte/lib/components/RichTextEditor/RichTextEditor.styles';\nimport { StyledProgress } from '@pega/cosmos-react-core/lib/components/Progress/Progress.styles';\nimport { resizeDrawerMaxWidth } from '@pega/cosmos-react-core/lib/styles/constants';\nimport { lineClamp } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nimport type { GenAICoachProps } from './GenAICoach.types';\nimport { isInUtilities } from './GenAICoach.utils';\n\nexport const StyledMessageWrapper = styled.li``;\nconst maxWidthMessage = '46rem';\n\nexport const StyledComposerSection = styled.div``;\n\nexport const StyledMessagesContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-end: calc(2 * ${spacing});\n height: 100%;\n overflow-y: auto;\n `;\n }\n);\n\nStyledMessagesContainer.defaultProps = defaultThemeProp;\n\nexport const StyledGenAICoachContainer = styled.div<{\n variant: GenAICoachProps['variant'];\n fullScreen: GenAICoachProps['allowFullScreen'];\n isCompact: boolean;\n}>(\n ({\n theme: {\n base: { palette, 'z-index': zIndex, spacing, breakpoints, animation },\n components: {\n card: { 'border-radius': borderRadius },\n 'accent-card': { 'primary-background': agentBackground }\n }\n },\n variant,\n fullScreen,\n isCompact\n }) => {\n const { previewActive } = useContext(AppShellContext);\n return css`\n background: ${agentBackground};\n min-width: var(--utilities-drawer-min-width);\n border-radius: ${borderRadius};\n transition: height ${animation.speed} ${animation.timing.ease};\n\n ${isInUtilities(variant) &&\n !fullScreen &&\n css`\n min-height: 3rem;\n max-width: 31.25rem;\n box-shadow: 0 -1rem 1rem ${palette['app-background']};\n border-radius: ${borderRadius} ${borderRadius} 0 0;\n position: fixed;\n inset-block-end: 0;\n inset-inline-end: calc(2 * ${spacing});\n z-index: calc(${zIndex.drawer} + 1);\n width: 25rem;\n\n ${previewActive &&\n css`\n @media (min-width: ${breakpoints.xl}) {\n margin-inline-end: min(var(--resize-drawer-width), ${resizeDrawerMaxWidth});\n }\n `}\n\n ${variant.state === 'minimized' &&\n css`\n height: 3rem;\n `}\n `}\n\n /*\n ~85% of Utilities height and fixed height if screen size less than md and devices with coarse pointer\n FIXME: This is a stopgap to address issue in Android web views via React Native where VH units do not work\n */\n ${((isInUtilities(variant) && variant.state === 'maximized') || !isInUtilities(variant)) &&\n !fullScreen &&\n css`\n height: calc(0.85 * var(--case-view-height, 95vh));\n @media (pointer: coarse) and (max-width: ${breakpoints.md}) {\n height: 40rem;\n }\n `}\n\n ${isCompact &&\n css`\n height: 26rem;\n ${StyledMessagesContainer} {\n margin-block-end: 0;\n }\n `}\n\n ${fullScreen &&\n css`\n height: 100vh;\n border-radius: 0;\n `}\n `;\n }\n);\n\nStyledGenAICoachContainer.defaultProps = defaultThemeProp;\n\nexport const StyledGenAIOptionsMenu = styled(MenuButton)(({\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'font-weight': fontWeight,\n palette: { ai }\n }\n }\n}) => {\n const { l } = calculateFontSize(fontSize, fontScale);\n return css`\n color: inherit;\n ${StyledIcon}:first-child {\n color: ${ai};\n }\n ${StyledText} {\n font-weight: ${fontWeight['semi-bold']};\n font-size: ${l};\n }\n `;\n});\n\nStyledGenAIOptionsMenu.defaultProps = defaultThemeProp;\n\nexport const StyledMenuSuggestions = styled(MenuButton)(({\n theme: {\n base: { 'border-radius': baseBorderRadius, spacing },\n components: {\n button: { 'border-radius': borderRadius }\n }\n }\n}) => {\n return css`\n padding: calc(0.75 * ${spacing});\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n `;\n});\n\nStyledMenuSuggestions.defaultProps = defaultThemeProp;\n\nexport const StyledDisclaimerText = styled(Text)<{ inFullPage: boolean }>(({\n inFullPage,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing }\n }\n}) => {\n const systemFontSize = calculateFontSize(fontSize, fontScale).xs;\n return css`\n font-size: ${systemFontSize};\n margin-block-start: ${spacing};\n ${inFullPage &&\n css`\n padding-block-end: calc(2 * ${spacing});\n `}\n opacity: 0.7;\n `;\n});\n\nStyledDisclaimerText.defaultProps = defaultThemeProp;\n\nexport const StyledFlexWrapper = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-start: ${spacing};\n height: 100%;\n overflow-y: auto;\n `;\n }\n);\n\nStyledFlexWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledGridContainer = styled.div<{ conversationHistory: boolean }>(\n ({ theme: { base }, conversationHistory }) => {\n return css`\n height: 100%;\n min-height: 0;\n ${conversationHistory &&\n css`\n border: 0.0625rem solid ${base.palette['border-line']};\n margin: calc(2 * ${base.spacing});\n border-radius: ${base['border-radius']};\n `}\n `;\n }\n);\n\nStyledGridContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInitialMessageContainer = styled.div(() => {\n return css`\n ${StyledFormField} {\n width: 100%;\n max-width: ${maxWidthMessage};\n }\n `;\n});\n\nStyledInitialMessageContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInputContainer = styled(Flex)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n margin-block-end: calc(2 * ${spacing});\n margin-inline: calc(2 * ${spacing});\n align-items: center;\n\n ${StyledFormField}, ${StyledComposerSection} {\n width: 100%;\n max-width: ${maxWidthMessage};\n }\n `;\n});\n\nStyledInputContainer.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestion = styled(Button)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n width: fit-content;\n padding: ${spacing};\n white-space: normal;\n word-break: break-word;\n & + & {\n margin-inline-start: 0;\n text-align: left;\n }\n `;\n});\n\nStyledSuggestion.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestionsContainer = styled.div(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n margin-block-start: calc(1.5 * ${spacing});\n `;\n }\n);\n\nStyledSuggestionsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledTimeStamp = styled(Text)(() => {\n return css`\n display: flex;\n align-items: center;\n `;\n});\n\nStyledTimeStamp.defaultProps = defaultThemeProp;\n\nexport const StyledMessage = styled.p(({ theme }) => {\n return css`\n margin-block-start: calc(0.5 * ${theme.base.spacing});\n overflow-wrap: break-word;\n ${StyledEditorContainer} {\n padding: 0;\n }\n `;\n});\n\nStyledMessage.defaultProps = defaultThemeProp;\n\nexport const StyledUserMessage = styled.li(\n ({\n theme: {\n base: { 'border-radius': borderRadius, spacing },\n components: {\n 'accent-card': { 'secondary-background': agentUserMessageBackground }\n }\n }\n }) => {\n return css`\n overflow-wrap: break-word;\n background: ${agentUserMessageBackground};\n margin-inline-start: calc(4 * ${spacing});\n margin-block-end: calc(0.5 * ${spacing});\n padding: calc(0.5 * ${spacing});\n border-start-start-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n border-start-end-radius: min(${borderRadius}, 0.5rem);\n border-end-start-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n border-end-end-radius: min(calc(3 * ${borderRadius}), 1.5rem);\n `;\n }\n);\n\nStyledUserMessage.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedMessage = styled.div(({ theme }) => {\n return css`\n column-gap: calc(2 * ${theme.base.spacing});\n min-height: 2rem;\n max-width: calc(0.8 * ${maxWidthMessage});\n width: 100%;\n text-align: left;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n padding-inline-end: calc(2 * ${theme.base.spacing});\n cursor: pointer;\n &:hover,\n &:focus {\n border: 0.0625rem solid ${theme.base.palette.interactive};\n }\n ${StyledCardContent} {\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledSuggestedMessage.defaultProps = defaultThemeProp;\n\nexport const StyledMessagesList = styled.ul(\n ({\n theme: {\n base: { shadow, spacing }\n }\n }) => {\n return css`\n padding-block-start: ${spacing};\n list-style-type: none;\n align-self: center;\n max-width: ${maxWidthMessage};\n width: 100%;\n & > li {\n max-width: calc(0.8 * ${maxWidthMessage});\n }\n & > li[from='user'] {\n margin-inline-start: auto;\n margin-block-end: ${spacing};\n }\n & > li[type='message'] {\n &:focus-visible {\n outline: none;\n box-shadow: ${shadow.focus};\n }\n margin-block-end: ${spacing};\n }\n `;\n }\n);\n\nStyledMessagesList.defaultProps = defaultThemeProp;\n\nexport const StyledHistoryContainer = styled(Flex)<{ inFullPage: boolean }>(\n ({ theme, inFullPage }) => css`\n height: 100%;\n min-height: 0;\n ${inFullPage &&\n css`\n border-inline-end: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n\n ${StyledEmptyState}, ${StyledErrorState} {\n justify-content: flex-start;\n padding-inline: calc(2 * ${theme.base.spacing});\n }\n `\n);\n\nStyledHistoryContainer.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled(Flex)(\n ({ theme }) => css`\n height: 100%;\n overflow-y: auto;\n margin-block-end: calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledHistorySummaryListItem = styled(SummaryItem)(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n return css`\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block: ${theme.base.spacing};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n\n &:hover {\n background-color: ${hoverColor};\n cursor: pointer;\n }\n &[aria-selected='true'] {\n background-color: ${hoverColor};\n }\n &:focus {\n border: 0.0625rem solid ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledHistorySummaryListItem.defaultProps = defaultThemeProp;\n\nexport const StyledLoadingItem = styled.li`\n ${StyledProgress} {\n margin: 0;\n }\n`;\n\nexport const StyledGroupHeader = styled.div(({ theme }) => {\n return css`\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block-start: calc(2 * ${theme.base.spacing});\n padding-block-end: calc(0.5 * ${theme.base.spacing});\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n `;\n});\n\nStyledGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledErrorContainer = styled.div(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledErrorContainer.defaultProps = defaultThemeProp;\n\nexport const StyledInput = styled.input(() => {\n return css`\n display: none;\n `;\n});\n\nexport const StyledAttachmentsList = styled(FileList)(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n `;\n});\n\nStyledAttachmentsList.defaultProps = defaultThemeProp;\n\nexport const StyledGuidedSuggestions = styled(MenuButton)`\n width: 100%;\n max-width: ${maxWidthMessage};\n > span {\n justify-content: center;\n }\n`;\n\nexport const StyledAgentIcon = styled.svg`\n width: 3rem;\n height: 3rem;\n`;\n\nStyledAgentIcon.defaultProps = defaultThemeProp;\n\nexport const StyledGenAIFormControl = styled(FormControl)<{ focused?: boolean }>(({\n theme,\n focused\n}) => {\n return css`\n overflow: hidden;\n\n ${focused &&\n css`\n &:not([disabled]) {\n border-color: ${theme.components['form-control'][':focus']['border-color']};\n box-shadow: ${theme.components['form-control'][':focus']['box-shadow']};\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n border-color: transparent;\n }\n `}\n `;\n});\n\nStyledGenAIFormControl.defaultProps = defaultThemeProp;\n\nexport const StyledGenAITextArea = styled(TextArea)(({ theme: { components } }) => {\n return css`\n border: none;\n box-shadow: none;\n min-height: ${components.input.height};\n max-height: 6rem;\n overflow-y: auto;\n padding-block-end: 0;\n &:focus:not([disabled]) {\n border: none;\n box-shadow: none;\n background-color: transparent;\n }\n `;\n});\n\nStyledGenAITextArea.defaultProps = defaultThemeProp;\n\nexport const StyledSendButton = styled(Button)(({\n theme: {\n base: { palette, 'border-radius': baseBorderRadius },\n components: {\n 'form-control': { 'border-radius': formControlBorderRadius }\n }\n }\n}) => {\n return css`\n border-radius: calc(${baseBorderRadius} * ${formControlBorderRadius});\n margin-inline-start: auto;\n\n ${StyledIcon} {\n color: ${palette.light};\n }\n `;\n});\n\nStyledSendButton.defaultProps = defaultThemeProp;\n\nexport const StyledInitialMessageGrid = styled.div`\n max-width: ${maxWidthMessage};\n width: 100%;\n`;\n\nexport const StyledInitialMessageButton = styled(Button)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n white-space: normal;\n text-align: left;\n min-width: unset;\n padding-block: ${spacing};\n padding-inline: calc(2 * ${spacing});\n align-items: start;\n\n & + & {\n margin-inline-start: 0;\n }\n `;\n});\n\nStyledInitialMessageButton.defaultProps = defaultThemeProp;\n\nexport const StyledInitialMessageText = styled.span`\n ${lineClamp(3)};\n`;\n\nexport const StyledGenAIAvatar = styled(Avatar)(({\n theme: {\n components: {\n 'accent-card': {\n avatar: { background: avatarBackground }\n }\n }\n }\n}) => {\n return css`\n background: ${avatarBackground};\n `;\n});\n\nStyledGenAIAvatar.defaultProps = defaultThemeProp;\n\nexport const StyledGenAIFooter = styled.div`\n width: 100%;\n max-width: ${maxWidthMessage};\n`;\n"]}
|
|
@@ -45,6 +45,8 @@ export type CoachMessageProps = RequireAtLeastOne<Partial<Pick<GenAICoachProps,
|
|
|
45
45
|
onReaction: (id: MessageProps['id'], reaction: Reaction) => void;
|
|
46
46
|
onFeedbackComplete: (id: MessageProps['id'], comment?: string) => void;
|
|
47
47
|
};
|
|
48
|
+
onAnimationCursorUpdate?: (animatedTillCursor: number) => void;
|
|
49
|
+
animationInitialCursorPos?: number;
|
|
48
50
|
}, 'loading' | 'message' | 'error'>;
|
|
49
51
|
export type GenAIMessageProps = UserMessageProps | CoachMessageProps;
|
|
50
52
|
export interface ConversationHistoryProps extends TestIdProp {
|
|
@@ -96,6 +98,8 @@ export type GenAICoachProps = WithAttributes<'div', TestIdProp & {
|
|
|
96
98
|
messages?: GenAIMessageProps[];
|
|
97
99
|
/** Placement of the component */
|
|
98
100
|
variant: Variant;
|
|
101
|
+
/** From landing page utilities */
|
|
102
|
+
isInLandingPageUtilities?: boolean;
|
|
99
103
|
/** callback when component is mounted */
|
|
100
104
|
onOpen?: () => void;
|
|
101
105
|
/**
|
|
@@ -117,6 +121,8 @@ export type GenAICoachProps = WithAttributes<'div', TestIdProp & {
|
|
|
117
121
|
attachmentsError?: string;
|
|
118
122
|
/** Configuration for the Lightbox component that handles preview of media attachments and files */
|
|
119
123
|
lightboxPreviewProps?: LightboxProps;
|
|
124
|
+
/** Enable full screen */
|
|
125
|
+
allowFullScreen?: boolean;
|
|
120
126
|
}>;
|
|
121
127
|
export interface UtilitiesGenAICoachProps extends OmitStrict<GenAICoachProps, 'variant'> {
|
|
122
128
|
onClose?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.types.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE5C,MAAM,MAAM,OAAO,GACf;IACE,SAAS,EAAE,WAAW,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC/D,GACD;IAAE,SAAS,EAAE,UAAU,CAAA;CAAE,GACzB;IAAE,SAAS,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1B;AAED,MAAM,MAAM,4BAA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EAAE,iBAAiB,EAAE,CAAC;IAC/B,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,sCAAsC;IACtC,mBAAmB,CAAC,EAAE,wBAAwB,CAAC;IAC/C,4DAA4D;IAC5D,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,+CAA+C;IAC/C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAC1C,uBAAuB;IACvB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;IAC9B,2BAA2B;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,oBAAoB,CAAC,EAAE,aAAa,CAAC;IACrC,yBAAyB;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CACF,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC;IACtF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAICoach.types.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Dispatch, Ref, SetStateAction } from 'react';\n\nimport type {\n BaseProps,\n MenuProps,\n OmitStrict,\n ProgressProps,\n RequireAtLeastOne,\n TestIdProp,\n WithAttributes,\n ActionsProps,\n FileItemProps,\n FileDisplayProps,\n LightboxProps\n} from '@pega/cosmos-react-core';\n\nexport type State = 'minimized' | 'maximized';\nexport type Reaction = 'liked' | 'disliked';\n\nexport type Variant =\n | {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n setGenAIHeight?: Dispatch<SetStateAction<number | undefined>>;\n }\n | { placement: 'fullpage' }\n | { placement: 'dialog'; onClose: () => void };\n\nexport interface MessageProps {\n id: string;\n message: string;\n announceInteraction?: boolean;\n attachments?: FileDisplayProps[];\n /**\n * Whether the message is a suggestion from the composer\n * @default false\n */\n fromComposer?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLLIElement>;\n}\n\nexport type InitialSuggestedMessageProps = Pick<GenAICoachProps, 'onSend'> &\n BaseProps &\n TestIdProp &\n MessageProps;\n\nexport interface UserMessageProps extends BaseProps, TestIdProp, MessageProps {\n from: 'user';\n}\n\nexport type CoachMessageProps = RequireAtLeastOne<\n Partial<Pick<GenAICoachProps, 'onSend'>> &\n BaseProps &\n TestIdProp &\n Pick<MessageProps, 'id' | 'announceInteraction' | 'ref'> & {\n from: 'coach';\n coachName: string;\n suggestions?: MessageProps[];\n loading?: boolean;\n enableStreaming?: boolean;\n allChunksReceived?: boolean;\n error?: string;\n message?: MessageProps['message'];\n onStreamingUpdate?: (isStreamingDone: boolean) => void;\n feedback?: {\n reaction: Reaction | undefined;\n onReaction: (id: MessageProps['id'], reaction: Reaction) => void;\n onFeedbackComplete: (id: MessageProps['id'], comment?: string) => void;\n };\n },\n 'loading' | 'message' | 'error'\n>;\n\nexport type GenAIMessageProps = UserMessageProps | CoachMessageProps;\n\nexport interface ConversationHistoryProps extends TestIdProp {\n /** List of History items. */\n data: {\n id: string;\n section: string;\n conversations: {\n id: string;\n title: string;\n }[];\n }[];\n /** Click event for items within the list. */\n onItemClick?: (conversationId: string) => void;\n /** List loading state. */\n loading?: boolean;\n /** Called at scroll trigger to load more items. */\n loadMore?: () => void;\n /** True if History view is rendered in Full page view. */\n inFullPage?: boolean;\n /** Callback triggered when closing the history view. */\n onDismiss: () => void;\n /** Id of the selected item. */\n selectedItemId?: string;\n /** Set if there is an error in retreiving the data. */\n error?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport type SendMessageProps = OmitStrict<MessageProps, 'attachments'> & {\n attachmentIds?: string[];\n};\n\nexport type GenAICoachProps = WithAttributes<\n 'div',\n TestIdProp & {\n /** Chat loading indicator */\n loading?: boolean | ProgressProps['message'];\n /** Set if there is an error in retreiving the data */\n error?: string;\n /** Coaches available in the chat header */\n coachOptions: MenuProps['items'];\n /** Handle the coach selections */\n onCoachChange: (id: MenuProps['id']) => void;\n /** Suggested messages to start the conversation */\n initialSuggestedMessages?: MessageProps[];\n /** Additional suggestions presented at the bottom of the chat window */\n suggestions?: MenuProps['items'];\n /** Send prompts */\n onSend: (message: SendMessageProps) => void;\n /** Messages to be shown in the chatting window. */\n messages?: GenAIMessageProps[];\n /** Placement of the component */\n variant: Variant;\n /** callback when component is mounted */\n onOpen?: () => void;\n /**\n * User would be guided with selective prompts to enable interaction with coach.\n * @default false\n */\n guidedMode?: boolean;\n /** Pass an array of Action objects to show Action button. */\n actions?: ActionsProps;\n /** Pass data to show history view. */\n conversationHistory?: ConversationHistoryProps;\n /** Callback triggered when the layout component changes. */\n onLayoutChange?: (inFullPage: boolean) => void;\n /** Callback when attachment icon is clicked */\n onAddAttachment?: (files: File[]) => void;\n /** Attachments list */\n attachments?: FileItemProps[];\n /** Error in attachments */\n attachmentsError?: string;\n /** Configuration for the Lightbox component that handles preview of media attachments and files */\n lightboxPreviewProps?: LightboxProps;\n }\n>;\n\nexport interface UtilitiesGenAICoachProps extends OmitStrict<GenAICoachProps, 'variant'> {\n onClose?: () => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GenAICoach.types.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAICoach.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Dispatch, Ref, SetStateAction } from 'react';\n\nimport type {\n BaseProps,\n MenuProps,\n OmitStrict,\n ProgressProps,\n RequireAtLeastOne,\n TestIdProp,\n WithAttributes,\n ActionsProps,\n FileItemProps,\n FileDisplayProps,\n LightboxProps\n} from '@pega/cosmos-react-core';\n\nexport type State = 'minimized' | 'maximized';\nexport type Reaction = 'liked' | 'disliked';\n\nexport type Variant =\n | {\n placement: 'utilities';\n state: State;\n onStateChange: (state: State) => void;\n setGenAIHeight?: Dispatch<SetStateAction<number | undefined>>;\n }\n | { placement: 'fullpage' }\n | { placement: 'dialog'; onClose: () => void };\n\nexport interface MessageProps {\n id: string;\n message: string;\n announceInteraction?: boolean;\n attachments?: FileDisplayProps[];\n /**\n * Whether the message is a suggestion from the composer\n * @default false\n */\n fromComposer?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLLIElement>;\n}\n\nexport type InitialSuggestedMessageProps = Pick<GenAICoachProps, 'onSend'> &\n BaseProps &\n TestIdProp &\n MessageProps;\n\nexport interface UserMessageProps extends BaseProps, TestIdProp, MessageProps {\n from: 'user';\n}\n\nexport type CoachMessageProps = RequireAtLeastOne<\n Partial<Pick<GenAICoachProps, 'onSend'>> &\n BaseProps &\n TestIdProp &\n Pick<MessageProps, 'id' | 'announceInteraction' | 'ref'> & {\n from: 'coach';\n coachName: string;\n suggestions?: MessageProps[];\n loading?: boolean;\n enableStreaming?: boolean;\n allChunksReceived?: boolean;\n error?: string;\n message?: MessageProps['message'];\n onStreamingUpdate?: (isStreamingDone: boolean) => void;\n feedback?: {\n reaction: Reaction | undefined;\n onReaction: (id: MessageProps['id'], reaction: Reaction) => void;\n onFeedbackComplete: (id: MessageProps['id'], comment?: string) => void;\n };\n onAnimationCursorUpdate?: (animatedTillCursor: number) => void;\n animationInitialCursorPos?: number;\n },\n 'loading' | 'message' | 'error'\n>;\n\nexport type GenAIMessageProps = UserMessageProps | CoachMessageProps;\n\nexport interface ConversationHistoryProps extends TestIdProp {\n /** List of History items. */\n data: {\n id: string;\n section: string;\n conversations: {\n id: string;\n title: string;\n }[];\n }[];\n /** Click event for items within the list. */\n onItemClick?: (conversationId: string) => void;\n /** List loading state. */\n loading?: boolean;\n /** Called at scroll trigger to load more items. */\n loadMore?: () => void;\n /** True if History view is rendered in Full page view. */\n inFullPage?: boolean;\n /** Callback triggered when closing the history view. */\n onDismiss: () => void;\n /** Id of the selected item. */\n selectedItemId?: string;\n /** Set if there is an error in retreiving the data. */\n error?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport type SendMessageProps = OmitStrict<MessageProps, 'attachments'> & {\n attachmentIds?: string[];\n};\n\nexport type GenAICoachProps = WithAttributes<\n 'div',\n TestIdProp & {\n /** Chat loading indicator */\n loading?: boolean | ProgressProps['message'];\n /** Set if there is an error in retreiving the data */\n error?: string;\n /** Coaches available in the chat header */\n coachOptions: MenuProps['items'];\n /** Handle the coach selections */\n onCoachChange: (id: MenuProps['id']) => void;\n /** Suggested messages to start the conversation */\n initialSuggestedMessages?: MessageProps[];\n /** Additional suggestions presented at the bottom of the chat window */\n suggestions?: MenuProps['items'];\n /** Send prompts */\n onSend: (message: SendMessageProps) => void;\n /** Messages to be shown in the chatting window. */\n messages?: GenAIMessageProps[];\n /** Placement of the component */\n variant: Variant;\n /** From landing page utilities */\n isInLandingPageUtilities?: boolean;\n /** callback when component is mounted */\n onOpen?: () => void;\n /**\n * User would be guided with selective prompts to enable interaction with coach.\n * @default false\n */\n guidedMode?: boolean;\n /** Pass an array of Action objects to show Action button. */\n actions?: ActionsProps;\n /** Pass data to show history view. */\n conversationHistory?: ConversationHistoryProps;\n /** Callback triggered when the layout component changes. */\n onLayoutChange?: (inFullPage: boolean) => void;\n /** Callback when attachment icon is clicked */\n onAddAttachment?: (files: File[]) => void;\n /** Attachments list */\n attachments?: FileItemProps[];\n /** Error in attachments */\n attachmentsError?: string;\n /** Configuration for the Lightbox component that handles preview of media attachments and files */\n lightboxPreviewProps?: LightboxProps;\n /** Enable full screen */\n allowFullScreen?: boolean;\n }\n>;\n\nexport interface UtilitiesGenAICoachProps extends OmitStrict<GenAICoachProps, 'variant'> {\n onClose?: () => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"GenAIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAgBL,KAAK,+BAA+B,EACrC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAqB5D,QAAA,MAAM,YAAY,EAAE,+BAA+B,CAAC,iBAAiB,CAoQpE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Button, Flex, Icon, Progress, registerIcon, useI18n, useTheme,
|
|
3
|
+
import { Button, Flex, Icon, Progress, registerIcon, useI18n, useTheme, useTestIds, ErrorState, useElement, Tooltip, TextArea, FormDialog, useElementFocus, markdownToPlainText } from '@pega/cosmos-react-core';
|
|
4
4
|
import * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';
|
|
5
5
|
import * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';
|
|
6
6
|
import * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';
|
|
@@ -8,7 +8,7 @@ import * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Ico
|
|
|
8
8
|
import * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';
|
|
9
9
|
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
10
10
|
import { useAnimatedText } from '@pega/cosmos-react-core';
|
|
11
|
-
import { StyledAttachmentsList, StyledMessage, StyledSuggestion, StyledSuggestionsContainer, StyledUserMessage } from './GenAICoach.styles';
|
|
11
|
+
import { StyledAttachmentsList, StyledGenAIAvatar, StyledMessage, StyledSuggestion, StyledSuggestionsContainer, StyledUserMessage } from './GenAICoach.styles';
|
|
12
12
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
13
13
|
import { isCoachMessage, isUserMessage } from './GenAICoach.utils';
|
|
14
14
|
import GenAIMessageProgress from './GenAIMessageProgress';
|
|
@@ -27,12 +27,20 @@ const GenAIMessage = forwardRef(function GenAIMessage(props, ref) {
|
|
|
27
27
|
const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;
|
|
28
28
|
const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;
|
|
29
29
|
const enableStreaming = !!isStreamingMessage && !allChunksReceived;
|
|
30
|
-
const { text: streamingMessage, isAnimationDone: isStreamingDone } = useAnimatedText({
|
|
30
|
+
const { text: streamingMessage, isAnimationDone: isStreamingDone, animatedTillCursor } = useAnimatedText({
|
|
31
31
|
text: message ?? '',
|
|
32
32
|
allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,
|
|
33
33
|
enabled: enableStreaming,
|
|
34
|
-
tokenizeMarkdown: true
|
|
34
|
+
tokenizeMarkdown: true,
|
|
35
|
+
cursorStartIndex: isCoachMessage(props) && props.animationInitialCursorPos
|
|
36
|
+
? props.animationInitialCursorPos
|
|
37
|
+
: undefined
|
|
35
38
|
});
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isCoachMessage(props) && props.onAnimationCursorUpdate) {
|
|
41
|
+
props.onAnimationCursorUpdate(animatedTillCursor);
|
|
42
|
+
}
|
|
43
|
+
}, [animatedTillCursor]);
|
|
36
44
|
useEffect(() => {
|
|
37
45
|
if (isStreamingMessage && props.onStreamingUpdate) {
|
|
38
46
|
props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);
|
|
@@ -63,7 +71,7 @@ const GenAIMessage = forwardRef(function GenAIMessage(props, ref) {
|
|
|
63
71
|
ariaLabel = `${ariaLabel} ${t('interaction_message')}`;
|
|
64
72
|
}
|
|
65
73
|
const streamingContent = isStreamingMessage && (_jsx(_Fragment, { children: message ? (_jsxs(_Fragment, { children: [_jsx(RichTextViewer, { content: isStreamingMessage ? streamingMessage : message, type: 'markdown' }), loading && _jsx(Progress, { variant: 'ellipsis', placement: 'inline' })] })) : (loading && _jsx(GenAIMessageProgress, {})) }));
|
|
66
|
-
return (_jsxs(Flex, { as: 'li', "data-testid": testIds.coachMessage, ...restProps, container: { direction: '
|
|
74
|
+
return (_jsxs(Flex, { as: 'li', "data-testid": testIds.coachMessage, ...restProps, container: { direction: 'row', pad: [1, 0], gap: 0.5 }, type: 'message', "aria-label": ariaLabel, ref: ref, children: [_jsx(StyledGenAIAvatar, { name: coachName, icon: 'polaris-solid', color: theme.base.palette.ai, shape: 'circle', size: 'm' }), _jsxs(StyledMessage, { children: [streamingContent, loading || error ? (_jsxs(_Fragment, { children: [loading && !isStreamingMessage && _jsx(GenAIMessageProgress, {}), error && _jsx(ErrorState, { message: error })] })) : (_jsxs(_Fragment, { children: [!isStreamingMessage && message && (_jsx(RichTextViewer, { content: message, type: 'markdown' })), feedback && (_jsx(Flex, { container: { pad: [0.5, undefined] }, children: reaction ? (_jsxs(_Fragment, { children: [_jsx(Flex, { container: { pad: 0.5 }, "aria-label": selectedFeedbackResponse, ref: setWrapperEl, tabIndex: -1, children: _jsx(Icon, { name: reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid' }) }), showDialog ? (onFeedbackComplete &&
|
|
67
75
|
wrapperEl && (_jsx(FormDialog, { target: wrapperEl, heading: t('share_feedback'), onCancel: () => {
|
|
68
76
|
focusOnInteractionRef.current = true;
|
|
69
77
|
setShowDialog(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src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I,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,UAAU,GAAG,IAC9C,CACrB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, PropsWithoutRef } from 'react';\n\nimport {\n Button,\n Flex,\n Icon,\n Progress,\n registerIcon,\n useI18n,\n useTheme,\n Text,\n useTestIds,\n ErrorState,\n useElement,\n Tooltip,\n TextArea,\n FormDialog,\n useElementFocus,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledAttachmentsList,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\n\nregisterIcon(\n polarisSolidIcon,\n thumbsUpSolidIcon,\n thumbsUpIcon,\n thumbsDownSolidIcon,\n thumbsDownIcon\n);\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const theme = useTheme();\n const t = useI18n();\n const [wrapperEl, setWrapperEl] = useElement<HTMLDivElement>(null);\n const [feedbackVal, setFeedbackVal] = useState('');\n const [showDialog, setShowDialog] = useState(false);\n const focusOnInteractionRef = useRef(false);\n\n const { message, announceInteraction, ...restProps } = props;\n const plainTextMessage = markdownToPlainText(message ?? '');\n let ariaLabel = plainTextMessage;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const { text: streamingMessage, isAnimationDone: isStreamingDone } = useAnimatedText({\n text: message ?? '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: enableStreaming,\n tokenizeMarkdown: true\n });\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useElementFocus(wrapperEl, { shouldFocus: !showDialog && focusOnInteractionRef.current });\n\n useEffect(() => {\n if (!showDialog && focusOnInteractionRef.current) {\n focusOnInteractionRef.current = false;\n }\n }, [showDialog]);\n\n if (isCoachMessage(props)) {\n const { id: messageId, coachName, suggestions, onSend, loading, error, feedback } = props;\n\n const { reaction, onReaction, onFeedbackComplete } = feedback ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n />\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n loading && <GenAIMessageProgress />\n )}\n </>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'column', pad: [1, 0] }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <Flex container={{ gap: 1 }}>\n <Icon name='polaris-solid' color={theme.base.palette.ai} size='s' />\n <Text as='span' variant='h4'>\n {coachName}\n </Text>\n </Flex>\n <StyledMessage>\n {/* Streaming loader and content */}\n {streamingContent}\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && <GenAIMessageProgress />}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage && message && (\n <RichTextViewer content={message} type='markdown' />\n )}\n {feedback && (\n <Flex container={{ pad: [0.5, undefined] }}>\n {reaction ? (\n <>\n <Flex\n container={{ pad: 0.5 }}\n aria-label={selectedFeedbackResponse}\n ref={setWrapperEl}\n tabIndex={-1}\n >\n <Icon\n name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid'}\n />\n </Flex>\n {showDialog ? (\n onFeedbackComplete &&\n wrapperEl && (\n <FormDialog\n target={wrapperEl}\n heading={t('share_feedback')}\n onCancel={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId);\n }}\n onSubmit={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }}\n onKeyDown={e => e.stopPropagation()}\n >\n <TextArea\n value={feedbackVal}\n onChange={e => setFeedbackVal(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }\n }}\n autoResize={false}\n />\n </FormDialog>\n )\n ) : (\n <Tooltip target={wrapperEl} describeTarget={false}>\n {reaction === 'liked' ? t('good_response') : t('bad_response')}\n </Tooltip>\n )}\n </>\n ) : (\n <>\n <Button\n label={t('good_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction?.(messageId, 'liked');\n focusOnInteractionRef.current = true;\n }}\n >\n <Icon name='thumbs-up' />\n </Button>\n\n <Button\n label={t('bad_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n setShowDialog(true);\n onReaction?.(messageId, 'disliked');\n }}\n >\n <Icon name='thumbs-down' />\n </Button>\n </>\n )}\n </Flex>\n )}\n {suggestions && (\n <Flex as={StyledSuggestionsContainer} container={{ direction: 'column', gap: 1 }}>\n {suggestions.map(({ id, message: prompt }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n return (\n <StyledUserMessage\n as={StyledUserMessage}\n data-testid={testIds.userMessage}\n {...restProps}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {message && <RichTextViewer content={message} type='markdown' />}\n </StyledUserMessage>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"GenAIMessage.js","sourceRoot":"","sources":["../../../src/components/GenAICoach/GenAIMessage.tsx"],"names":[],"mappings":";AAAA,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IAAI,EAAC,SAAS,gBACF,SAAS,EACrB,GAAG,EAAE,GAAG,aAEP,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CACpD,KAAC,qBAAqB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,CAAC,WAAW,GAAI,CACnE,EACA,OAAO,IAAI,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,UAAU,GAAG,IAC9C,CACrB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, PropsWithoutRef } from 'react';\n\nimport {\n Button,\n Flex,\n Icon,\n Progress,\n registerIcon,\n useI18n,\n useTheme,\n useTestIds,\n ErrorState,\n useElement,\n Tooltip,\n TextArea,\n FormDialog,\n useElementFocus,\n markdownToPlainText,\n type ForwardRefForwardPropsComponent\n} from '@pega/cosmos-react-core';\nimport * as polarisSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/polaris-solid.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\nimport * as thumbsDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down-solid.icon';\nimport * as thumbsDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-down.icon';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { useAnimatedText } from '@pega/cosmos-react-core';\n\nimport type { GenAIMessageProps } from './GenAICoach.types';\nimport {\n StyledAttachmentsList,\n StyledGenAIAvatar,\n StyledMessage,\n StyledSuggestion,\n StyledSuggestionsContainer,\n StyledUserMessage\n} from './GenAICoach.styles';\nimport { getGenAICoachTestIds } from './GenAICoach.test-ids';\nimport { isCoachMessage, isUserMessage } from './GenAICoach.utils';\nimport GenAIMessageProgress from './GenAIMessageProgress';\n\nregisterIcon(\n polarisSolidIcon,\n thumbsUpSolidIcon,\n thumbsUpIcon,\n thumbsDownSolidIcon,\n thumbsDownIcon\n);\n\nconst GenAIMessage: ForwardRefForwardPropsComponent<GenAIMessageProps> = forwardRef(\n function GenAIMessage(props: PropsWithoutRef<GenAIMessageProps>, ref: GenAIMessageProps['ref']) {\n const testIds = useTestIds(props.testId, getGenAICoachTestIds);\n const theme = useTheme();\n const t = useI18n();\n const [wrapperEl, setWrapperEl] = useElement<HTMLDivElement>(null);\n const [feedbackVal, setFeedbackVal] = useState('');\n const [showDialog, setShowDialog] = useState(false);\n const focusOnInteractionRef = useRef(false);\n\n const { message, announceInteraction, ...restProps } = props;\n const plainTextMessage = markdownToPlainText(message ?? '');\n let ariaLabel = plainTextMessage;\n\n const isStreamingMessage = isCoachMessage(props) && props.enableStreaming;\n const allChunksReceived = isCoachMessage(props) && props.allChunksReceived;\n const enableStreaming = !!isStreamingMessage && !allChunksReceived;\n\n const {\n text: streamingMessage,\n isAnimationDone: isStreamingDone,\n animatedTillCursor\n } = useAnimatedText({\n text: message ?? '',\n allContentReceived: allChunksReceived === undefined ? true : allChunksReceived,\n enabled: enableStreaming,\n tokenizeMarkdown: true,\n cursorStartIndex:\n isCoachMessage(props) && props.animationInitialCursorPos\n ? props.animationInitialCursorPos\n : undefined\n });\n\n useEffect(() => {\n if (isCoachMessage(props) && props.onAnimationCursorUpdate) {\n props.onAnimationCursorUpdate(animatedTillCursor);\n }\n }, [animatedTillCursor]);\n\n useEffect(() => {\n if (isStreamingMessage && props.onStreamingUpdate) {\n props.onStreamingUpdate(!!allChunksReceived && isStreamingDone);\n }\n }, [enableStreaming, isStreamingDone, allChunksReceived]);\n\n useElementFocus(wrapperEl, { shouldFocus: !showDialog && focusOnInteractionRef.current });\n\n useEffect(() => {\n if (!showDialog && focusOnInteractionRef.current) {\n focusOnInteractionRef.current = false;\n }\n }, [showDialog]);\n\n if (isCoachMessage(props)) {\n const { id: messageId, coachName, suggestions, onSend, loading, error, feedback } = props;\n\n const { reaction, onReaction, onFeedbackComplete } = feedback ?? {};\n\n let selectedFeedbackResponse;\n\n let feedbackAriaLabel = t('sender_replied_message', [coachName, plainTextMessage ?? '']);\n\n if (feedback && reaction) {\n selectedFeedbackResponse = t('selected_noun', [\n reaction === 'liked' ? t('good_response') : t('bad_response')\n ]);\n\n feedbackAriaLabel = `${feedbackAriaLabel} ${selectedFeedbackResponse}`;\n }\n\n ariaLabel =\n suggestions && suggestions.length > 0\n ? `${feedbackAriaLabel} ${t('suggestions_in_message', [suggestions.length])}`\n : feedbackAriaLabel;\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n const streamingContent = isStreamingMessage && (\n <>\n {message ? (\n <>\n <RichTextViewer\n content={isStreamingMessage ? streamingMessage : message}\n type='markdown'\n />\n {loading && <Progress variant='ellipsis' placement='inline' />}\n </>\n ) : (\n loading && <GenAIMessageProgress />\n )}\n </>\n );\n\n return (\n <Flex\n as='li'\n data-testid={testIds.coachMessage}\n {...restProps}\n container={{ direction: 'row', pad: [1, 0], gap: 0.5 }}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n <StyledGenAIAvatar\n name={coachName}\n icon='polaris-solid'\n color={theme.base.palette.ai}\n shape='circle'\n size='m'\n />\n <StyledMessage>\n {/* Streaming loader and content */}\n {streamingContent}\n {loading || error ? (\n <>\n {loading && !isStreamingMessage && <GenAIMessageProgress />}\n {error && <ErrorState message={error} />}\n </>\n ) : (\n <>\n {/* Non streaming content */}\n {!isStreamingMessage && message && (\n <RichTextViewer content={message} type='markdown' />\n )}\n {feedback && (\n <Flex container={{ pad: [0.5, undefined] }}>\n {reaction ? (\n <>\n <Flex\n container={{ pad: 0.5 }}\n aria-label={selectedFeedbackResponse}\n ref={setWrapperEl}\n tabIndex={-1}\n >\n <Icon\n name={reaction === 'liked' ? 'thumbs-up-solid' : 'thumbs-down-solid'}\n />\n </Flex>\n {showDialog ? (\n onFeedbackComplete &&\n wrapperEl && (\n <FormDialog\n target={wrapperEl}\n heading={t('share_feedback')}\n onCancel={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId);\n }}\n onSubmit={() => {\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }}\n onKeyDown={e => e.stopPropagation()}\n >\n <TextArea\n value={feedbackVal}\n onChange={e => setFeedbackVal(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n focusOnInteractionRef.current = true;\n setShowDialog(false);\n onFeedbackComplete(messageId, feedbackVal);\n }\n }}\n autoResize={false}\n />\n </FormDialog>\n )\n ) : (\n <Tooltip target={wrapperEl} describeTarget={false}>\n {reaction === 'liked' ? t('good_response') : t('bad_response')}\n </Tooltip>\n )}\n </>\n ) : (\n <>\n <Button\n label={t('good_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n onReaction?.(messageId, 'liked');\n focusOnInteractionRef.current = true;\n }}\n >\n <Icon name='thumbs-up' />\n </Button>\n\n <Button\n label={t('bad_response')}\n variant='simple'\n icon\n compact\n onClick={() => {\n setShowDialog(true);\n onReaction?.(messageId, 'disliked');\n }}\n >\n <Icon name='thumbs-down' />\n </Button>\n </>\n )}\n </Flex>\n )}\n {suggestions && (\n <Flex as={StyledSuggestionsContainer} container={{ direction: 'column', gap: 1 }}>\n {suggestions.map(({ id, message: prompt }) => {\n return (\n <Button\n as={StyledSuggestion}\n onClick={onSend ? () => onSend({ id, message: prompt }) : undefined}\n key={id}\n >\n {prompt}\n </Button>\n );\n })}\n </Flex>\n )}\n </>\n )}\n </StyledMessage>\n </Flex>\n );\n }\n\n if (isUserMessage(props)) {\n if (plainTextMessage) {\n ariaLabel = t('you_asked', [plainTextMessage]);\n }\n\n if (announceInteraction) {\n ariaLabel = `${ariaLabel} ${t('interaction_message')}`;\n }\n\n return (\n <StyledUserMessage\n as={StyledUserMessage}\n data-testid={testIds.userMessage}\n {...restProps}\n type='message'\n aria-label={ariaLabel}\n ref={ref}\n >\n {props.attachments && props.attachments.length > 0 && (\n <StyledAttachmentsList type='display' items={props.attachments} />\n )}\n {message && <RichTextViewer content={message} type='markdown' />}\n </StyledUserMessage>\n );\n }\n\n return null;\n }\n);\n\nexport default GenAIMessage;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialSuggestedMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/InitialSuggestedMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAIvE,QAAA,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,4BAA4B,
|
|
1
|
+
{"version":3,"file":"InitialSuggestedMessage.d.ts","sourceRoot":"","sources":["../../../src/components/GenAICoach/InitialSuggestedMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAIvE,QAAA,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,4BAA4B,CAyB1E,CAAC;AAEJ,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import { StyledSuggestedMessage } from './GenAICoach.styles';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTestIds } from '@pega/cosmos-react-core';
|
|
4
3
|
import { getGenAICoachTestIds } from './GenAICoach.test-ids';
|
|
4
|
+
import { StyledInitialMessageButton, StyledInitialMessageText } from './GenAICoach.styles';
|
|
5
5
|
const InitialSuggestedMessage = function SuggestionCard({ id, message, testId, onSend }) {
|
|
6
6
|
const testIds = useTestIds(testId, getGenAICoachTestIds);
|
|
7
|
-
|
|
8
|
-
return (_jsxs(Card, { container: { justify: 'between' }, as: StyledSuggestedMessage, onClick: () => {
|
|
7
|
+
return (_jsx(StyledInitialMessageButton, { onClick: () => {
|
|
9
8
|
onSend({ id, message });
|
|
10
9
|
}, onKeyDown: (e) => {
|
|
11
10
|
if (e.key === 'Enter') {
|
|
12
11
|
e.preventDefault();
|
|
13
12
|
onSend({ id, message });
|
|
14
13
|
}
|
|
15
|
-
}, "data-testid": testIds.root, children:
|
|
14
|
+
}, "data-testid": testIds.root, children: _jsx(StyledInitialMessageText, { children: message }) }));
|
|
16
15
|
};
|
|
17
16
|
export default InitialSuggestedMessage;
|
|
18
17
|
//# sourceMappingURL=InitialSuggestedMessage.js.map
|