Skip to content

add focusSendBoxInput method #5512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,715 changes: 1,358 additions & 1,357 deletions CHANGELOG.md

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions packages/bundle/src/FullComposer.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { Components, type ComposerProps } from 'botframework-webchat-component';
import { Components, type ComposerProps, type ComposerRef } from 'botframework-webchat-component';
import PropTypes from 'prop-types';
import React from 'react';
import React, { forwardRef } from 'react';

import AddFullBundle, { type AddFullBundleProps } from './AddFullBundle';

const { Composer } = Components;

type FullComposerProps = ComposerProps & AddFullBundleProps;

const FullComposer = (props: FullComposerProps) => (
const FullComposer = forwardRef<ComposerRef, FullComposerProps>((props, ref) => (
<AddFullBundle {...props}>
{extraProps => (
<Composer {...props} {...extraProps}>
<Composer ref={ref} {...props} {...extraProps}>
{/* We need to spread, thus, we cannot we destructuring assignment. */}
{/* eslint-disable-next-line react/destructuring-assignment */}
{props.children}
</Composer>
)}
</AddFullBundle>
);
));

FullComposer.defaultProps = {
...Composer.defaultProps,
Expand Down
88 changes: 88 additions & 0 deletions packages/bundle/src/index-minimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* eslint dot-notation: ["error", { "allowPattern": "^WebChat$" }] */
// window['WebChat'] is required for TypeScript

import {
Constants,
createStore,
createStoreWithDevTools,
createStoreWithOptions,
version
} from 'botframework-webchat-core';
import { StrictStyleOptions, StyleOptions } from 'botframework-webchat-api';

import ReactWebChat, {
Components,
concatMiddleware,
connectToWebChat,
createStyleSet,
hooks,
withEmoji
} from 'botframework-webchat-component';

export type { ComposerRef } from 'botframework-webchat-component';

import addVersion from './addVersion';
import coreRenderWebChat from './renderWebChat';
import createBrowserWebSpeechPonyfillFactory from './createBrowserWebSpeechPonyfillFactory';
import defaultCreateDirectLine from './createDirectLine';
import defaultCreateDirectLineAppServiceExtension from './createDirectLineAppServiceExtension';

const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);

export const createDirectLine = options => {
options.botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);

return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${version} (Minimal)` });
};

export const createDirectLineAppServiceExtension = options => {
options.botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);

return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${version} (Minimal)` });
};

export default ReactWebChat;

export {
Components,
concatMiddleware,
connectToWebChat,
Constants,
createBrowserWebSpeechPonyfillFactory,
createStore,
createStoreWithDevTools,
createStoreWithOptions,
createStyleSet,
hooks,
renderWebChat,
version,
withEmoji
};

export type { StyleOptions, StrictStyleOptions };

// Until we have a development-specific bundle, we are not shipping createStoreWithDevTools in bundle.
window['WebChat'] = {
...window['WebChat'],
concatMiddleware,
connectToWebChat,
Constants,
createBrowserWebSpeechPonyfillFactory,
createDirectLine,
createDirectLineAppServiceExtension,
createStore,
createStoreWithOptions,
createStyleSet,
hooks,
ReactWebChat,
renderWebChat,
withEmoji
};

addVersion('minimal');
120 changes: 120 additions & 0 deletions packages/bundle/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/* eslint dot-notation: ["error", { "allowPattern": "^WebChat$" }] */
// window['WebChat'] is required for TypeScript

export * from './index-minimal';
export type { ComposerRef } from './index-minimal';

import { Components as MinimalComponents, hooks, version, withEmoji } from './index-minimal';
import AdaptiveCardContent from './adaptiveCards/Attachment/AdaptiveCardContent';
import addVersion from './addVersion';
import AnimationCardContent from './adaptiveCards/Attachment/AnimationCardContent';
import AudioCardContent from './adaptiveCards/Attachment/AudioCardContent';
import coreRenderWebChat from './renderWebChat';
import createAdaptiveCardsAttachmentMiddleware from './adaptiveCards/createAdaptiveCardsAttachmentMiddleware';
import createAdaptiveCardsAttachmentForScreenReaderMiddleware from './adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware';
import createCognitiveServicesSpeechServicesPonyfillFactory from './createCognitiveServicesSpeechServicesPonyfillFactory';
import createDirectLineSpeechAdapters from './createDirectLineSpeechAdapters';
import createStyleSet from './createFullStyleSet';
import defaultCreateDirectLine from './createDirectLine';
import defaultCreateDirectLineAppServiceExtension from './createDirectLineAppServiceExtension';
import FullBundleStyleOptions, { StrictFullBundleStyleOptions } from './types/FullBundleStyleOptions';
import FullComposer from './FullComposer';
import HeroCardContent from './adaptiveCards/Attachment/HeroCardContent';
import OAuthCardContent from './adaptiveCards/Attachment/OAuthCardContent';
import ReactWebChat from './FullReactWebChat';
import ReceiptCardContent from './adaptiveCards/Attachment/ReceiptCardContent';
import renderMarkdown from './markdown/renderMarkdown';
import SignInCardContent from './adaptiveCards/Attachment/SignInCardContent';
import ThumbnailCardContent from './adaptiveCards/Attachment/ThumbnailCardContent';
import useAdaptiveCardsHostConfig from './adaptiveCards/hooks/useAdaptiveCardsHostConfig';
import useAdaptiveCardsPackage from './adaptiveCards/hooks/useAdaptiveCardsPackage';
import useStyleOptions from './hooks/useStyleOptions';
import useStyleSet from './hooks/useStyleSet';
import VideoCardContent from './adaptiveCards/Attachment/VideoCardContent';

const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);

export const createDirectLine = (options: Omit<Parameters<typeof defaultCreateDirectLine>[0], 'botAgent'>) => {
(options as any).botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);

return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${version} (Full)` });
};

export const createDirectLineAppServiceExtension = (
options: Omit<Parameters<typeof defaultCreateDirectLineAppServiceExtension>[0], 'botAgent'>
) => {
(options as any).botAgent &&
console.warn(
'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'
);

return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${version} (Full)` });
};

const patchedHooks = {
...hooks,
useAdaptiveCardsHostConfig,
useAdaptiveCardsPackage,
useStyleOptions,
useStyleSet
};

const AdditionalComponents = {
AdaptiveCardContent,
AnimationCardContent,
AudioCardContent,
Composer: FullComposer,
HeroCardContent,
OAuthCardContent,
ReceiptCardContent,
SignInCardContent,
ThumbnailCardContent,
VideoCardContent
};

const Components: typeof MinimalComponents & typeof AdditionalComponents = {
...MinimalComponents,
...AdditionalComponents
};

type StyleOptions = FullBundleStyleOptions;
type StrictStyleOptions = StrictFullBundleStyleOptions;

export default ReactWebChat;

export {
Components,
createAdaptiveCardsAttachmentMiddleware,
createAdaptiveCardsAttachmentForScreenReaderMiddleware,
createCognitiveServicesSpeechServicesPonyfillFactory,
createDirectLineSpeechAdapters,
createStyleSet,
patchedHooks as hooks,
renderMarkdown,
renderWebChat,
withEmoji
};

export type { StyleOptions, StrictStyleOptions };

window['WebChat'] = {
...window['WebChat'],
Components,
createAdaptiveCardsAttachmentMiddleware,
createAdaptiveCardsAttachmentForScreenReaderMiddleware,
createCognitiveServicesSpeechServicesPonyfillFactory,
createDirectLine,
createDirectLineAppServiceExtension,
createDirectLineSpeechAdapters,
createStyleSet,
hooks: patchedHooks,
ReactWebChat,
renderMarkdown,
renderWebChat,
withEmoji
};

addVersion('full');
Loading
Loading