diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx index 7d20ef4144..9402f13f87 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx @@ -25,10 +25,11 @@ import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage'; import useDisabledModEffect from './AdaptiveCardHacks/useDisabledModEffect'; import usePersistValuesModEffect from './AdaptiveCardHacks/usePersistValuesModEffect'; import useRoleModEffect from './AdaptiveCardHacks/useRoleModEffect'; +import useStyleSet from '../../hooks/useStyleSet'; import useValueRef from './AdaptiveCardHacks/private/useValueRef'; const { ErrorBox } = Components; -const { useDisabled, useLocalizer, usePerformCardAction, useRenderMarkdownAsHTML, useScrollToEnd, useStyleSet } = hooks; +const { useDisabled, useLocalizer, usePerformCardAction, useRenderMarkdownAsHTML, useScrollToEnd } = hooks; const node_env = process.env.node_env || process.env.NODE_ENV; diff --git a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx index 041f43c6e5..943d9300ce 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx @@ -1,14 +1,14 @@ /* eslint react/no-array-index-key: "off" */ -import { Components, hooks } from 'botframework-webchat-component'; +import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; import React, { FC } from 'react'; import type { DirectLineAnimationCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; +import useStyleSet from '../../hooks/useStyleSet'; const { ImageContent, VideoContent } = Components; -const { useStyleSet } = hooks; type AnimationCardContentProps = { actionPerformedClassName?: string; diff --git a/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx index c33d2f0cd0..a280290e4b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx @@ -1,14 +1,14 @@ /* eslint react/no-array-index-key: "off" */ -import { Components, hooks } from 'botframework-webchat-component'; +import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; import React, { FC } from 'react'; import type { DirectLineAudioCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; +import useStyleSet from '../../hooks/useStyleSet'; const { AudioContent } = Components; -const { useStyleSet } = hooks; type AudioCardContentProps = { actionPerformedClassName?: string; diff --git a/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx index e0d80da625..637fd73981 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx @@ -1,11 +1,9 @@ -import { hooks } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; import React, { FC } from 'react'; import type { DirectLineSignInCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; - -const { useStyleSet } = hooks; +import useStyleSet from '../../hooks/useStyleSet'; type SignInCardContentProps = { actionPerformedClassName?: string; diff --git a/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx index b21c041c17..d2e24cfbe6 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx @@ -1,13 +1,13 @@ /* eslint react/no-array-index-key: "off" */ -import { Components, hooks } from 'botframework-webchat-component'; +import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; import React, { FC } from 'react'; import type { DirectLineVideoCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; +import useStyleSet from '../../hooks/useStyleSet'; -const { useStyleSet } = hooks; const { VideoContent } = Components; type VideoCardContentProps = { diff --git a/packages/bundle/src/hooks/useStyleSet.ts b/packages/bundle/src/hooks/useStyleSet.ts new file mode 100644 index 0000000000..2dfcf35dba --- /dev/null +++ b/packages/bundle/src/hooks/useStyleSet.ts @@ -0,0 +1,13 @@ +import { hooks } from 'botframework-webchat-component'; + +import type AdaptiveCardsStyleSet from '../adaptiveCards/AdaptiveCardsStyleSet'; + +const useMinimalStyleSet = hooks.useStyleSet; + +type MinimalStyleSet = ReturnType[0]; + +export default function useStyleSet(): [MinimalStyleSet & AdaptiveCardsStyleSet] { + const [styleOptions] = useMinimalStyleSet(); + + return [styleOptions as MinimalStyleSet & AdaptiveCardsStyleSet]; +} diff --git a/packages/bundle/src/index.ts b/packages/bundle/src/index.ts index 43cd13288a..8f8c55c8a5 100644 --- a/packages/bundle/src/index.ts +++ b/packages/bundle/src/index.ts @@ -28,6 +28,7 @@ import ThumbnailCardContent from './adaptiveCards/Attachment/ThumbnailCardConten 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); @@ -56,7 +57,8 @@ const patchedHooks = { ...hooks, useAdaptiveCardsHostConfig, useAdaptiveCardsPackage, - useStyleOptions + useStyleOptions, + useStyleSet }; const AdditionalComponents = { diff --git a/packages/component/src/ActivityStatus/private/Originator.tsx b/packages/component/src/ActivityStatus/private/Originator.tsx index 3797e298d7..c73dcc2ede 100644 --- a/packages/component/src/ActivityStatus/private/Originator.tsx +++ b/packages/component/src/ActivityStatus/private/Originator.tsx @@ -1,13 +1,10 @@ -import classNames from 'classnames'; import React, { memo } from 'react'; import { type ReplyAction } from '../../types/external/OrgSchema/ReplyAction'; -import useStyleSet from '../../hooks/useStyleSet'; type Props = { replyAction: ReplyAction }; const Originator = memo(({ replyAction }: Props) => { - const [{ originatorActivityStatus }] = useStyleSet(); const { description, provider } = replyAction; const text = description || provider?.name; @@ -23,7 +20,7 @@ const Originator = memo(({ replyAction }: Props) => { {text} ) : ( - {text} + {text} ); }); diff --git a/packages/component/src/hooks/useStyleSet.ts b/packages/component/src/hooks/useStyleSet.ts index 980598630e..8d80de0d74 100644 --- a/packages/component/src/hooks/useStyleSet.ts +++ b/packages/component/src/hooks/useStyleSet.ts @@ -1,5 +1,6 @@ +import type createStyleSet from '../Styles/createStyleSet'; import useWebChatUIContext from './internal/useWebChatUIContext'; -export default function useStyleSet(): [any] { +export default function useStyleSet(): [Record, any>] { return [useWebChatUIContext().styleSet]; }