botframework-webchat-fluent-theme 4.18.1-main.20240807.dfe788c → 4.18.1-main.20240808.851825d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botframework-webchat-fluent-theme",
3
- "version": "4.18.1-main.20240807.dfe788c",
3
+ "version": "4.18.1-main.20240808.851825d",
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.20240807.dfe788c",
73
- "botframework-webchat-component": "4.18.1-main.20240807.dfe788c",
74
- "botframework-webchat-core": "4.18.1-main.20240807.dfe788c",
72
+ "botframework-webchat-api": "4.18.1-main.20240808.851825d",
73
+ "botframework-webchat-component": "4.18.1-main.20240808.851825d",
74
+ "botframework-webchat-core": "4.18.1-main.20240808.851825d",
75
75
  "classnames": "2.5.1",
76
76
  "inject-meta-tag": "0.0.1",
77
77
  "math-random": "2.0.1",
@@ -4,6 +4,7 @@ import cx from 'classnames';
4
4
  import React, { memo, useCallback, useMemo } from 'react';
5
5
  import { useRefFrom } from 'use-ref-from';
6
6
  import { useStyles } from '../../styles/index.js';
7
+ import testIds from '../../testIds.js';
7
8
  import MonochromeImageMasker from './private/MonochromeImageMasker.js';
8
9
  import styles from './StarterPromptsCardAction.module.css';
9
10
 
@@ -35,6 +36,7 @@ const StarterPromptAction = ({ className, messageBackAction }: Props) => {
35
36
  return (
36
37
  <button
37
38
  className={cx(className, classNames['pre-chat-message-activity__card-action-box'])}
39
+ data-testid={testIds.preChatMessageActivityStarterPromptsCardAction}
38
40
  onClick={handleClick}
39
41
  type="button"
40
42
  >
@@ -3,6 +3,7 @@ import cx from 'classnames';
3
3
  import React, { memo, useCallback, useRef, useState, type FormEventHandler, type MouseEventHandler } from 'react';
4
4
  import { useRefFrom } from 'use-ref-from';
5
5
  import { SendIcon } from '../../icons';
6
+ import { useStyles } from '../../styles';
6
7
  import testIds from '../../testIds';
7
8
  import { DropZone } from '../dropZone';
8
9
  import { SuggestedActions } from '../suggestedActions';
@@ -10,14 +11,13 @@ import { TelephoneKeypadSurrogate, useTelephoneKeypadShown, type DTMF } from '..
10
11
  import AddAttachmentButton from './AddAttachmentButton';
11
12
  import Attachments from './Attachments';
12
13
  import ErrorMessage from './ErrorMessage';
13
- import TelephoneKeypadToolbarButton from './TelephoneKeypadToolbarButton';
14
- import TextArea from './TextArea';
15
- import { Toolbar, ToolbarButton, ToolbarSeparator } from './Toolbar';
16
14
  import useSubmitError from './private/useSubmitError';
15
+ import useTranscriptNavigation from './private/useTranscriptNavigation';
17
16
  import useUniqueId from './private/useUniqueId';
18
17
  import styles from './SendBox.module.css';
19
- import { useStyles } from '../../styles';
20
- import useTranscriptNavigation from './private/useTranscriptNavigation';
18
+ import TelephoneKeypadToolbarButton from './TelephoneKeypadToolbarButton';
19
+ import TextArea from './TextArea';
20
+ import { Toolbar, ToolbarButton, ToolbarSeparator } from './Toolbar';
21
21
 
22
22
  const {
23
23
  useFocus,
@@ -25,18 +25,23 @@ const {
25
25
  useMakeThumbnail,
26
26
  useRegisterFocusSendBox,
27
27
  useSendBoxAttachments,
28
+ useSendBoxValue,
28
29
  useSendMessage,
29
30
  useStyleOptions
30
31
  } = hooks;
31
32
 
32
- function SendBox(
33
- props: Readonly<{
34
- className?: string | undefined;
35
- placeholder?: string | undefined;
36
- }>
37
- ) {
33
+ type Props = Readonly<{
34
+ className?: string | undefined;
35
+ isPrimary?: boolean | undefined;
36
+ placeholder?: string | undefined;
37
+ }>;
38
+
39
+ function SendBox(props: Props) {
38
40
  const inputRef = useRef<HTMLTextAreaElement>(null);
39
- const [message, setMessage] = useState('');
41
+ const [localMessage, setLocalMessage] = useState('');
42
+ const [globalMessage, setGlobalMessage] = useSendBoxValue();
43
+ const message = props.isPrimary ? globalMessage : localMessage;
44
+ const setMessage = props.isPrimary ? setGlobalMessage : setLocalMessage;
40
45
  const [attachments, setAttachments] = useSendBoxAttachments();
41
46
  const [{ hideTelephoneKeypadButton, hideUploadButton, maxMessageLength }] = useStyleOptions();
42
47
  const isMessageLengthExceeded = !!maxMessageLength && message.length > maxMessageLength;
@@ -213,4 +218,10 @@ function SendBox(
213
218
  );
214
219
  }
215
220
 
221
+ const PrimarySendBox = memo((props: Exclude<Props, 'primary'>) => <SendBox {...props} isPrimary={true} />);
222
+
223
+ PrimarySendBox.displayName = 'PrimarySendBox';
224
+
216
225
  export default memo(SendBox);
226
+
227
+ export { PrimarySendBox };
@@ -1 +1 @@
1
- export { default as SendBox } from './SendBox';
1
+ export { PrimarySendBox, default as SendBox } from './SendBox';
@@ -3,7 +3,7 @@ import React, { memo, type ReactNode } from 'react';
3
3
 
4
4
  import type { ActivityMiddleware } from 'botframework-webchat-api';
5
5
  import { isPreChatMessageActivity, PreChatMessageActivity } from '../components/preChatActivity';
6
- import { SendBox } from '../components/sendBox';
6
+ import { PrimarySendBox } from '../components/sendBox';
7
7
  import { TelephoneKeypadProvider } from '../components/telephoneKeypad';
8
8
  import { WebChatTheme } from '../components/theme';
9
9
 
@@ -24,7 +24,7 @@ const activityMiddleware: ActivityMiddleware[] = [
24
24
  return next(...args);
25
25
  }
26
26
  ];
27
- const sendBoxMiddleware = [() => () => () => SendBox];
27
+ const sendBoxMiddleware = [() => () => () => PrimarySendBox];
28
28
 
29
29
  const FluentThemeProvider = ({ children }: Props) => (
30
30
  <WebChatTheme>
package/src/testIds.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  const testIds = {
2
+ preChatMessageActivityStarterPromptsCardAction: 'pre-chat message activity starter prompts card action',
2
3
  sendBoxDropZone: 'send box drop zone',
3
4
  sendBoxSendButton: 'send box send button',
4
5
  sendBoxTextBox: 'send box text area',