@pega/cosmos-react-tools 8.0.0-build.9.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AgentTracer/AgentTraceEvent.d.ts +4 -0
- package/lib/components/AgentTracer/AgentTraceEvent.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTraceEvent.js +19 -0
- package/lib/components/AgentTracer/AgentTraceEvent.js.map +1 -0
- package/lib/components/AgentTracer/AgentTraceEventDetails.d.ts +4 -0
- package/lib/components/AgentTracer/AgentTraceEventDetails.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTraceEventDetails.js +46 -0
- package/lib/components/AgentTracer/AgentTraceEventDetails.js.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.d.ts +6 -0
- package/lib/components/AgentTracer/AgentTracer.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.js +31 -0
- package/lib/components/AgentTracer/AgentTracer.js.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.styles.d.ts +19 -0
- package/lib/components/AgentTracer/AgentTracer.styles.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.styles.js +123 -0
- package/lib/components/AgentTracer/AgentTracer.styles.js.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.test-ids.d.ts +2 -0
- package/lib/components/AgentTracer/AgentTracer.test-ids.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.test-ids.js +8 -0
- package/lib/components/AgentTracer/AgentTracer.test-ids.js.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.types.d.ts +73 -0
- package/lib/components/AgentTracer/AgentTracer.types.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTracer.types.js +2 -0
- package/lib/components/AgentTracer/AgentTracer.types.js.map +1 -0
- package/lib/components/AgentTracer/AgentTracerTree.d.ts +4 -0
- package/lib/components/AgentTracer/AgentTracerTree.d.ts.map +1 -0
- package/lib/components/AgentTracer/AgentTracerTree.js +82 -0
- package/lib/components/AgentTracer/AgentTracerTree.js.map +1 -0
- package/lib/components/AgentTracer/index.d.ts +3 -0
- package/lib/components/AgentTracer/index.d.ts.map +1 -0
- package/lib/components/AgentTracer/index.js +3 -0
- package/lib/components/AgentTracer/index.js.map +1 -0
- package/lib/components/Clipboard/Clipboard.d.ts +2 -3
- package/lib/components/Clipboard/Clipboard.d.ts.map +1 -1
- package/lib/components/Clipboard/Clipboard.js +5 -1
- package/lib/components/Clipboard/Clipboard.js.map +1 -1
- package/lib/components/Clipboard/Clipboard.styles.d.ts +1 -1
- package/lib/components/Clipboard/Clipboard.styles.d.ts.map +1 -1
- package/lib/components/PreviewShell/Header.d.ts +2 -3
- package/lib/components/PreviewShell/Header.d.ts.map +1 -1
- package/lib/components/PreviewShell/Header.js +1 -1
- package/lib/components/PreviewShell/Header.js.map +1 -1
- package/lib/components/PreviewShell/PreviewShell.d.ts +2 -3
- package/lib/components/PreviewShell/PreviewShell.d.ts.map +1 -1
- package/lib/components/PreviewShell/PreviewShell.js.map +1 -1
- package/lib/components/PreviewShell/PreviewShell.styles.d.ts +1 -1
- package/lib/components/PreviewShell/PreviewShell.styles.d.ts.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +10 -6
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentTraceEventProps } from './AgentTracer.types';
|
|
2
|
+
declare const AgentTraceEvent: ({ primary, secondary, icon, metrics, testId }: Pick<AgentTraceEventProps, "primary" | "secondary" | "icon" | "metrics" | "testId">) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default AgentTraceEvent;
|
|
4
|
+
//# sourceMappingURL=AgentTraceEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTraceEvent.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTraceEvent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,qBAAqB,CAAC;AAgC7B,QAAA,MAAM,eAAe,kDAMlB,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,4CAgBrF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconTile } from '@pega/cosmos-react-build';
|
|
3
|
+
import { FieldValueItem, Flex, formatDuration, Text, useConfiguration } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledAgentMetricItem, StyledEventLabel, StyledEventLabelContainer } from './AgentTracer.styles';
|
|
5
|
+
const MetricItem = ({ metric, testId }) => {
|
|
6
|
+
const { locale } = useConfiguration();
|
|
7
|
+
return metric ? (_jsx(FieldValueItem, { name: metric.label, value: _jsx(StyledAgentMetricItem, { children: metric.type === 'duration'
|
|
8
|
+
? formatDuration(metric.value, {
|
|
9
|
+
locale,
|
|
10
|
+
significantUnits: 2,
|
|
11
|
+
maxPrecision: 'millisecond'
|
|
12
|
+
})
|
|
13
|
+
: `${metric.value}` }), variant: 'stacked', testId: testId })) : (_jsx(StyledAgentMetricItem, {}));
|
|
14
|
+
};
|
|
15
|
+
const AgentTraceEvent = ({ primary, secondary, icon, metrics, testId }) => {
|
|
16
|
+
return (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 2 }, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, item: { basis: '50%' }, children: [_jsx(IconTile, { ...icon }), _jsxs(StyledEventLabelContainer, { container: { direction: 'column', colGap: 1 }, children: [_jsx(Text, { variant: 'secondary', children: secondary }), _jsx(StyledEventLabel, { "data-testid": testId, children: primary })] })] }), _jsxs(Flex, { container: { gap: 2, justify: 'end' }, as: 'dl', children: [_jsx(MetricItem, { metric: metrics?.[0], testId: testId }), _jsx(MetricItem, { metric: metrics?.[1], testId: testId })] })] }));
|
|
17
|
+
};
|
|
18
|
+
export default AgentTraceEvent;
|
|
19
|
+
//# sourceMappingURL=AgentTraceEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTraceEvent.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTraceEvent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,cAAc,EACd,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAO9B,MAAM,UAAU,GAAG,CAAC,EAClB,MAAM,EACN,MAAM,EAGM,EAAE,EAAE;IAChB,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEtC,OAAO,MAAM,CAAC,CAAC,CAAC,CACd,KAAC,cAAc,IACb,IAAI,EAAE,MAAM,CAAC,KAAK,EAClB,KAAK,EACH,KAAC,qBAAqB,cACnB,MAAM,CAAC,IAAI,KAAK,UAAU;gBACzB,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE;oBAC3B,MAAM;oBACN,gBAAgB,EAAE,CAAC;oBACnB,YAAY,EAAE,aAAa;iBAC5B,CAAC;gBACJ,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,GACC,EAE1B,OAAO,EAAC,SAAS,EACjB,MAAM,EAAE,MAAM,GACd,CACH,CAAC,CAAC,CAAC,CACF,KAAC,qBAAqB,KAAG,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,EACvB,OAAO,EACP,SAAS,EACT,IAAI,EACJ,OAAO,EACP,MAAM,EAC8E,EAAE,EAAE;IACxF,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACnE,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,aACvE,KAAC,QAAQ,OAAK,IAAI,GAAI,EACtB,MAAC,yBAAyB,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,aACtE,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,SAAS,GAAQ,EAC5C,KAAC,gBAAgB,mBAAc,MAAM,YAAG,OAAO,GAAoB,IACzC,IACvB,EACP,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAC,IAAI,aAClD,KAAC,UAAU,IAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,EACpD,KAAC,UAAU,IAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,IAC/C,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { IconTile } from '@pega/cosmos-react-build';\nimport {\n FieldValueItem,\n Flex,\n formatDuration,\n Text,\n useConfiguration\n} from '@pega/cosmos-react-core';\nimport type { TestIdProp } from '@pega/cosmos-react-core';\n\nimport {\n StyledAgentMetricItem,\n StyledEventLabel,\n StyledEventLabelContainer\n} from './AgentTracer.styles';\nimport type {\n AgentTraceEventProps,\n AgentTracerDurationMetric,\n AgentTracerTokenMetric\n} from './AgentTracer.types';\n\nconst MetricItem = ({\n metric,\n testId\n}: {\n metric?: AgentTracerDurationMetric | AgentTracerTokenMetric;\n} & TestIdProp) => {\n const { locale } = useConfiguration();\n\n return metric ? (\n <FieldValueItem\n name={metric.label}\n value={\n <StyledAgentMetricItem>\n {metric.type === 'duration'\n ? formatDuration(metric.value, {\n locale,\n significantUnits: 2,\n maxPrecision: 'millisecond'\n })\n : `${metric.value}`}\n </StyledAgentMetricItem>\n }\n variant='stacked'\n testId={testId}\n />\n ) : (\n <StyledAgentMetricItem />\n );\n};\n\nconst AgentTraceEvent = ({\n primary,\n secondary,\n icon,\n metrics,\n testId\n}: Pick<AgentTraceEventProps, 'primary' | 'secondary' | 'icon' | 'metrics' | 'testId'>) => {\n return (\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }}>\n <Flex container={{ gap: 1, alignItems: 'center' }} item={{ basis: '50%' }}>\n <IconTile {...icon} />\n <StyledEventLabelContainer container={{ direction: 'column', colGap: 1 }}>\n <Text variant='secondary'>{secondary}</Text>\n <StyledEventLabel data-testid={testId}>{primary}</StyledEventLabel>\n </StyledEventLabelContainer>\n </Flex>\n <Flex container={{ gap: 2, justify: 'end' }} as='dl'>\n <MetricItem metric={metrics?.[0]} testId={testId} />\n <MetricItem metric={metrics?.[1]} testId={testId} />\n </Flex>\n </Flex>\n );\n};\n\nexport default AgentTraceEvent;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentTraceEventDetailsProps } from './AgentTracer.types';
|
|
2
|
+
declare const AgentTraceEventDetails: ({ primary, secondary, metrics, icon, contents, metricGroups, testId }: AgentTraceEventDetailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default AgentTraceEventDetails;
|
|
4
|
+
//# sourceMappingURL=AgentTraceEventDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTraceEventDetails.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTraceEventDetails.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAEV,2BAA2B,EAE5B,MAAM,qBAAqB,CAAC;AAqF7B,QAAA,MAAM,sBAAsB,0EAQzB,2BAA2B,4CAkC7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { CodeEditor } from '@pega/cosmos-react-build';
|
|
4
|
+
import { Button, FieldValueItem, FieldValueList, Flex, Icon, registerIcon, StyledLabel, Text, tryCatch, useBreakpoint, useI18n, useToaster, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
5
|
+
import * as CopyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/copy.icon';
|
|
6
|
+
import AgentTraceEvent from './AgentTraceEvent';
|
|
7
|
+
import { StyledAgentTracerContent, StyledAgentTracerMetricGroup, StyledAgentTracerMetricLabel, StyledContentsGroupContainer, StyledDetailsHeader, StyledRichTextViewer, StyledScrollWrapper } from './AgentTracer.styles';
|
|
8
|
+
registerIcon(CopyIcon);
|
|
9
|
+
const CopyButton = ({ value }) => {
|
|
10
|
+
const { push } = useToaster();
|
|
11
|
+
const t = useI18n();
|
|
12
|
+
const handleCopy = (message) => {
|
|
13
|
+
if (message) {
|
|
14
|
+
navigator.clipboard.writeText(message).then(() => {
|
|
15
|
+
push({ content: t('copied_to_clipboard') });
|
|
16
|
+
}, () => {
|
|
17
|
+
push({ content: t('failed_to_copy') });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return (_jsxs(Button, { variant: 'link', icon: true, onClick: () => handleCopy(value), children: [_jsx(Icon, { name: 'copy', size: 'font-size' }), _jsx(Text, { variant: 'primary', children: t('copy') })] }));
|
|
22
|
+
};
|
|
23
|
+
const ContentContainer = ({ id, label, value }) => {
|
|
24
|
+
const parsedValue = tryCatch(() => {
|
|
25
|
+
return JSON.stringify(JSON.parse(value), null, 2);
|
|
26
|
+
});
|
|
27
|
+
const codeEditorHandle = useRef(null);
|
|
28
|
+
return (_jsxs(StyledAgentTracerContent, { container: { direction: 'column', gap: 1 }, item: { grow: 1 }, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [_jsx(StyledLabel, { as: 'span', children: label }), _jsx(CopyButton, { value: value })] }), parsedValue ? (_jsx(CodeEditor, { codeEditorHandle: codeEditorHandle, defaultValue: parsedValue, readOnly: true, editorConfigProps: {
|
|
29
|
+
mode: 'json',
|
|
30
|
+
readOnly: 'nocursor',
|
|
31
|
+
lineNumbers: true
|
|
32
|
+
} }, id)) : (_jsx(StyledRichTextViewer, { content: value, type: 'markdown' }))] }));
|
|
33
|
+
};
|
|
34
|
+
const EventMetricGroup = ({ label, metrics }) => {
|
|
35
|
+
const metricGroupContainer = useRef(null);
|
|
36
|
+
const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: metricGroupContainer });
|
|
37
|
+
return (_jsxs(StyledAgentTracerMetricGroup, { container: { direction: 'column', gap: 0.5 }, ref: metricGroupContainer, children: [_jsx(StyledAgentTracerMetricLabel, { as: 'span', children: label }), isSmallOrAbove ? (_jsx(Flex, { container: { gap: 3 }, as: 'dl', children: metrics.map(metric => {
|
|
38
|
+
return _jsx(FieldValueItem, { name: metric.label, value: metric.value, variant: 'stacked' });
|
|
39
|
+
}) })) : (_jsx(FieldValueList, { fields: metrics.map(metric => ({ name: metric.label, value: metric.value })) }))] }));
|
|
40
|
+
};
|
|
41
|
+
const AgentTraceEventDetails = ({ primary, secondary, metrics, icon, contents, metricGroups, testId }) => {
|
|
42
|
+
const t = useI18n();
|
|
43
|
+
return (_jsxs(StyledScrollWrapper, { container: { direction: 'column' }, children: [_jsx(VisuallyHiddenText, { as: 'h3', children: t('details') }), _jsx(StyledDetailsHeader, { item: { grow: 0 }, children: _jsx(AgentTraceEvent, { primary: primary, secondary: secondary, icon: icon, metrics: metrics, testId: testId }) }), metricGroups && metricGroups.length > 0 && (_jsx(StyledContentsGroupContainer, { container: { direction: 'column', gap: 2 }, item: { shrink: 0 }, children: metricGroups.map(metricGroup => (_jsx(EventMetricGroup, { ...metricGroup }))) })), contents && contents.length > 0 && (_jsx(StyledContentsGroupContainer, { container: { direction: 'column', gap: 1 }, children: contents.map(content => (_jsx(ContentContainer, { ...content }))) }))] }));
|
|
44
|
+
};
|
|
45
|
+
export default AgentTraceEventDetails;
|
|
46
|
+
//# sourceMappingURL=AgentTraceEventDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTraceEventDetails.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTraceEventDetails.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,MAAM,EACN,cAAc,EACd,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,UAAU,EACV,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAExF,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAO9B,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAqB,EAAE,EAAE;IAClD,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;IAC9B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,I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O,CAAC,EAAE,CAAC,CACvB,KAAC,gBAAgB,OAAK,OAAO,GAAI,CAClC,CAAC,GAC2B,CAChC,IACmB,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { useRef } from 'react';\n\nimport { CodeEditor } from '@pega/cosmos-react-build';\nimport {\n Button,\n FieldValueItem,\n FieldValueList,\n Flex,\n Icon,\n registerIcon,\n StyledLabel,\n Text,\n tryCatch,\n useBreakpoint,\n useI18n,\n useToaster,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport * as CopyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/copy.icon';\n\nimport AgentTraceEvent from './AgentTraceEvent';\nimport {\n StyledAgentTracerContent,\n StyledAgentTracerMetricGroup,\n StyledAgentTracerMetricLabel,\n StyledContentsGroupContainer,\n StyledDetailsHeader,\n StyledRichTextViewer,\n StyledScrollWrapper\n} from './AgentTracer.styles';\nimport type {\n AgentTraceEventContent,\n AgentTraceEventDetailsProps,\n AgentTraceMetricGroupProps\n} from './AgentTracer.types';\n\nregisterIcon(CopyIcon);\n\nconst CopyButton = ({ value }: { value: string }) => {\n const { push } = useToaster();\n const t = useI18n();\n\n const handleCopy = (message: string) => {\n if (message) {\n navigator.clipboard.writeText(message).then(\n () => {\n push({ content: t('copied_to_clipboard') });\n },\n () => {\n push({ content: t('failed_to_copy') });\n }\n );\n }\n };\n\n return (\n <Button variant='link' icon onClick={() => handleCopy(value)}>\n <Icon name='copy' size='font-size' />\n <Text variant='primary'>{t('copy')}</Text>\n </Button>\n );\n};\n\nconst ContentContainer = ({ id, label, value }: AgentTraceEventContent) => {\n const parsedValue = tryCatch(() => {\n return JSON.stringify(JSON.parse(value), null, 2);\n });\n const codeEditorHandle = useRef(null);\n\n return (\n <StyledAgentTracerContent container={{ direction: 'column', gap: 1 }} item={{ grow: 1 }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n <StyledLabel as='span'>{label}</StyledLabel>\n <CopyButton value={value} />\n </Flex>\n {parsedValue ? (\n <CodeEditor\n key={id}\n codeEditorHandle={codeEditorHandle}\n defaultValue={parsedValue}\n readOnly\n editorConfigProps={{\n mode: 'json',\n readOnly: 'nocursor',\n lineNumbers: true\n }}\n />\n ) : (\n <StyledRichTextViewer content={value} type='markdown' />\n )}\n </StyledAgentTracerContent>\n );\n};\n\nconst EventMetricGroup = ({ label, metrics }: AgentTraceMetricGroupProps) => {\n const metricGroupContainer = useRef<HTMLElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: metricGroupContainer });\n\n return (\n <StyledAgentTracerMetricGroup\n container={{ direction: 'column', gap: 0.5 }}\n ref={metricGroupContainer}\n >\n <StyledAgentTracerMetricLabel as='span'>{label}</StyledAgentTracerMetricLabel>\n {isSmallOrAbove ? (\n <Flex container={{ gap: 3 }} as='dl'>\n {metrics.map(metric => {\n return <FieldValueItem name={metric.label} value={metric.value} variant='stacked' />;\n })}\n </Flex>\n ) : (\n <FieldValueList\n fields={metrics.map(metric => ({ name: metric.label, value: metric.value }))}\n />\n )}\n </StyledAgentTracerMetricGroup>\n );\n};\n\nconst AgentTraceEventDetails = ({\n primary,\n secondary,\n metrics,\n icon,\n contents,\n metricGroups,\n testId\n}: AgentTraceEventDetailsProps) => {\n const t = useI18n();\n\n return (\n <StyledScrollWrapper container={{ direction: 'column' }}>\n <VisuallyHiddenText as='h3'>{t('details')}</VisuallyHiddenText>\n <StyledDetailsHeader item={{ grow: 0 }}>\n <AgentTraceEvent\n primary={primary}\n secondary={secondary}\n icon={icon}\n metrics={metrics}\n testId={testId}\n />\n </StyledDetailsHeader>\n {metricGroups && metricGroups.length > 0 && (\n <StyledContentsGroupContainer\n container={{ direction: 'column', gap: 2 }}\n item={{ shrink: 0 }}\n >\n {metricGroups.map(metricGroup => (\n <EventMetricGroup {...metricGroup} />\n ))}\n </StyledContentsGroupContainer>\n )}\n {contents && contents.length > 0 && (\n <StyledContentsGroupContainer container={{ direction: 'column', gap: 1 }}>\n {contents.map(content => (\n <ContentContainer {...content} />\n ))}\n </StyledContentsGroupContainer>\n )}\n </StyledScrollWrapper>\n );\n};\n\nexport default AgentTraceEventDetails;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentTracerProps } from './AgentTracer.types';
|
|
2
|
+
declare const _default: (({ primary, events, metrics, secondary, onRefresh, loading, error, testId }: AgentTracerProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["header", "refresh", "events", "details"]>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=AgentTracer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAA+B,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;sGAWtF,gBAAgB;;;AAgFnB,wBAA4D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Button, EmptyState, ErrorState, Flex, Progress, useI18n, useTestIds, withTestIds } from '@pega/cosmos-react-core';
|
|
4
|
+
import AgentTracerEvent from './AgentTraceEvent';
|
|
5
|
+
import AgentTraceEventDetails from './AgentTraceEventDetails';
|
|
6
|
+
import { StyledAgentTracerContainer, StyledDetailsContainer, StyledScrollWrapper, StyledAgentTracerHeader, StyledAgentTracerTreeContainer } from './AgentTracer.styles';
|
|
7
|
+
import { agentTracerTestIds } from './AgentTracer.test-ids';
|
|
8
|
+
import AgentTracerTree from './AgentTracerTree';
|
|
9
|
+
const AgentTracer = ({ primary, events, metrics, secondary, onRefresh, loading, error, testId }) => {
|
|
10
|
+
const [selectedEvent, setSelectedEvent] = useState();
|
|
11
|
+
const tracerRef = useRef(null);
|
|
12
|
+
const testIds = useTestIds(testId, agentTracerTestIds);
|
|
13
|
+
const t = useI18n();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setSelectedEvent(events?.find(event => event.selected));
|
|
16
|
+
}, [events]);
|
|
17
|
+
const tracerContent = useMemo(() => {
|
|
18
|
+
if (loading || error) {
|
|
19
|
+
return (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, children: loading ? (_jsx(Progress, { variant: 'ring', placement: 'block', message: t('loading') })) : (_jsx(ErrorState, { message: error })) }));
|
|
20
|
+
}
|
|
21
|
+
if (!events?.length) {
|
|
22
|
+
return _jsx(EmptyState, { message: t('no_conversations_found') });
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs(StyledScrollWrapper, { item: { grow: 1, basis: '90%' }, container: { direction: 'column' }, md: { container: { direction: 'row' } }, children: [_jsx(StyledAgentTracerTreeContainer, { item: { basis: '35%' }, children: _jsx(AgentTracerTree, { events: events, onSelect: event => {
|
|
25
|
+
setSelectedEvent(event);
|
|
26
|
+
}, selectedNodeId: selectedEvent?.id, testId: testIds.events }) }), _jsx(StyledScrollWrapper, { item: { basis: '65%' }, children: selectedEvent ? (_jsx(StyledDetailsContainer, { container: { direction: 'column', gap: 2 }, children: _jsx(AgentTraceEventDetails, { ...selectedEvent, testId: testIds.details }) })) : (_jsx(EmptyState, { message: t('agent_tracer_select_an_event') })) })] }));
|
|
27
|
+
}, [loading, error, events, selectedEvent]);
|
|
28
|
+
return (_jsxs(StyledAgentTracerContainer, { container: { direction: 'column' }, ref: tracerRef, children: [_jsxs(StyledAgentTracerHeader, { container: { gap: 2, alignItems: 'center' }, item: { grow: 0 }, children: [_jsx(Flex, { item: { grow: 1 }, children: _jsx(AgentTracerEvent, { icon: { name: 'polaris-solid', category: 'ai', size: 'xl' }, primary: primary, metrics: metrics, secondary: secondary || t('agent'), testId: testIds.header }) }), onRefresh && (_jsx(Button, { variant: 'primary', onClick: onRefresh, "data-testid": testIds.refresh, children: t('refresh') }))] }), tracerContent] }));
|
|
29
|
+
};
|
|
30
|
+
export default withTestIds(AgentTracer, agentTracerTestIds);
|
|
31
|
+
//# sourceMappingURL=AgentTracer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AACjD,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,WAAW,GAAG,CAAC,EACnB,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,MAAM,EACW,EAAE,EAAE;IACrB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,EAA2C,CAAC;IAC9F,MAAM,SAAS,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAEvD,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,C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IACa,CAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\n\nimport {\n Button,\n EmptyState,\n ErrorState,\n Flex,\n Progress,\n useI18n,\n useTestIds,\n withTestIds\n} from '@pega/cosmos-react-core';\n\nimport AgentTracerEvent from './AgentTraceEvent';\nimport AgentTraceEventDetails from './AgentTraceEventDetails';\nimport {\n StyledAgentTracerContainer,\n StyledDetailsContainer,\n StyledScrollWrapper,\n StyledAgentTracerHeader,\n StyledAgentTracerTreeContainer\n} from './AgentTracer.styles';\nimport { agentTracerTestIds } from './AgentTracer.test-ids';\nimport AgentTracerTree from './AgentTracerTree';\nimport type { AgentTraceEventDetailsProps, AgentTracerProps } from './AgentTracer.types';\n\nconst AgentTracer = ({\n primary,\n events,\n metrics,\n secondary,\n onRefresh,\n loading,\n error,\n testId\n}: AgentTracerProps) => {\n const [selectedEvent, setSelectedEvent] = useState<AgentTraceEventDetailsProps | undefined>();\n const tracerRef = useRef<HTMLButtonElement>(null);\n const testIds = useTestIds(testId, agentTracerTestIds);\n\n const t = useI18n();\n\n useEffect(() => {\n setSelectedEvent(events?.find(event => event.selected));\n }, [events]);\n\n const tracerContent = useMemo(() => {\n if (loading || error) {\n return (\n <Flex container={{ justify: 'center', alignItems: 'center' }}>\n {loading ? (\n <Progress variant='ring' placement='block' message={t('loading')} />\n ) : (\n <ErrorState message={error} />\n )}\n </Flex>\n );\n }\n if (!events?.length) {\n return <EmptyState message={t('no_conversations_found')} />;\n }\n\n return (\n <StyledScrollWrapper\n item={{ grow: 1, basis: '90%' }}\n container={{ direction: 'column' }}\n md={{ container: { direction: 'row' } }}\n >\n <StyledAgentTracerTreeContainer item={{ basis: '35%' }}>\n <AgentTracerTree\n events={events}\n onSelect={event => {\n setSelectedEvent(event);\n }}\n selectedNodeId={selectedEvent?.id}\n testId={testIds.events}\n />\n </StyledAgentTracerTreeContainer>\n\n <StyledScrollWrapper item={{ basis: '65%' }}>\n {selectedEvent ? (\n <StyledDetailsContainer container={{ direction: 'column', gap: 2 }}>\n <AgentTraceEventDetails {...selectedEvent} testId={testIds.details} />\n </StyledDetailsContainer>\n ) : (\n <EmptyState message={t('agent_tracer_select_an_event')} />\n )}\n </StyledScrollWrapper>\n </StyledScrollWrapper>\n );\n }, [loading, error, events, selectedEvent]);\n\n return (\n <StyledAgentTracerContainer container={{ direction: 'column' }} ref={tracerRef}>\n <StyledAgentTracerHeader container={{ gap: 2, alignItems: 'center' }} item={{ grow: 0 }}>\n <Flex item={{ grow: 1 }}>\n <AgentTracerEvent\n icon={{ name: 'polaris-solid', category: 'ai', size: 'xl' }}\n primary={primary}\n metrics={metrics}\n secondary={secondary || t('agent')}\n testId={testIds.header}\n />\n </Flex>\n {onRefresh && (\n <Button variant='primary' onClick={onRefresh} data-testid={testIds.refresh}>\n {t('refresh')}\n </Button>\n )}\n </StyledAgentTracerHeader>\n {tracerContent}\n </StyledAgentTracerContainer>\n );\n};\n\nexport default withTestIds(AgentTracer, agentTracerTestIds);\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const StyledAgentTracerHeader: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledScrollWrapper: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const StyledContentsGroupContainer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const StyledAgentTracerTreeContainer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
export declare const StyledAgentTracerContainer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const StyledEventLabelContainer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const StyledEventLabel: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledAgentTreeItem: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
/** Details */
|
|
10
|
+
export declare const StyledDetailsContainer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
11
|
+
export declare const StyledDetailsHeader: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
12
|
+
export declare const StyledRichTextViewer: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-rte").RichTextViewerProps> & {
|
|
13
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
14
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
|
15
|
+
export declare const StyledAgentTracerContent: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
16
|
+
export declare const StyledAgentTracerMetricGroup: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
17
|
+
export declare const StyledAgentTracerMetricLabel: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, Pick<import("@pega/cosmos-react-core").LabelProps, "htmlFor" | "labelHidden">, never>;
|
|
18
|
+
export declare const StyledAgentMetricItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
+
//# sourceMappingURL=AgentTracer.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.styles.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,uBAAuB,kNAMnC,CAAC;AAIF,eAAO,MAAM,mBAAmB,kNAG/B,CAAC;AAIF,eAAO,MAAM,4BAA4B,kNAKxC,CAAC;AAIF,eAAO,MAAM,8BAA8B,kNAgBzC,CAAC;AAMH,eAAO,MAAM,0BAA0B,kNAKtC,CAAC;AAIF,eAAO,MAAM,yBAAyB,kNAGrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,kNAS5B,CAAC;AAIF,eAAO,MAAM,mBAAmB,kNAO9B,CAAC;AAIH,cAAc;AACd,eAAO,MAAM,sBAAsB,kNAUjC,CAAC;AAIH,eAAO,MAAM,mBAAmB,kNAU/B,CAAC;AAIF,eAAO,MAAM,oBAAoB;2BArHhB,CAAC,SAAU,yBAAwB,kCAE7C,yBAAyB;uDA2H/B,CAAC;AAIF,eAAO,MAAM,wBAAwB,kNAQpC,CAAC;AAIF,eAAO,MAAM,4BAA4B,kNAIxC,CAAC;AAIF,eAAO,MAAM,4BAA4B,sLAOvC,CAAC;AAKH,eAAO,MAAM,qBAAqB,yGAEjC,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { calculateFontSize, defaultThemeProp, Flex, StyledLabel, Text } from '@pega/cosmos-react-core';
|
|
3
|
+
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
4
|
+
import { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';
|
|
5
|
+
export const StyledAgentTracerHeader = styled(Flex)(({ theme }) => css `
|
|
6
|
+
border: none;
|
|
7
|
+
border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
8
|
+
padding-block: 0 ${theme.base.spacing};
|
|
9
|
+
`);
|
|
10
|
+
StyledAgentTracerHeader.defaultProps = defaultThemeProp;
|
|
11
|
+
export const StyledScrollWrapper = styled(Flex) `
|
|
12
|
+
max-height: 100%;
|
|
13
|
+
overflow-y: auto;
|
|
14
|
+
`;
|
|
15
|
+
StyledScrollWrapper.defaultProps = defaultThemeProp;
|
|
16
|
+
export const StyledContentsGroupContainer = styled(Flex)(({ theme }) => `
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
padding-block: ${theme.base.spacing};
|
|
19
|
+
`);
|
|
20
|
+
StyledContentsGroupContainer.defaultProps = defaultThemeProp;
|
|
21
|
+
export const StyledAgentTracerTreeContainer = styled(Flex)(({ theme }) => {
|
|
22
|
+
return css `
|
|
23
|
+
max-height: 100%;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
26
|
+
padding-block-end: ${theme.base.spacing};
|
|
27
|
+
margin-block-end: ${theme.base.spacing};
|
|
28
|
+
|
|
29
|
+
@media (min-width: ${theme.base.breakpoints.md}) {
|
|
30
|
+
border-block-end: 0;
|
|
31
|
+
padding-block-end: 0;
|
|
32
|
+
margin-block-end: 0;
|
|
33
|
+
border-inline-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
34
|
+
margin-inline-end: ${theme.base.spacing};
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
});
|
|
38
|
+
StyledAgentTracerTreeContainer.defaultProps = defaultThemeProp;
|
|
39
|
+
/* Main container */
|
|
40
|
+
export const StyledAgentTracerContainer = styled(Flex)(({ theme }) => css `
|
|
41
|
+
height: calc(var(--case-view-height, 100vh) - 13vh);
|
|
42
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
43
|
+
`);
|
|
44
|
+
StyledAgentTracerContainer.defaultProps = defaultThemeProp;
|
|
45
|
+
export const StyledEventLabelContainer = styled(Flex) `
|
|
46
|
+
${ellipsisOverflow}
|
|
47
|
+
display: block;
|
|
48
|
+
`;
|
|
49
|
+
export const StyledEventLabel = styled(Text)(({ theme }) => `
|
|
50
|
+
overflow: inherit;
|
|
51
|
+
white-space: inherit;
|
|
52
|
+
text-overflow: inherit;
|
|
53
|
+
width: 100%;
|
|
54
|
+
display: inherit;
|
|
55
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
56
|
+
`);
|
|
57
|
+
StyledEventLabel.defaultProps = defaultThemeProp;
|
|
58
|
+
export const StyledAgentTreeItem = styled(Flex)(({ theme }) => {
|
|
59
|
+
return css `
|
|
60
|
+
width: 100%;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
padding-inline-start: calc(2 * ${theme.base.spacing});
|
|
63
|
+
padding-block: ${theme.base.spacing};
|
|
64
|
+
`;
|
|
65
|
+
});
|
|
66
|
+
StyledAgentTreeItem.defaultProps = defaultThemeProp;
|
|
67
|
+
/** Details */
|
|
68
|
+
export const StyledDetailsContainer = styled(Flex)(({ theme }) => {
|
|
69
|
+
return css `
|
|
70
|
+
padding: ${theme.base.spacing};
|
|
71
|
+
height: 100%;
|
|
72
|
+
|
|
73
|
+
@media (max-width: ${theme.base.breakpoints.md}) {
|
|
74
|
+
border: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
75
|
+
border-radius: ${theme.base['border-radius']};
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
});
|
|
79
|
+
StyledDetailsContainer.defaultProps = defaultThemeProp;
|
|
80
|
+
export const StyledDetailsHeader = styled(Flex)(({ theme }) => css `
|
|
81
|
+
position: sticky;
|
|
82
|
+
inset-block-start: 0;
|
|
83
|
+
z-index: calc(${theme.base['z-index'].backdrop} - 1);
|
|
84
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
85
|
+
border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
86
|
+
padding-block: 0 ${theme.base.spacing};
|
|
87
|
+
margin-block-end: ${theme.base.spacing};
|
|
88
|
+
`);
|
|
89
|
+
StyledDetailsHeader.defaultProps = defaultThemeProp;
|
|
90
|
+
export const StyledRichTextViewer = styled(RichTextViewer)(({ theme }) => `
|
|
91
|
+
border: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
92
|
+
padding: ${theme.base.spacing};
|
|
93
|
+
border-radius: ${theme.base.spacing};
|
|
94
|
+
max-height: 100%;
|
|
95
|
+
overflow-y: auto;
|
|
96
|
+
`);
|
|
97
|
+
StyledRichTextViewer.defaultProps = defaultThemeProp;
|
|
98
|
+
export const StyledAgentTracerContent = styled(Flex)(({ theme }) => `
|
|
99
|
+
padding: ${theme.base.spacing};
|
|
100
|
+
overflow-y: scroll;
|
|
101
|
+
|
|
102
|
+
/* minimum height to display code editor without cropping borders */
|
|
103
|
+
min-height: 7rem;
|
|
104
|
+
`);
|
|
105
|
+
StyledAgentTracerContent.defaultProps = defaultThemeProp;
|
|
106
|
+
export const StyledAgentTracerMetricGroup = styled(Flex)(({ theme }) => `
|
|
107
|
+
padding-inline: ${theme.base.spacing}
|
|
108
|
+
`);
|
|
109
|
+
StyledAgentTracerMetricGroup.defaultProps = defaultThemeProp;
|
|
110
|
+
export const StyledAgentTracerMetricLabel = styled(StyledLabel)(({ theme }) => {
|
|
111
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
112
|
+
return css `
|
|
113
|
+
font-size: ${fontSize[theme.components.text.h3['font-size']]};
|
|
114
|
+
font-family: ${theme.components.text.h3['font-family']};
|
|
115
|
+
font-weight: ${theme.components.text.h3['font-weight']};
|
|
116
|
+
`;
|
|
117
|
+
});
|
|
118
|
+
StyledAgentTracerMetricLabel.defaultProps = defaultThemeProp;
|
|
119
|
+
// To keep all Duration and Token metrics aligned irrespective of the value, width is based on max string currently possible ex : '59s 977.777ms'
|
|
120
|
+
export const StyledAgentMetricItem = styled.div `
|
|
121
|
+
min-width: 13ch;
|
|
122
|
+
`;
|
|
123
|
+
//# sourceMappingURL=AgentTracer.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.styles.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,IAAI,EACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAE7E,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CACjD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;wCAEoB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;uBAClD,KAAK,CAAC,IAAI,CAAC,OAAO;GACtC,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;CAG9C,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,I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,CAAC;AAE7D,iJAAiJ;AACjJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE9C,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n defaultThemeProp,\n Flex,\n StyledLabel,\n Text\n} from '@pega/cosmos-react-core';\nimport type { FontSize } from '@pega/cosmos-react-core';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\nimport { ellipsisOverflow } from '@pega/cosmos-react-core/lib/styles/mixins';\n\nexport const StyledAgentTracerHeader = styled(Flex)(\n ({ theme }) => css`\n border: none;\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-block: 0 ${theme.base.spacing};\n `\n);\n\nStyledAgentTracerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrapper = styled(Flex)`\n max-height: 100%;\n overflow-y: auto;\n`;\n\nStyledScrollWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledContentsGroupContainer = styled(Flex)(\n ({ theme }) => `\n overflow-y: auto;\n padding-block: ${theme.base.spacing};\n`\n);\n\nStyledContentsGroupContainer.defaultProps = defaultThemeProp;\n\nexport const StyledAgentTracerTreeContainer = styled(Flex)(({ theme }) => {\n return css`\n max-height: 100%;\n overflow-y: auto;\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-block-end: ${theme.base.spacing};\n margin-block-end: ${theme.base.spacing};\n\n @media (min-width: ${theme.base.breakpoints.md}) {\n border-block-end: 0;\n padding-block-end: 0;\n margin-block-end: 0;\n border-inline-end: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledAgentTracerTreeContainer.defaultProps = defaultThemeProp;\n\n/* Main container */\n\nexport const StyledAgentTracerContainer = styled(Flex)(\n ({ theme }) => css`\n height: calc(var(--case-view-height, 100vh) - 13vh);\n background-color: ${theme.base.palette['primary-background']};\n `\n);\n\nStyledAgentTracerContainer.defaultProps = defaultThemeProp;\n\nexport const StyledEventLabelContainer = styled(Flex)`\n ${ellipsisOverflow}\n display: block;\n`;\n\nexport const StyledEventLabel = styled(Text)(\n ({ theme }) => `\n overflow: inherit;\n white-space: inherit;\n text-overflow: inherit;\n width: 100%;\n display: inherit;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n`\n);\n\nStyledEventLabel.defaultProps = defaultThemeProp;\n\nexport const StyledAgentTreeItem = styled(Flex)(({ theme }) => {\n return css`\n width: 100%;\n overflow: hidden;\n padding-inline-start: calc(2 * ${theme.base.spacing});\n padding-block: ${theme.base.spacing};\n `;\n});\n\nStyledAgentTreeItem.defaultProps = defaultThemeProp;\n\n/** Details */\nexport const StyledDetailsContainer = styled(Flex)(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n height: 100%;\n\n @media (max-width: ${theme.base.breakpoints.md}) {\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: ${theme.base['border-radius']};\n }\n `;\n});\n\nStyledDetailsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledDetailsHeader = styled(Flex)(\n ({ theme }) => css`\n position: sticky;\n inset-block-start: 0;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n background-color: ${theme.base.palette['primary-background']};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-block: 0 ${theme.base.spacing};\n margin-block-end: ${theme.base.spacing};\n `\n);\n\nStyledDetailsHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRichTextViewer = styled(RichTextViewer)(\n ({ theme }) => `\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: ${theme.base.spacing};\n border-radius: ${theme.base.spacing};\n max-height: 100%;\n overflow-y: auto;\n`\n);\n\nStyledRichTextViewer.defaultProps = defaultThemeProp;\n\nexport const StyledAgentTracerContent = styled(Flex)(\n ({ theme }) => `\n padding: ${theme.base.spacing};\n overflow-y: scroll;\n\n /* minimum height to display code editor without cropping borders */\n min-height: 7rem;\n`\n);\n\nStyledAgentTracerContent.defaultProps = defaultThemeProp;\n\nexport const StyledAgentTracerMetricGroup = styled(Flex)(\n ({ theme }) => `\n padding-inline: ${theme.base.spacing}\n `\n);\n\nStyledAgentTracerMetricGroup.defaultProps = defaultThemeProp;\n\nexport const StyledAgentTracerMetricLabel = styled(StyledLabel)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-size: ${fontSize[theme.components.text.h3['font-size'] as FontSize]};\n font-family: ${theme.components.text.h3['font-family']};\n font-weight: ${theme.components.text.h3['font-weight']};\n `;\n});\n\nStyledAgentTracerMetricLabel.defaultProps = defaultThemeProp;\n\n// To keep all Duration and Token metrics aligned irrespective of the value, width is based on max string currently possible ex : '59s 977.777ms'\nexport const StyledAgentMetricItem = styled.div`\n min-width: 13ch;\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,+KAKpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.test-ids.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,cAAc,EAAE;IAC9D,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;CACD,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const agentTracerTestIds = createTestIds('agent-tracer', [\n 'header',\n 'refresh',\n 'events',\n 'details'\n] as const);\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import type { IconTileProps } from '@pega/cosmos-react-build';
|
|
3
|
+
import type { TestIdProp, TreeNode } from '@pega/cosmos-react-core';
|
|
4
|
+
export type TracerEventRole = 'system' | 'function' | 'assistant' | 'user' | 'tool' | 'prerequisites';
|
|
5
|
+
export type AgentTracerMetricType = 'duration' | 'tokens' | 'config' | 'other';
|
|
6
|
+
interface AgentTracerBaseMetric {
|
|
7
|
+
label: string;
|
|
8
|
+
hideInListView?: boolean;
|
|
9
|
+
type: AgentTracerMetricType;
|
|
10
|
+
value: number | string;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentTracerDurationMetric extends AgentTracerBaseMetric {
|
|
13
|
+
type: 'duration';
|
|
14
|
+
value: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentTracerTokenMetric extends AgentTracerBaseMetric {
|
|
17
|
+
type: 'tokens';
|
|
18
|
+
value: number;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentTracerTextMetric extends AgentTracerBaseMetric {
|
|
21
|
+
type: 'config' | 'other';
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AgentTraceMetricGroupProps {
|
|
25
|
+
label: string;
|
|
26
|
+
metrics: AgentTracerBaseMetric[];
|
|
27
|
+
}
|
|
28
|
+
export interface AgentTraceEventContent {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
export type AgentTracePrimaryMetricItems = [AgentTracerDurationMetric?, AgentTracerTokenMetric?];
|
|
34
|
+
export interface AgentTraceEventProps extends TestIdProp {
|
|
35
|
+
id: string;
|
|
36
|
+
primary: string;
|
|
37
|
+
secondary: string;
|
|
38
|
+
role: TracerEventRole;
|
|
39
|
+
icon: IconTileProps;
|
|
40
|
+
isSystem: boolean;
|
|
41
|
+
metrics?: AgentTracePrimaryMetricItems;
|
|
42
|
+
selected?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface AgentTraceEventDetailsProps extends AgentTraceEventProps {
|
|
45
|
+
metricGroups?: AgentTraceMetricGroupProps[];
|
|
46
|
+
contents?: AgentTraceEventContent[];
|
|
47
|
+
events?: AgentTraceEventDetailsProps[];
|
|
48
|
+
}
|
|
49
|
+
export interface AgentTracerProps extends TestIdProp {
|
|
50
|
+
primary: string;
|
|
51
|
+
secondary?: string;
|
|
52
|
+
metrics?: AgentTracePrimaryMetricItems;
|
|
53
|
+
events?: AgentTraceEventDetailsProps[];
|
|
54
|
+
onRefresh?: () => void;
|
|
55
|
+
error?: string;
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface AgentTracerTreeContextProps {
|
|
59
|
+
currentNodeId?: string;
|
|
60
|
+
onSelect: (tracerEvent: AgentTraceEventDetailsProps, inputEvent?: KeyboardEvent) => void;
|
|
61
|
+
onToggle: (inputEvent: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>, nodeId: string) => void;
|
|
62
|
+
focusedNodeId?: string;
|
|
63
|
+
nodes: TreeNode[];
|
|
64
|
+
firstNodeId?: string;
|
|
65
|
+
changeFocusedNodeId: (nodeId: string, type: string) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface AgentTracerTreeProps extends TestIdProp {
|
|
68
|
+
events: AgentTraceEventDetailsProps[];
|
|
69
|
+
onSelect: (traceEvent: AgentTraceEventDetailsProps, keyBoardEvent?: KeyboardEvent) => void;
|
|
70
|
+
selectedNodeId?: string;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=AgentTracer.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.types.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;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MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracer.types.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react';\n\nimport type { IconTileProps } from '@pega/cosmos-react-build';\nimport type { TestIdProp, TreeNode } from '@pega/cosmos-react-core';\n\nexport type TracerEventRole =\n | 'system'\n | 'function'\n | 'assistant'\n | 'user'\n | 'tool'\n | 'prerequisites';\n\nexport type AgentTracerMetricType = 'duration' | 'tokens' | 'config' | 'other';\n\ninterface AgentTracerBaseMetric {\n label: string;\n hideInListView?: boolean;\n type: AgentTracerMetricType;\n value: number | string;\n}\n\nexport interface AgentTracerDurationMetric extends AgentTracerBaseMetric {\n type: 'duration';\n value: number;\n}\n\nexport interface AgentTracerTokenMetric extends AgentTracerBaseMetric {\n type: 'tokens';\n value: number;\n}\n\nexport interface AgentTracerTextMetric extends AgentTracerBaseMetric {\n type: 'config' | 'other';\n value: string;\n}\n\nexport interface AgentTraceMetricGroupProps {\n label: string;\n metrics: AgentTracerBaseMetric[];\n}\n\nexport interface AgentTraceEventContent {\n id: string;\n label: string;\n value: string;\n}\n\n// restrict order and length of metrics to maintain consistent layout throughout the tree\nexport type AgentTracePrimaryMetricItems = [AgentTracerDurationMetric?, AgentTracerTokenMetric?];\n\nexport interface AgentTraceEventProps extends TestIdProp {\n id: string;\n primary: string;\n secondary: string;\n role: TracerEventRole;\n icon: IconTileProps;\n isSystem: boolean;\n metrics?: AgentTracePrimaryMetricItems;\n selected?: boolean;\n}\n\nexport interface AgentTraceEventDetailsProps extends AgentTraceEventProps {\n metricGroups?: AgentTraceMetricGroupProps[];\n contents?: AgentTraceEventContent[];\n events?: AgentTraceEventDetailsProps[];\n}\n\nexport interface AgentTracerProps extends TestIdProp {\n primary: string;\n secondary?: string;\n metrics?: AgentTracePrimaryMetricItems;\n events?: AgentTraceEventDetailsProps[];\n onRefresh?: () => void;\n error?: string;\n loading?: boolean;\n}\n\nexport interface AgentTracerTreeContextProps {\n currentNodeId?: string;\n onSelect: (tracerEvent: AgentTraceEventDetailsProps, inputEvent?: KeyboardEvent) => void;\n onToggle: (\n inputEvent: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>,\n nodeId: string\n ) => void;\n focusedNodeId?: string;\n nodes: TreeNode[];\n firstNodeId?: string;\n changeFocusedNodeId: (nodeId: string, type: string) => void;\n}\n\nexport interface AgentTracerTreeProps extends TestIdProp {\n events: AgentTraceEventDetailsProps[];\n onSelect: (traceEvent: AgentTraceEventDetailsProps, keyBoardEvent?: KeyboardEvent) => void;\n selectedNodeId?: string;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentTracerTreeProps } from './AgentTracer.types';
|
|
2
|
+
declare const AgentTracerTree: ({ events: tracerEvents, onSelect, selectedNodeId, testId }: AgentTracerTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default AgentTracerTree;
|
|
4
|
+
//# sourceMappingURL=AgentTracerTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracerTree.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracerTree.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAIV,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAE7B,QAAA,MAAM,eAAe,+DAKlB,oBAAoB,4CAyGtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { StandardTree, treeHelpers } from '@pega/cosmos-react-core';
|
|
4
|
+
import AgentTraceEvent from './AgentTraceEvent';
|
|
5
|
+
import { StyledAgentTreeItem } from './AgentTracer.styles';
|
|
6
|
+
const AgentTracerTree = ({ events: tracerEvents, onSelect, selectedNodeId, testId }) => {
|
|
7
|
+
const [nodes, setNodes] = useState([]);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const treeNodes = tracerEvents.map(tracerEvent => ({
|
|
10
|
+
id: tracerEvent.id,
|
|
11
|
+
label: tracerEvent.primary,
|
|
12
|
+
testId: `${testId}:${tracerEvent.id}`,
|
|
13
|
+
expanded: !!treeHelpers.getNode(nodes, tracerEvent.id)?.expanded ||
|
|
14
|
+
!!tracerEvent.events?.find(event => event.id === selectedNodeId),
|
|
15
|
+
event: tracerEvent,
|
|
16
|
+
nodes: !tracerEvent.events?.length
|
|
17
|
+
? undefined
|
|
18
|
+
: tracerEvent.events.map(childEvent => ({
|
|
19
|
+
id: childEvent.id,
|
|
20
|
+
label: childEvent.primary,
|
|
21
|
+
testId: `${testId}:${childEvent.id}`,
|
|
22
|
+
expanded: false,
|
|
23
|
+
event: childEvent
|
|
24
|
+
}))
|
|
25
|
+
}));
|
|
26
|
+
setNodes(treeNodes);
|
|
27
|
+
}, [tracerEvents]);
|
|
28
|
+
const getEventByID = (events, id) => {
|
|
29
|
+
let found;
|
|
30
|
+
events.some(node => {
|
|
31
|
+
if (node.id === id) {
|
|
32
|
+
found = node;
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (node.events) {
|
|
36
|
+
found = getEventByID(node.events, id);
|
|
37
|
+
return !!found;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
});
|
|
41
|
+
return found;
|
|
42
|
+
};
|
|
43
|
+
const tracerTreeRenderer = ({ id }) => {
|
|
44
|
+
const currentEvent = getEventByID(tracerEvents, id);
|
|
45
|
+
const metricsToDisplay = [
|
|
46
|
+
undefined,
|
|
47
|
+
undefined
|
|
48
|
+
];
|
|
49
|
+
if (currentEvent?.metrics?.[0] && !currentEvent?.metrics?.[0].hideInListView) {
|
|
50
|
+
metricsToDisplay[0] = currentEvent?.metrics?.[0];
|
|
51
|
+
}
|
|
52
|
+
if (currentEvent?.metrics?.[1] && !currentEvent?.metrics?.[1].hideInListView) {
|
|
53
|
+
metricsToDisplay[1] = currentEvent?.metrics?.[1];
|
|
54
|
+
}
|
|
55
|
+
return (currentEvent && (_jsx(StyledAgentTreeItem, { children: _jsx(AgentTraceEvent, { ...currentEvent, metrics: metricsToDisplay, testId: testId }) })));
|
|
56
|
+
};
|
|
57
|
+
const onNodeToggle = (id) => {
|
|
58
|
+
const clickedNode = treeHelpers.getNode(nodes, id);
|
|
59
|
+
// If a leaf node, just set to current
|
|
60
|
+
if (!clickedNode?.nodes)
|
|
61
|
+
return;
|
|
62
|
+
setNodes(tree => treeHelpers.mapNode(tree, id, node => {
|
|
63
|
+
return {
|
|
64
|
+
...node,
|
|
65
|
+
expanded: !node.expanded,
|
|
66
|
+
loading: node.nodes?.length === 0
|
|
67
|
+
};
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
const onNodeClick = (id) => {
|
|
71
|
+
const selectedItem = treeHelpers.getNode(nodes, id);
|
|
72
|
+
if (selectedItem?.id) {
|
|
73
|
+
const selectedEvent = getEventByID(tracerEvents, selectedItem?.id);
|
|
74
|
+
if (selectedEvent) {
|
|
75
|
+
onSelect(selectedEvent);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_jsx(StandardTree, { nodes: nodes, contentRenderer: tracerTreeRenderer, onNodeToggle: onNodeToggle, onNodeClick: onNodeClick, currentNodeId: selectedNodeId }));
|
|
80
|
+
};
|
|
81
|
+
export default AgentTracerTree;
|
|
82
|
+
//# sourceMappingURL=AgentTracerTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTracerTree.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/AgentTracerTree.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAyB,MAAM,yBAAyB,CAA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elpers, type StandardTreeNode } from '@pega/cosmos-react-core';\n\nimport AgentTraceEvent from './AgentTraceEvent';\nimport { StyledAgentTreeItem } from './AgentTracer.styles';\nimport type {\n AgentTraceEventDetailsProps,\n AgentTracerDurationMetric,\n AgentTracerTokenMetric,\n AgentTracerTreeProps\n} from './AgentTracer.types';\n\nconst AgentTracerTree = ({\n events: tracerEvents,\n onSelect,\n selectedNodeId,\n testId\n}: AgentTracerTreeProps) => {\n const [nodes, setNodes] = useState<StandardTreeNode[]>([]);\n\n useEffect(() => {\n const treeNodes: StandardTreeNode[] = tracerEvents.map(tracerEvent => ({\n id: tracerEvent.id,\n label: tracerEvent.primary,\n testId: `${testId}:${tracerEvent.id}`,\n expanded:\n !!treeHelpers.getNode(nodes, tracerEvent.id)?.expanded ||\n !!tracerEvent.events?.find(event => event.id === selectedNodeId),\n event: tracerEvent,\n nodes: !tracerEvent.events?.length\n ? undefined\n : tracerEvent.events.map(childEvent => ({\n id: childEvent.id,\n label: childEvent.primary,\n testId: `${testId}:${childEvent.id}`,\n expanded: false,\n event: childEvent\n }))\n }));\n setNodes(treeNodes);\n }, [tracerEvents]);\n\n const getEventByID = (\n events: AgentTraceEventDetailsProps[],\n id: AgentTraceEventDetailsProps['id']\n ): AgentTraceEventDetailsProps | undefined => {\n let found;\n events.some(node => {\n if (node.id === id) {\n found = node;\n return true;\n }\n\n if (node.events) {\n found = getEventByID(node.events, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n };\n\n const tracerTreeRenderer = ({ id }: StandardTreeNode) => {\n const currentEvent = getEventByID(tracerEvents, id);\n\n const metricsToDisplay: [AgentTracerDurationMetric?, AgentTracerTokenMetric?] = [\n undefined,\n undefined\n ];\n if (currentEvent?.metrics?.[0] && !currentEvent?.metrics?.[0].hideInListView) {\n metricsToDisplay[0] = currentEvent?.metrics?.[0];\n }\n if (currentEvent?.metrics?.[1] && !currentEvent?.metrics?.[1].hideInListView) {\n metricsToDisplay[1] = currentEvent?.metrics?.[1];\n }\n\n return (\n currentEvent && (\n <StyledAgentTreeItem>\n <AgentTraceEvent {...currentEvent} metrics={metricsToDisplay} testId={testId} />\n </StyledAgentTreeItem>\n )\n );\n };\n\n const onNodeToggle = (id: StandardTreeNode['id']) => {\n const clickedNode = treeHelpers.getNode(nodes, id);\n // If a leaf node, just set to current\n if (!clickedNode?.nodes) return;\n\n setNodes(tree =>\n treeHelpers.mapNode(tree, id, node => {\n return {\n ...node,\n expanded: !node.expanded,\n loading: node.nodes?.length === 0\n };\n })\n );\n };\n\n const onNodeClick = (id: StandardTreeNode['id']) => {\n const selectedItem = treeHelpers.getNode(nodes, id);\n if (selectedItem?.id) {\n const selectedEvent = getEventByID(tracerEvents, selectedItem?.id);\n if (selectedEvent) {\n onSelect(selectedEvent);\n }\n }\n };\n\n return (\n <StandardTree\n nodes={nodes}\n contentRenderer={tracerTreeRenderer}\n onNodeToggle={onNodeToggle}\n onNodeClick={onNodeClick}\n currentNodeId={selectedNodeId}\n />\n );\n};\n\nexport default AgentTracerTree;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AgentTracer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AgentTracer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,cAAc,qBAAqB,CAAC","sourcesContent":["export { default } from './AgentTracer';\nexport * from './AgentTracer.types';\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { ClipboardProps } from './Clipboard.types';
|
|
4
|
-
declare const Clipboard:
|
|
3
|
+
declare const Clipboard: ForwardRefForwardPropsComponent<ClipboardProps>;
|
|
5
4
|
export default Clipboard;
|
|
6
5
|
//# sourceMappingURL=Clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../../src/components/Clipboard/Clipboard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../../src/components/Clipboard/Clipboard.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAe,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE5F,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,mBAAmB,CAAC;AA2DlF,QAAA,MAAM,SAAS,EAAE,+BAA+B,CAAC,cAAc,CAgC7D,CAAC;AACH,eAAe,SAAS,CAAC"}
|
|
@@ -24,7 +24,11 @@ const FieldSummary = ({ primary, secondary, fields, actions }) => {
|
|
|
24
24
|
const Clipboard = forwardRef(function Clipboard({ navigation, content, lastUpdated }, ref) {
|
|
25
25
|
const t = useI18n();
|
|
26
26
|
const navContent = useMemo(() => _jsx(StandardTree, { ...navigation }), [navigation]);
|
|
27
|
-
return (_jsxs(Flex, { as: StyledContainer, container: { direction: 'column' }, ref: ref, children: [_jsxs(Flex, { as: StyledMain, container: true, children: [_jsx(StyledTreeContainer, { children: navContent }), _jsxs(Flex, { container: { direction: 'column', pad: 1, gap: 1 }, as: StyledContent, ref: ref, children: [!content && _jsx(EmptyState, {}), content && content.loading && _jsx(Progress, { placement: 'local', message: t('loading') }), content && !content.loading && _jsx(FieldSummary, { ...content })] })] }), _jsx(Flex, { as: StyledClipboardFooter, container: { alignItems: 'center' }, children: lastUpdated && _jsx(Text, { variant: 'secondary', children:
|
|
27
|
+
return (_jsxs(Flex, { as: StyledContainer, container: { direction: 'column' }, ref: ref, children: [_jsxs(Flex, { as: StyledMain, container: true, children: [_jsx(StyledTreeContainer, { children: navContent }), _jsxs(Flex, { container: { direction: 'column', pad: 1, gap: 1 }, as: StyledContent, ref: ref, children: [!content && _jsx(EmptyState, {}), content && content.loading && _jsx(Progress, { placement: 'local', message: t('loading') }), content && !content.loading && _jsx(FieldSummary, { ...content })] })] }), _jsx(Flex, { as: StyledClipboardFooter, container: { alignItems: 'center' }, children: lastUpdated && (_jsx(Text, { variant: 'secondary', children:
|
|
28
|
+
// FIXME-REACT-18 This should probably be using date formatter
|
|
29
|
+
typeof lastUpdated !== 'string' && typeof lastUpdated !== 'number'
|
|
30
|
+
? lastUpdated.toLocaleString()
|
|
31
|
+
: lastUpdated })) })] }));
|
|
28
32
|
});
|
|
29
33
|
export default Clipboard;
|
|
30
34
|
//# sourceMappingURL=Clipboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.js","sourceRoot":"","sources":["../../../src/components/Clipboard/Clipboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,EACL,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,KAAK,EACL,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,EACX,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,aAAa,GAAc,CAAC,IAAW,EAAE,EAAE;IAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACpB,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,YAC1E,IAAI,CAAC,IAAI,G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,OAAO,IAAI,KAAC,UAAU,KAAG,EAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,EACnF,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,KAAC,YAAY,OAAK,OAAO,GAAI,IACxD,IACF,EAEP,KAAC,IAAI,IAAC,EAAE,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YACjE,WAAW,IAAI,CACd,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW;oBAErB,8DAA8D;oBAC9D,OAAO,WAAW,KAAK,QAAQ,IAAI,OAAO,WAAW,KAAK,QAAQ;wBAChE,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE;wBAC9B,CAAC,CAAC,WAAW,GAEZ,CACR,GACI,IACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, useMemo, useEffect, useRef } from 'react';\nimport type { PropsWithoutRef, FC } from 'react';\n\nimport {\n Button,\n Flex,\n MetaList,\n Progress,\n StandardTree,\n SummaryItem,\n Text,\n Table,\n useI18n,\n EmptyState\n} from '@pega/cosmos-react-core';\nimport type { ColumnProps, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport type { ClipboardProps, FieldSummaryProps, Field } from './Clipboard.types';\nimport {\n StyledClipboardFooter,\n StyledContainer,\n StyledContent,\n StyledMain,\n StyledTitle,\n StyledTreeContainer\n} from './Clipboard.styles';\n\nconst FieldRenderer: FC<Field> = (cell: Field) => {\n return cell.onClick ? (\n <Button variant='link' onClick={(e: MouseEvent) => cell.onClick?.(cell.id, e)}>\n {cell.name}\n </Button>\n ) : (\n <>{cell.name}</>\n );\n};\n\nconst FieldSummary: FC<FieldSummaryProps> = ({\n primary,\n secondary,\n fields,\n actions\n}: FieldSummaryProps) => {\n const headingRef = useRef<HTMLSpanElement>(null);\n const t = useI18n();\n\n const metaListItems = secondary?.map(({ name, value }) => `${name}: ${value}`);\n\n const columns: ColumnProps<Field>[] = [\n {\n renderer: FieldRenderer,\n label: t('condition_builder_field_label')\n },\n { renderer: 'value', label: t('condition_builder_value_label') }\n ];\n\n useEffect(() => {\n headingRef.current?.focus();\n }, []);\n\n return (\n <>\n <SummaryItem\n primary={\n <StyledTitle tabIndex={-1} variant='h3' ref={headingRef}>\n {primary}\n </StyledTitle>\n }\n secondary={metaListItems && <MetaList items={metaListItems} />}\n actions={actions}\n />\n <Table title={primary} columns={columns} data={fields} />\n </>\n );\n};\n\nconst Clipboard: ForwardRefForwardPropsComponent<ClipboardProps> = forwardRef(function Clipboard(\n { navigation, content, lastUpdated }: PropsWithoutRef<ClipboardProps>,\n ref: ClipboardProps['ref']\n) {\n const t = useI18n();\n const navContent = useMemo(() => <StandardTree {...navigation} />, [navigation]);\n\n return (\n <Flex as={StyledContainer} container={{ direction: 'column' }} ref={ref}>\n <Flex as={StyledMain} container>\n <StyledTreeContainer>{navContent}</StyledTreeContainer>\n <Flex container={{ direction: 'column', pad: 1, gap: 1 }} as={StyledContent} ref={ref}>\n {!content && <EmptyState />}\n {content && content.loading && <Progress placement='local' message={t('loading')} />}\n {content && !content.loading && <FieldSummary {...content} />}\n </Flex>\n </Flex>\n\n <Flex as={StyledClipboardFooter} container={{ alignItems: 'center' }}>\n {lastUpdated && (\n <Text variant='secondary'>\n {\n // FIXME-REACT-18 This should probably be using date formatter\n typeof lastUpdated !== 'string' && typeof lastUpdated !== 'number'\n ? lastUpdated.toLocaleString()\n : lastUpdated\n }\n </Text>\n )}\n </Flex>\n </Flex>\n );\n});\nexport default Clipboard;\n"]}
|
|
@@ -2,6 +2,6 @@ export declare const StyledContainer: import("styled-components").StyledComponen
|
|
|
2
2
|
export declare const StyledTreeContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
3
|
export declare const StyledMain: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
4
|
export declare const StyledClipboardFooter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledTitle: import("styled-components").StyledComponent<import("
|
|
5
|
+
export declare const StyledTitle: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").TextProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
6
6
|
export declare const StyledContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
7
|
//# sourceMappingURL=Clipboard.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clipboard.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Clipboard/Clipboard.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,yGAE3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,yGAc/B,CAAC;AAIF,eAAO,MAAM,UAAU,yGAgBtB,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAgBjC,CAAC;AAIF,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Clipboard.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Clipboard/Clipboard.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,yGAE3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,yGAc/B,CAAC;AAIF,eAAO,MAAM,UAAU,yGAgBtB,CAAC;AAIF,eAAO,MAAM,qBAAqB,yGAgBjC,CAAC;AAIF,eAAO,MAAM,WAAW,kNAIvB,CAAC;AAEF,eAAO,MAAM,aAAa,yGAgBxB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { HeaderProps } from './PreviewShell.types';
|
|
4
|
-
declare const Header:
|
|
3
|
+
declare const Header: ForwardRefForwardPropsComponent<HeaderProps>;
|
|
5
4
|
export default Header;
|
|
6
5
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/Header.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAI/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,QAAA,MAAM,MAAM,EAAE,+BAA+B,CAAC,WAAW,CA+CvD,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -9,7 +9,7 @@ const Header = forwardRef(function Header({ appName, onClick, href, status, oper
|
|
|
9
9
|
mode: 'single-select',
|
|
10
10
|
items: channels,
|
|
11
11
|
onItemClick: onChannelClick
|
|
12
|
-
} }))] }), _jsx(Operator, { as: StyledOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, children: _jsx(Avatar, { ...operator.avatar }) })] }));
|
|
12
|
+
} }))] }), _jsx(Operator, { as: StyledOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, name: operator.name, children: _jsx(Avatar, { ...operator.avatar }) })] }));
|
|
13
13
|
});
|
|
14
14
|
export default Header;
|
|
15
15
|
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../src/components/PreviewShell/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;A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I,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,YAAG,MAAM,CAAC,QAAQ,GAAU,EACrE,QAAQ,IAAI,CACX,KAAC,UAAU,IACT,IAAI,EAAE,eAAe,CAAC,OAAO,EAC7B,IAAI,EAAE,eAAe,CAAC,IAAI,EAC1B,QAAQ,QACR,IAAI,EAAE;4BACJ,IAAI,EAAE,eAAe;4BACrB,KAAK,EAAE,QAAQ;4BACf,WAAW,EAAE,cAAc;yBAC5B,GACD,CACH,IACI,EACP,KAAC,QAAQ,IACP,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,QAAQ,CAAC,OAAO,EACzB,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,EACtC,IAAI,EAAE,QAAQ,CAAC,IAAI,YAEnB,KAAC,MAAM,OAAK,QAAQ,CAAC,MAAM,GAAI,GACtB,IACN,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport { Flex, Status, Avatar, Text, MenuButton } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport Operator from '@pega/cosmos-react-core/lib/components/AppShell/Operator';\n\nimport { StyledHeader, StyledBareButton, StyledOperator, StyledTitle } from './PreviewShell.styles';\nimport type { HeaderProps } from './PreviewShell.types';\n\nconst Header: ForwardRefForwardPropsComponent<HeaderProps> = forwardRef(function Header(\n {\n appName,\n onClick,\n href,\n status,\n operator,\n channels,\n onChannelClick\n }: PropsWithoutRef<HeaderProps>,\n ref: HeaderProps['ref']\n) {\n const selectedChannel = channels.find(ch => ch.selected) ?? channels[0];\n return (\n <Flex as={StyledHeader} container={{ justify: 'between', alignItems: 'center' }} ref={ref}>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n <StyledTitle\n onClick={onClick}\n href={href}\n forwardedAs={onClick || href ? StyledBareButton : Text}\n >\n {appName}\n </StyledTitle>\n {status && <Status variant={status.variant}>{status.children}</Status>}\n {channels && (\n <MenuButton\n text={selectedChannel.primary}\n icon={selectedChannel.icon}\n showIcon\n menu={{\n mode: 'single-select',\n items: channels,\n onItemClick: onChannelClick\n }}\n />\n )}\n </Flex>\n <Operator\n as={StyledOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n name={operator.name}\n >\n <Avatar {...operator.avatar} />\n </Operator>\n </Flex>\n );\n});\n\nexport default Header;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { PreviewShellProps } from './PreviewShell.types';
|
|
4
|
-
declare const PreviewShell:
|
|
3
|
+
declare const PreviewShell: ForwardRefForwardPropsComponent<PreviewShellProps>;
|
|
5
4
|
export default PreviewShell;
|
|
6
5
|
//# sourceMappingURL=PreviewShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewShell.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/PreviewShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreviewShell.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/PreviewShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAkB,MAAM,yBAAyB,CAAC;AAI/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9D,QAAA,MAAM,YAAY,EAAE,+BAA+B,CAAC,iBAAiB,CA+DpE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewShell.js","sourceRoot":"","sources":["../../../src/components/PreviewShell/PreviewShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE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,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,YAEnC,MAAM,IAAI,KAAC,MAAM,OAAK,MAAM,GAAI,GAClB,IACY,CAChC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, useEffect, useMemo, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport { useI18n, SkipLinks, ExpandCollapse } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, SkipLinksProps } from '@pega/cosmos-react-core';\n\nimport { StyledMain, StyledPreviewContainer, StyledFooter } from './PreviewShell.styles';\nimport Header from './Header';\nimport type { PreviewShellProps } from './PreviewShell.types';\nimport PreviewShellContext from './PreviewShellContext';\nimport Footer from './Footer';\n\nconst PreviewShell: ForwardRefForwardPropsComponent<PreviewShellProps> = forwardRef(\n function PreviewShell(\n { header, children, footer }: PropsWithoutRef<PreviewShellProps>,\n ref: PreviewShellProps['ref']\n ) {\n const [expanded, setExpanded] = useState(!!footer?.expanded);\n const t = useI18n();\n\n useEffect(() => {\n setExpanded(!!footer?.expanded);\n }, [footer?.expanded]);\n\n const skipLinks: SkipLinksProps['items'] = useMemo(() => {\n const skipLinksItems = [\n {\n label: t('go_to_main_content'),\n target: {\n ariaLabel: t('main_content'),\n selector: 'main'\n }\n }\n ];\n\n if (footer) {\n skipLinksItems.push({\n label: t('go_to_noun', [t('dev_tools')]),\n target: {\n ariaLabel: t('dev_tools'),\n selector: 'footer'\n }\n });\n }\n return skipLinksItems;\n }, [t, header?.channels]);\n\n return (\n <PreviewShellContext.Provider\n value={useMemo(\n () => ({\n footerExpanded: expanded,\n toggleFooter: setExpanded\n }),\n [expanded]\n )}\n >\n <SkipLinks items={skipLinks} />\n {header && <Header {...header} />}\n <StyledMain ref={ref} footer={!!footer} header={!!header}>\n <StyledPreviewContainer tabIndex={0} aria-label={t('preview_frame')}>\n {children}\n </StyledPreviewContainer>\n </StyledMain>\n <ExpandCollapse\n as={StyledFooter}\n min={footer ? '2.5rem' : '0rem'}\n max='50vh'\n collapsed={footer ? !expanded : true}\n >\n {footer && <Footer {...footer} />}\n </ExpandCollapse>\n </PreviewShellContext.Provider>\n );\n }\n);\n\nexport default PreviewShell;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Text } from '@pega/cosmos-react-core';
|
|
2
2
|
export declare const StyledHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
3
3
|
export declare const StyledTitle: typeof Text;
|
|
4
|
-
export declare const StyledBareButton: import("styled-components").StyledComponent<import("react").
|
|
4
|
+
export declare const StyledBareButton: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core/lib/components/Button/BareButton").BareButtonProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
5
5
|
export declare const StyledOperator: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
6
6
|
export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {
|
|
7
7
|
header: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/PreviewShell.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAQjE,eAAO,MAAM,YAAY,4GAOvB,CAAC;AAIH,eAAO,MAAM,WAAW,EAAE,OAAO,IAS/B,CAAC;AAIH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PreviewShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewShell/PreviewShell.styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAQjE,eAAO,MAAM,YAAY,4GAOvB,CAAC;AAIH,eAAO,MAAM,WAAW,EAAE,OAAO,IAS/B,CAAC;AAIH,eAAO,MAAM,gBAAgB,yPAM3B,CAAC;AAIH,eAAO,MAAM,cAAc,4GAQ1B,CAAC;AAIF,eAAO,MAAM,UAAU;YAAyB,OAAO;YAAU,OAAO;SAkBvE,CAAC;AAIF,eAAO,MAAM,sBAAsB,yGAejC,CAAC;AAIH,eAAO,MAAM,YAAY,4GAIvB,CAAC;AAIH,eAAO,MAAM,mBAAmB,yGAG/B,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default as AgentTracer } from './components/AgentTracer';
|
|
2
|
+
export * from './components/AgentTracer';
|
|
1
3
|
export { default as Clipboard } from './components/Clipboard';
|
|
2
4
|
export * from './components/Clipboard';
|
|
3
5
|
export { default as DevTools } from './components/DevTools';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// This file is autogenerated. Any changes will be overwritten.
|
|
2
|
+
export { default as AgentTracer } from './components/AgentTracer';
|
|
3
|
+
export * from './components/AgentTracer';
|
|
2
4
|
export { default as Clipboard } from './components/Clipboard';
|
|
3
5
|
export * from './components/Clipboard';
|
|
4
6
|
export { default as DevTools } from './components/DevTools';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as Clipboard } from './components/Clipboard';\nexport * from './components/Clipboard';\nexport { default as DevTools } from './components/DevTools';\nexport * from './components/DevTools';\nexport { default as PreviewShell } from './components/PreviewShell';\nexport * from './components/PreviewShell';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AgentTracer } from './components/AgentTracer';\nexport * from './components/AgentTracer';\nexport { default as Clipboard } from './components/Clipboard';\nexport * from './components/Clipboard';\nexport { default as DevTools } from './components/DevTools';\nexport * from './components/DevTools';\nexport { default as PreviewShell } from './components/PreviewShell';\nexport * from './components/PreviewShell';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-tools",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/pegasystems/cosmos-react.git",
|
|
@@ -19,16 +19,20 @@
|
|
|
19
19
|
"build": "tsc -b tsconfig.build.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pega/cosmos-react-core": "8.0.0
|
|
23
|
-
"@types/react": "^17.0.62",
|
|
24
|
-
"@types/react-dom": "^17.0.20",
|
|
22
|
+
"@pega/cosmos-react-core": "8.0.0",
|
|
23
|
+
"@types/react": "^17.0.62 || ^18.3.3",
|
|
24
|
+
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
25
25
|
"@types/styled-components": "^5.1.26",
|
|
26
26
|
"polished": "^4.1.0",
|
|
27
|
-
"react": "^17.0.0",
|
|
28
|
-
"react-dom": "^17.0.0",
|
|
27
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
28
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
29
29
|
"styled-components": "^5.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@storybook/addon-actions": "~8.2.9",
|
|
33
|
+
"@storybook/react": "~8.2.9",
|
|
34
|
+
"@testing-library/react": "^16.0.0",
|
|
35
|
+
"@testing-library/user-event": "^14.6.1",
|
|
32
36
|
"typescript": "~5.5.4"
|
|
33
37
|
}
|
|
34
38
|
}
|