botframework-webchat-fluent-theme 4.18.1-main.20240830.4534802 → 4.18.1-main.20240831.f4058ce
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/dist/botframework-webchat-fluent-theme.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.development.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.development.js +6 -6
- package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.js +1 -1
- package/dist/botframework-webchat-fluent-theme.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.mjs +1 -1
- package/dist/botframework-webchat-fluent-theme.mjs.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.js +6 -6
- package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
- package/package.json +4 -4
- package/src/components/activity/ActivityDecorator.tsx +1 -1
- package/src/components/linerActivity/index.ts +2 -0
- package/src/components/linerActivity/private/LinerActivity.tsx +20 -0
- package/src/components/linerActivity/private/LinerMessageActivity.module.css +24 -0
- package/src/components/linerActivity/private/isLinerMessageActivity.ts +7 -0
- package/src/components/theme/Theme.module.css +6 -0
- package/src/private/FluentThemeProvider.tsx +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botframework-webchat-fluent-theme",
|
|
3
|
-
"version": "4.18.1-main.
|
|
3
|
+
"version": "4.18.1-main.20240831.f4058ce",
|
|
4
4
|
"description": "Fluent theme for Bot Framework Web Chat",
|
|
5
5
|
"main": "./dist/botframework-webchat-fluent-theme.js",
|
|
6
6
|
"types": "./dist/botframework-webchat-fluent-theme.d.ts",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"typescript": "^5.4.5"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"botframework-webchat-api": "4.18.1-main.
|
|
73
|
-
"botframework-webchat-component": "4.18.1-main.
|
|
74
|
-
"botframework-webchat-core": "4.18.1-main.
|
|
72
|
+
"botframework-webchat-api": "4.18.1-main.20240831.f4058ce",
|
|
73
|
+
"botframework-webchat-component": "4.18.1-main.20240831.f4058ce",
|
|
74
|
+
"botframework-webchat-core": "4.18.1-main.20240831.f4058ce",
|
|
75
75
|
"classnames": "2.5.1",
|
|
76
76
|
"inject-meta-tag": "0.0.1",
|
|
77
77
|
"math-random": "2.0.1",
|
|
@@ -11,7 +11,7 @@ function ActivityDecorator({ activity, children }: Readonly<{ activity: WebChatA
|
|
|
11
11
|
const variants = useVariants();
|
|
12
12
|
const variantClassName = useVariantClassName(styles);
|
|
13
13
|
|
|
14
|
-
const shouldRenderHeader = variants.includes('copilot') && activity?.from?.role
|
|
14
|
+
const shouldRenderHeader = variants.includes('copilot') && activity?.from?.role === 'bot' && !!children;
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div className={cx(classNames['activity-decorator'], variantClassName)}>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import { useStyles } from '../../../styles/index.js';
|
|
4
|
+
import styles from './LinerMessageActivity.module.css';
|
|
5
|
+
|
|
6
|
+
type Props = Readonly<{ activity: WebChatActivity & { type: 'message' } }>;
|
|
7
|
+
|
|
8
|
+
const LinerMessageActivity = ({ activity }: Props) => {
|
|
9
|
+
const classNames = useStyles(styles);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className={classNames['liner-message-activity']} role="separator">
|
|
13
|
+
{activity.text}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
LinerMessageActivity.displayName = 'LinerMessageActivity';
|
|
19
|
+
|
|
20
|
+
export default memo(LinerMessageActivity);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
:global(.webchat-fluent) .liner-message-activity {
|
|
3
|
+
align-items: center;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
color: var(--webchat-colorNeutralForeground3);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
font-family: var(--webchat__font--primary);
|
|
9
|
+
font-size: var(--webchat-fontSizeBase200);
|
|
10
|
+
font-weight: var(--webchat-fontWeightRegular);
|
|
11
|
+
gap: var(--webchat-spacingHorizontalM);
|
|
12
|
+
line-height: var(--webchat-lineHeightBase200);
|
|
13
|
+
padding: var(--webchat-spacingVerticalSNudge) var(--webchat-spacingHorizontalM);
|
|
14
|
+
text-align: center;
|
|
15
|
+
width: 100%;
|
|
16
|
+
|
|
17
|
+
&::before, &::after {
|
|
18
|
+
border-top: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke2);
|
|
19
|
+
content: "";
|
|
20
|
+
display: flex;
|
|
21
|
+
flex: auto;
|
|
22
|
+
min-width: 8px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type WebChatActivity } from 'botframework-webchat-core';
|
|
2
|
+
|
|
3
|
+
export default function isLinerMessageActivity(
|
|
4
|
+
activity: undefined | WebChatActivity
|
|
5
|
+
): activity is WebChatActivity & { type: 'message'; from: { role: 'channel' } } {
|
|
6
|
+
return !!(activity && activity.from.role === 'channel' && activity.type === 'message' && 'text' in activity);
|
|
7
|
+
}
|
|
@@ -272,6 +272,12 @@
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
/* Transcript filer in copilot variant */
|
|
276
|
+
:global(.webchat-fluent).theme.variant-copilot :global(.webchat__basic-transcript .webchat__basic-transcript__filler) {
|
|
277
|
+
/* No filler unless pre-chat activity, see next rule */
|
|
278
|
+
flex-grow: 0;
|
|
279
|
+
}
|
|
280
|
+
|
|
275
281
|
/* Transcript with a single pre-chat activity */
|
|
276
282
|
:global(.webchat-fluent).theme :global(.webchat__basic-transcript:has(.webchat__basic-transcript__activity:only-child):has(.pre-chat-message-activity) .webchat__basic-transcript__filler) {
|
|
277
283
|
/* limit grow to half of the size to center the activity */
|
|
@@ -9,6 +9,7 @@ import { TelephoneKeypadProvider } from '../components/telephoneKeypad';
|
|
|
9
9
|
import { WebChatTheme } from '../components/theme';
|
|
10
10
|
import VariantComposer, { VariantList } from './VariantComposer';
|
|
11
11
|
import { FluentThemeDecorator } from '../components/decorator';
|
|
12
|
+
import { isLinerMessageActivity, LinerMessageActivity } from '../components/linerActivity';
|
|
12
13
|
|
|
13
14
|
const { ThemeProvider } = Components;
|
|
14
15
|
|
|
@@ -20,9 +21,12 @@ const activityMiddleware: readonly ActivityMiddleware[] = Object.freeze([
|
|
|
20
21
|
(...args) => {
|
|
21
22
|
const activity = args[0]?.activity;
|
|
22
23
|
|
|
23
|
-
if (
|
|
24
|
+
if (isPreChatMessageActivity(activity)) {
|
|
24
25
|
return () => <PreChatMessageActivity activity={activity} />;
|
|
25
26
|
}
|
|
27
|
+
if (isLinerMessageActivity(activity)) {
|
|
28
|
+
return () => <LinerMessageActivity activity={activity} />;
|
|
29
|
+
}
|
|
26
30
|
|
|
27
31
|
const renderActivity = next(...args);
|
|
28
32
|
|