diff --git a/.eslintrc.yml b/.eslintrc.yml index ec5c79a656..4d3983162a 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -68,6 +68,10 @@ overrides: no-empty-function: off '@typescript-eslint/no-empty-function': error + + '@typescript-eslint/consistent-type-imports': + - error + - fixStyle: inline-type-imports # TODO #4003: We will rework on these rules '@typescript-eslint/ban-ts-comment': off diff --git a/packages/api/src/StyleOptions.ts b/packages/api/src/StyleOptions.ts index 77a7c41687..7894b23c60 100644 --- a/packages/api/src/StyleOptions.ts +++ b/packages/api/src/StyleOptions.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; type StyleOptions = { /** diff --git a/packages/api/src/decorator/private/ActivityBorderDecoratorMiddleware.ts b/packages/api/src/decorator/private/ActivityBorderDecoratorMiddleware.ts index 5f9e70ec1c..0abf7f5bd1 100644 --- a/packages/api/src/decorator/private/ActivityBorderDecoratorMiddleware.ts +++ b/packages/api/src/decorator/private/ActivityBorderDecoratorMiddleware.ts @@ -1,6 +1,6 @@ import { type EmptyObject } from 'type-fest'; -import ActivityDecoratorRequest from './activityDecoratorRequest'; +import type ActivityDecoratorRequest from './activityDecoratorRequest'; import templateMiddleware from './templateMiddleware'; const { diff --git a/packages/api/src/decorator/private/ActivityDecorator.tsx b/packages/api/src/decorator/private/ActivityDecorator.tsx index 2662e45adf..c5abb9a9ca 100644 --- a/packages/api/src/decorator/private/ActivityDecorator.tsx +++ b/packages/api/src/decorator/private/ActivityDecorator.tsx @@ -1,6 +1,6 @@ import { getActivityLivestreamingMetadata, type WebChatActivity } from 'botframework-webchat-core'; import React, { Fragment, memo, useMemo, type ReactNode } from 'react'; -import { ActivityDecoratorRequest } from '..'; +import { type ActivityDecoratorRequest } from '..'; import { ActivityBorderDecoratorMiddlewareProxy } from './ActivityBorderDecoratorMiddleware'; const ActivityDecoratorFallback = memo(({ children }) => {children}); diff --git a/packages/api/src/defaultStyleOptions.ts b/packages/api/src/defaultStyleOptions.ts index ec3147fcbd..09baf9c61a 100644 --- a/packages/api/src/defaultStyleOptions.ts +++ b/packages/api/src/defaultStyleOptions.ts @@ -1,5 +1,5 @@ /* eslint no-magic-numbers: "off" */ -import StyleOptions from './StyleOptions'; +import type StyleOptions from './StyleOptions'; function fontFamily(fonts) { return fonts.map(font => `'${font}'`).join(', '); diff --git a/packages/api/src/hooks/Composer.tsx b/packages/api/src/hooks/Composer.tsx index 6ae1f9340d..e5415af7f4 100644 --- a/packages/api/src/hooks/Composer.tsx +++ b/packages/api/src/hooks/Composer.tsx @@ -36,7 +36,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState, type ReactNod import { Provider } from 'react-redux'; import updateIn from 'simple-update-in'; -import StyleOptions from '../StyleOptions'; +import type StyleOptions from '../StyleOptions'; import usePonyfill from '../hooks/usePonyfill'; import getAllLocalizedStrings from '../localization/getAllLocalizedStrings'; import normalizeStyleOptions from '../normalizeStyleOptions'; @@ -48,20 +48,22 @@ import ActivitySendStatusComposer from '../providers/ActivitySendStatus/Activity import ActivitySendStatusTelemetryComposer from '../providers/ActivitySendStatusTelemetry/ActivitySendStatusTelemetryComposer'; import ActivityTypingComposer from '../providers/ActivityTyping/ActivityTypingComposer'; import PonyfillComposer from '../providers/Ponyfill/PonyfillComposer'; -import ActivityMiddleware from '../types/ActivityMiddleware'; +import type ActivityMiddleware from '../types/ActivityMiddleware'; import { type ActivityStatusMiddleware, type RenderActivityStatus } from '../types/ActivityStatusMiddleware'; -import AttachmentForScreenReaderMiddleware from '../types/AttachmentForScreenReaderMiddleware'; -import AttachmentMiddleware from '../types/AttachmentMiddleware'; -import AvatarMiddleware from '../types/AvatarMiddleware'; -import CardActionMiddleware from '../types/CardActionMiddleware'; +import type AttachmentForScreenReaderMiddleware from '../types/AttachmentForScreenReaderMiddleware'; +import type AttachmentMiddleware from '../types/AttachmentMiddleware'; +import type AvatarMiddleware from '../types/AvatarMiddleware'; +import type CardActionMiddleware from '../types/CardActionMiddleware'; import { type ContextOf } from '../types/ContextOf'; -import GroupActivitiesMiddleware from '../types/GroupActivitiesMiddleware'; -import LocalizedStrings from '../types/LocalizedStrings'; -import PrecompiledGlobalizeType from '../types/PrecompiledGlobalize'; -import ScrollToEndButtonMiddleware, { ScrollToEndButtonComponentFactory } from '../types/ScrollToEndButtonMiddleware'; -import TelemetryMeasurementEvent, { TelemetryExceptionMeasurementEvent } from '../types/TelemetryMeasurementEvent'; -import ToastMiddleware from '../types/ToastMiddleware'; -import TypingIndicatorMiddleware from '../types/TypingIndicatorMiddleware'; +import type GroupActivitiesMiddleware from '../types/GroupActivitiesMiddleware'; +import type LocalizedStrings from '../types/LocalizedStrings'; +import type PrecompiledGlobalizeType from '../types/PrecompiledGlobalize'; +import { type ScrollToEndButtonComponentFactory } from '../types/ScrollToEndButtonMiddleware'; +import type ScrollToEndButtonMiddleware from '../types/ScrollToEndButtonMiddleware'; +import { type TelemetryExceptionMeasurementEvent } from '../types/TelemetryMeasurementEvent'; +import type TelemetryMeasurementEvent from '../types/TelemetryMeasurementEvent'; +import type ToastMiddleware from '../types/ToastMiddleware'; +import type TypingIndicatorMiddleware from '../types/TypingIndicatorMiddleware'; import createCustomEvent from '../utils/createCustomEvent'; import isObject from '../utils/isObject'; import mapMap from '../utils/mapMap'; diff --git a/packages/api/src/hooks/internal/WebChatAPIContext.ts b/packages/api/src/hooks/internal/WebChatAPIContext.ts index b7e6041e6e..3b83f8237d 100644 --- a/packages/api/src/hooks/internal/WebChatAPIContext.ts +++ b/packages/api/src/hooks/internal/WebChatAPIContext.ts @@ -1,27 +1,27 @@ import { type DirectLineJSBotConnection, type Observable, - type WebChatActivity, type sendFiles, type sendMessage, - type setSendBoxAttachments + type setSendBoxAttachments, + type WebChatActivity } from 'botframework-webchat-core'; import { createContext } from 'react'; -import { StrictStyleOptions } from '../../StyleOptions'; -import { LegacyActivityRenderer } from '../../types/ActivityMiddleware'; -import { RenderActivityStatus } from '../../types/ActivityStatusMiddleware'; -import { AttachmentForScreenReaderComponentFactory } from '../../types/AttachmentForScreenReaderMiddleware'; -import { RenderAttachment } from '../../types/AttachmentMiddleware'; -import { AvatarComponentFactory } from '../../types/AvatarMiddleware'; -import { PerformCardAction } from '../../types/CardActionMiddleware'; -import { GroupActivities } from '../../types/GroupActivitiesMiddleware'; -import LocalizedStrings from '../../types/LocalizedStrings'; +import { type StrictStyleOptions } from '../../StyleOptions'; +import { type LegacyActivityRenderer } from '../../types/ActivityMiddleware'; +import { type RenderActivityStatus } from '../../types/ActivityStatusMiddleware'; +import { type AttachmentForScreenReaderComponentFactory } from '../../types/AttachmentForScreenReaderMiddleware'; +import { type RenderAttachment } from '../../types/AttachmentMiddleware'; +import { type AvatarComponentFactory } from '../../types/AvatarMiddleware'; +import { type PerformCardAction } from '../../types/CardActionMiddleware'; +import { type GroupActivities } from '../../types/GroupActivitiesMiddleware'; +import type LocalizedStrings from '../../types/LocalizedStrings'; import { type Notification } from '../../types/Notification'; -import PrecompiledGlobalize from '../../types/PrecompiledGlobalize'; -import { ScrollToEndButtonComponentFactory } from '../../types/ScrollToEndButtonMiddleware'; -import TelemetryMeasurementEvent from '../../types/TelemetryMeasurementEvent'; -import { RenderToast } from '../../types/ToastMiddleware'; +import type PrecompiledGlobalize from '../../types/PrecompiledGlobalize'; +import { type ScrollToEndButtonComponentFactory } from '../../types/ScrollToEndButtonMiddleware'; +import type TelemetryMeasurementEvent from '../../types/TelemetryMeasurementEvent'; +import { type RenderToast } from '../../types/ToastMiddleware'; export type WebChatAPIContextType = { activityRenderer?: LegacyActivityRenderer; diff --git a/packages/api/src/hooks/internal/useCreateActivityRendererInternal.ts b/packages/api/src/hooks/internal/useCreateActivityRendererInternal.ts index ec03d9c6d5..972dbe2750 100644 --- a/packages/api/src/hooks/internal/useCreateActivityRendererInternal.ts +++ b/packages/api/src/hooks/internal/useCreateActivityRendererInternal.ts @@ -1,7 +1,7 @@ import { isValidElement, useMemo } from 'react'; -import { ActivityComponentFactory } from '../../types/ActivityMiddleware'; -import { RenderAttachment } from '../../types/AttachmentMiddleware'; +import { type ActivityComponentFactory } from '../../types/ActivityMiddleware'; +import { type RenderAttachment } from '../../types/AttachmentMiddleware'; import useRenderAttachment from '../useRenderAttachment'; import useWebChatAPIContext from './useWebChatAPIContext'; diff --git a/packages/api/src/hooks/internal/useValueRef.ts b/packages/api/src/hooks/internal/useValueRef.ts index 1203d213c4..3b9771ad84 100644 --- a/packages/api/src/hooks/internal/useValueRef.ts +++ b/packages/api/src/hooks/internal/useValueRef.ts @@ -1,4 +1,4 @@ -import { RefObject, useMemo, useRef } from 'react'; +import { type RefObject, useMemo, useRef } from 'react'; export default function useValueRef(value: T): RefObject { const ref = useRef(); diff --git a/packages/api/src/hooks/middleware/createDefaultCardActionMiddleware.ts b/packages/api/src/hooks/middleware/createDefaultCardActionMiddleware.ts index ee3ef4ecb0..0c3bb124e0 100644 --- a/packages/api/src/hooks/middleware/createDefaultCardActionMiddleware.ts +++ b/packages/api/src/hooks/middleware/createDefaultCardActionMiddleware.ts @@ -1,6 +1,6 @@ import { sendMessage, sendMessageBack, sendPostBack } from 'botframework-webchat-core'; -import CardActionMiddleware from '../../types/CardActionMiddleware'; +import type CardActionMiddleware from '../../types/CardActionMiddleware'; export default function createDefaultCardActionMiddleware(): CardActionMiddleware { return ({ dispatch }) => diff --git a/packages/api/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts b/packages/api/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts index 85f163b76e..4d95a9e7b5 100644 --- a/packages/api/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts +++ b/packages/api/src/hooks/middleware/createDefaultGroupActivitiesMiddleware.ts @@ -1,7 +1,7 @@ -import GroupActivitiesMiddleware from '../../types/GroupActivitiesMiddleware'; +import type GroupActivitiesMiddleware from '../../types/GroupActivitiesMiddleware'; -import type { GlobalScopePonyfill, WebChatActivity } from 'botframework-webchat-core'; -import type { SendStatus } from '../../types/SendStatus'; +import { type GlobalScopePonyfill, type WebChatActivity } from 'botframework-webchat-core'; +import { type SendStatus } from '../../types/SendStatus'; function bin(items: T[], grouping: (last: T, current: T) => boolean): T[][] { let lastBin: T[]; diff --git a/packages/api/src/hooks/useActivities.ts b/packages/api/src/hooks/useActivities.ts index 44237d7cb4..6e24e272f3 100644 --- a/packages/api/src/hooks/useActivities.ts +++ b/packages/api/src/hooks/useActivities.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { useSelector } from './internal/WebChatReduxContext'; diff --git a/packages/api/src/hooks/useCreateActivityRenderer.ts b/packages/api/src/hooks/useCreateActivityRenderer.ts index 55fb552223..6e19bc5702 100644 --- a/packages/api/src/hooks/useCreateActivityRenderer.ts +++ b/packages/api/src/hooks/useCreateActivityRenderer.ts @@ -1,4 +1,4 @@ -import { ActivityComponentFactory } from '../types/ActivityMiddleware'; +import { type ActivityComponentFactory } from '../types/ActivityMiddleware'; import useCreateActivityRendererInternal from './internal/useCreateActivityRendererInternal'; // The newer useCreateActivityRenderer() hook does not support override renderAttachment(). diff --git a/packages/api/src/hooks/useCreateActivityStatusRenderer.tsx b/packages/api/src/hooks/useCreateActivityStatusRenderer.tsx index 4b0850dc54..fd41a58665 100644 --- a/packages/api/src/hooks/useCreateActivityStatusRenderer.tsx +++ b/packages/api/src/hooks/useCreateActivityStatusRenderer.tsx @@ -1,13 +1,13 @@ /* eslint react/prop-types: "off" */ /* eslint react/require-default-props: "off" */ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import React, { memo, useMemo, type ReactNode } from 'react'; import useGetKeyByActivity from '../hooks/useGetKeyByActivity'; import useSendStatusByActivityKey from '../hooks/useSendStatusByActivityKey'; -import type { RenderActivityStatus } from '../types/ActivityStatusMiddleware'; -import type { SendStatus } from '../types/SendStatus'; +import { type RenderActivityStatus } from '../types/ActivityStatusMiddleware'; +import { type SendStatus } from '../types/SendStatus'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; type ActivityStatusContainerCoreProps = Readonly<{ diff --git a/packages/api/src/hooks/useCreateAvatarRenderer.ts b/packages/api/src/hooks/useCreateAvatarRenderer.ts index 086e985e3a..3716d74d53 100644 --- a/packages/api/src/hooks/useCreateAvatarRenderer.ts +++ b/packages/api/src/hooks/useCreateAvatarRenderer.ts @@ -1,10 +1,9 @@ -import { useMemo } from 'react'; +import { type ReactNode, useMemo } from 'react'; import useStyleOptions from './useStyleOptions'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; -import type { AvatarComponentFactory } from '../types/AvatarMiddleware'; -import type { ReactNode } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type AvatarComponentFactory } from '../types/AvatarMiddleware'; +import { type WebChatActivity } from 'botframework-webchat-core'; export default function useCreateAvatarRenderer(): ({ activity diff --git a/packages/api/src/hooks/useCreateScrollToEndButtonRenderer.ts b/packages/api/src/hooks/useCreateScrollToEndButtonRenderer.ts index e3944545e4..bef320bd75 100644 --- a/packages/api/src/hooks/useCreateScrollToEndButtonRenderer.ts +++ b/packages/api/src/hooks/useCreateScrollToEndButtonRenderer.ts @@ -1,4 +1,4 @@ -import { ScrollToEndButtonComponentFactory } from '../types/ScrollToEndButtonMiddleware'; +import { type ScrollToEndButtonComponentFactory } from '../types/ScrollToEndButtonMiddleware'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; export default function useCreateScrollToEndButtonRenderer(): ScrollToEndButtonComponentFactory { diff --git a/packages/api/src/hooks/useGetSendTimeoutForActivity.ts b/packages/api/src/hooks/useGetSendTimeoutForActivity.ts index 76452bdeb7..298f04728b 100644 --- a/packages/api/src/hooks/useGetSendTimeoutForActivity.ts +++ b/packages/api/src/hooks/useGetSendTimeoutForActivity.ts @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useStyleOptions from './useStyleOptions'; diff --git a/packages/api/src/hooks/useGroupActivities.ts b/packages/api/src/hooks/useGroupActivities.ts index 5d47c639f2..2c5a7a6c5c 100644 --- a/packages/api/src/hooks/useGroupActivities.ts +++ b/packages/api/src/hooks/useGroupActivities.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; diff --git a/packages/api/src/hooks/useMarkActivityAsSpoken.ts b/packages/api/src/hooks/useMarkActivityAsSpoken.ts index c29590dba6..b3e34323aa 100644 --- a/packages/api/src/hooks/useMarkActivityAsSpoken.ts +++ b/packages/api/src/hooks/useMarkActivityAsSpoken.ts @@ -1,5 +1,5 @@ import { useCallback } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useMarkActivity from './internal/useMarkActivity'; diff --git a/packages/api/src/hooks/usePerformCardAction.ts b/packages/api/src/hooks/usePerformCardAction.ts index 83e8bca24c..4a5053d7fd 100644 --- a/packages/api/src/hooks/usePerformCardAction.ts +++ b/packages/api/src/hooks/usePerformCardAction.ts @@ -1,4 +1,4 @@ -import { PerformCardAction } from '../types/CardActionMiddleware'; +import { type PerformCardAction } from '../types/CardActionMiddleware'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; export default function usePerformCardAction(): PerformCardAction { diff --git a/packages/api/src/hooks/useRenderToast.ts b/packages/api/src/hooks/useRenderToast.ts index c389de72be..3fd5f9f24b 100644 --- a/packages/api/src/hooks/useRenderToast.ts +++ b/packages/api/src/hooks/useRenderToast.ts @@ -1,4 +1,4 @@ -import { RenderToast } from '../types/ToastMiddleware'; +import { type RenderToast } from '../types/ToastMiddleware'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; export default function useRenderToast(): RenderToast { diff --git a/packages/api/src/hooks/useRenderTypingIndicator.ts b/packages/api/src/hooks/useRenderTypingIndicator.ts index 9928f5ed1c..fd8b7f03ba 100644 --- a/packages/api/src/hooks/useRenderTypingIndicator.ts +++ b/packages/api/src/hooks/useRenderTypingIndicator.ts @@ -1,4 +1,4 @@ -import { RenderTypingIndicator } from '../types/TypingIndicatorMiddleware'; +import { type RenderTypingIndicator } from '../types/TypingIndicatorMiddleware'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; export default function useRenderTypingIndicator(): RenderTypingIndicator { diff --git a/packages/api/src/hooks/useSendBoxAttachments.ts b/packages/api/src/hooks/useSendBoxAttachments.ts index 5a41e1940c..b3949e47b7 100644 --- a/packages/api/src/hooks/useSendBoxAttachments.ts +++ b/packages/api/src/hooks/useSendBoxAttachments.ts @@ -1,4 +1,4 @@ -import type { SendBoxAttachment } from 'botframework-webchat-core'; +import { type SendBoxAttachment } from 'botframework-webchat-core'; import { useMemo } from 'react'; import { useSelector } from './internal/WebChatReduxContext'; diff --git a/packages/api/src/hooks/useSendMessage.ts b/packages/api/src/hooks/useSendMessage.ts index 8473026285..47d85daea6 100644 --- a/packages/api/src/hooks/useSendMessage.ts +++ b/packages/api/src/hooks/useSendMessage.ts @@ -1,4 +1,4 @@ -import type { SendBoxAttachment } from 'botframework-webchat-core'; +import { type SendBoxAttachment } from 'botframework-webchat-core'; import { useCallback } from 'react'; import useWebChatAPIContext from './internal/useWebChatAPIContext'; diff --git a/packages/api/src/hooks/useSendTimeoutForActivity.ts b/packages/api/src/hooks/useSendTimeoutForActivity.ts index 00d2edf38b..847b2d6c48 100644 --- a/packages/api/src/hooks/useSendTimeoutForActivity.ts +++ b/packages/api/src/hooks/useSendTimeoutForActivity.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useGetSendTimeoutForActivity from './useGetSendTimeoutForActivity'; diff --git a/packages/api/src/hooks/useSuggestedActions.ts b/packages/api/src/hooks/useSuggestedActions.ts index 9402baca17..c70c50dd6d 100644 --- a/packages/api/src/hooks/useSuggestedActions.ts +++ b/packages/api/src/hooks/useSuggestedActions.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction, WebChatActivity } from 'botframework-webchat-core'; +import { type DirectLineCardAction, type WebChatActivity } from 'botframework-webchat-core'; import { useCallback } from 'react'; import { useSelector } from './internal/WebChatReduxContext'; diff --git a/packages/api/src/hooks/useTimeoutForSend.ts b/packages/api/src/hooks/useTimeoutForSend.ts index 96bb68131a..97c2588e0d 100644 --- a/packages/api/src/hooks/useTimeoutForSend.ts +++ b/packages/api/src/hooks/useTimeoutForSend.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useStyleOptions from './useStyleOptions'; diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index 47ad86b2de..f3b1a5e219 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -1,6 +1,7 @@ -import StyleOptions, { StrictStyleOptions } from './StyleOptions'; +import { type StrictStyleOptions } from './StyleOptions'; +import type StyleOptions from './StyleOptions'; import defaultStyleOptions from './defaultStyleOptions'; -import Composer, { ComposerProps } from './hooks/Composer'; +import Composer, { type ComposerProps } from './hooks/Composer'; import * as hooks from './hooks/index'; import { SendBoxMiddlewareProxy, @@ -22,24 +23,29 @@ import { type DebouncedNotification, type DebouncedNotifications } from './hooks import { type PostActivityFile } from './hooks/useSendFiles'; import { localize } from './localization/Localize'; import normalizeStyleOptions from './normalizeStyleOptions'; -import ActivityMiddleware, { type ActivityComponentFactory } from './types/ActivityMiddleware'; +import type ActivityMiddleware from './types/ActivityMiddleware'; +import { type ActivityComponentFactory } from './types/ActivityMiddleware'; import { type ActivityStatusMiddleware, type RenderActivityStatus } from './types/ActivityStatusMiddleware'; -import AttachmentForScreenReaderMiddleware, { - AttachmentForScreenReaderComponentFactory -} from './types/AttachmentForScreenReaderMiddleware'; -import AttachmentMiddleware, { type RenderAttachment } from './types/AttachmentMiddleware'; -import AvatarMiddleware, { type AvatarComponentFactory } from './types/AvatarMiddleware'; -import CardActionMiddleware, { type PerformCardAction } from './types/CardActionMiddleware'; +import { type AttachmentForScreenReaderComponentFactory } from './types/AttachmentForScreenReaderMiddleware'; +import type AttachmentForScreenReaderMiddleware from './types/AttachmentForScreenReaderMiddleware'; +import type AttachmentMiddleware from './types/AttachmentMiddleware'; +import { type RenderAttachment } from './types/AttachmentMiddleware'; +import type AvatarMiddleware from './types/AvatarMiddleware'; +import { type AvatarComponentFactory } from './types/AvatarMiddleware'; +import type CardActionMiddleware from './types/CardActionMiddleware'; +import { type PerformCardAction } from './types/CardActionMiddleware'; import { type ContextOf } from './types/ContextOf'; -import GroupActivitiesMiddleware, { type GroupActivities } from './types/GroupActivitiesMiddleware'; +import type GroupActivitiesMiddleware from './types/GroupActivitiesMiddleware'; +import { type GroupActivities } from './types/GroupActivitiesMiddleware'; import { type Notification } from './types/Notification'; -import ScrollToEndButtonMiddleware, { - type ScrollToEndButtonComponentFactory -} from './types/ScrollToEndButtonMiddleware'; +import type ScrollToEndButtonMiddleware from './types/ScrollToEndButtonMiddleware'; +import { type ScrollToEndButtonComponentFactory } from './types/ScrollToEndButtonMiddleware'; import { type SendStatus } from './types/SendStatus'; -import ToastMiddleware, { type RenderToast } from './types/ToastMiddleware'; +import type ToastMiddleware from './types/ToastMiddleware'; +import { type RenderToast } from './types/ToastMiddleware'; import { type Typing } from './types/Typing'; -import TypingIndicatorMiddleware, { type RenderTypingIndicator } from './types/TypingIndicatorMiddleware'; +import type TypingIndicatorMiddleware from './types/TypingIndicatorMiddleware'; +import { type RenderTypingIndicator } from './types/TypingIndicatorMiddleware'; import { type WebSpeechPonyfill } from './types/WebSpeechPonyfill'; import { type WebSpeechPonyfillFactory } from './types/WebSpeechPonyfillFactory'; diff --git a/packages/api/src/localization/getAllLocalizedStrings.ts b/packages/api/src/localization/getAllLocalizedStrings.ts index 074b121d87..c3e19d29ff 100644 --- a/packages/api/src/localization/getAllLocalizedStrings.ts +++ b/packages/api/src/localization/getAllLocalizedStrings.ts @@ -50,7 +50,7 @@ import zhHK from './zh-HK.json'; import zhTW from './zh-TW.json'; import bundledOverrides from './overrides.json'; -import LocalizedStrings from '../types/LocalizedStrings'; +import type LocalizedStrings from '../types/LocalizedStrings'; import mergeLocalizedStrings from './mergeLocalizedStrings'; let localizedStrings; diff --git a/packages/api/src/localization/mergeLocalizedStrings.ts b/packages/api/src/localization/mergeLocalizedStrings.ts index e395b9aa04..f7188d984c 100644 --- a/packages/api/src/localization/mergeLocalizedStrings.ts +++ b/packages/api/src/localization/mergeLocalizedStrings.ts @@ -1,6 +1,6 @@ import { isForbiddenPropertyName } from 'botframework-webchat-core'; -import LocalizedStrings from '../types/LocalizedStrings'; +import type LocalizedStrings from '../types/LocalizedStrings'; type LocalizedStringsMap = { [language: string]: LocalizedStrings }; diff --git a/packages/api/src/normalizeStyleOptions.ts b/packages/api/src/normalizeStyleOptions.ts index 975a77f959..d8402cf725 100644 --- a/packages/api/src/normalizeStyleOptions.ts +++ b/packages/api/src/normalizeStyleOptions.ts @@ -1,7 +1,8 @@ import { warnOnce } from 'botframework-webchat-core'; import defaultStyleOptions from './defaultStyleOptions'; -import StyleOptions, { StrictStyleOptions } from './StyleOptions'; +import { type StrictStyleOptions } from './StyleOptions'; +import type StyleOptions from './StyleOptions'; const bubbleImageHeightDeprecation = warnOnce( '"styleOptions.bubbleImageHeight" has been deprecated. Use "styleOptions.bubbleImageMaxHeight" and "styleOptions.bubbleImageMinHeight" instead. This deprecation migration will be removed on or after 2026-07-05.' diff --git a/packages/api/src/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.tsx b/packages/api/src/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.tsx index adfe1539e4..f214282c9c 100644 --- a/packages/api/src/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.tsx +++ b/packages/api/src/providers/ActivityAcknowledgement/ActivityAcknowledgementComposer.tsx @@ -5,7 +5,7 @@ import useValueRef from '../../hooks/internal/useValueRef'; import useActivities from '../../hooks/useActivities'; import findLastIndex from '../../utils/findLastIndex'; import useActivityKeys from '../ActivityKeyer/useActivityKeys'; -import ActivityAcknowledgementContext, { ActivityAcknowledgementContextType } from './private/Context'; +import ActivityAcknowledgementContext, { type ActivityAcknowledgementContextType } from './private/Context'; type ActivityAcknowledgement = { get acknowledged(): boolean; diff --git a/packages/api/src/providers/ActivityAcknowledgement/private/useContext.ts b/packages/api/src/providers/ActivityAcknowledgement/private/useContext.ts index 7ce7c39d18..9e15aea60b 100644 --- a/packages/api/src/providers/ActivityAcknowledgement/private/useContext.ts +++ b/packages/api/src/providers/ActivityAcknowledgement/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import ActivityAcknowledgementContext from './Context'; -import type { ActivityAcknowledgementContextType } from './Context'; +import { type ActivityAcknowledgementContextType } from './Context'; export default function useActivityAcknowledgementContext( thrownOnUndefined = true diff --git a/packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx b/packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx index a24f29189d..142ef63b54 100644 --- a/packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx +++ b/packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx @@ -1,9 +1,9 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import React, { useCallback, useMemo, useRef, type ReactNode } from 'react'; import reduceIterable from '../../hooks/private/reduceIterable'; import useActivities from '../../hooks/useActivities'; -import type { ActivityKeyerContextType } from './private/Context'; +import { type ActivityKeyerContextType } from './private/Context'; import ActivityKeyerContext from './private/Context'; import getActivityId from './private/getActivityId'; import getClientActivityId from './private/getClientActivityId'; diff --git a/packages/api/src/providers/ActivityKeyer/private/Context.ts b/packages/api/src/providers/ActivityKeyer/private/Context.ts index 2c4d505717..bc67f455a0 100644 --- a/packages/api/src/providers/ActivityKeyer/private/Context.ts +++ b/packages/api/src/providers/ActivityKeyer/private/Context.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { createContext } from 'react'; type ActivityKeyerContextType = { diff --git a/packages/api/src/providers/ActivityKeyer/private/getActivityId.ts b/packages/api/src/providers/ActivityKeyer/private/getActivityId.ts index 3264c55331..3663eea15a 100644 --- a/packages/api/src/providers/ActivityKeyer/private/getActivityId.ts +++ b/packages/api/src/providers/ActivityKeyer/private/getActivityId.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; export default function getActivityId(activity: WebChatActivity): string { return activity.id; diff --git a/packages/api/src/providers/ActivityKeyer/private/getClientActivityId.ts b/packages/api/src/providers/ActivityKeyer/private/getClientActivityId.ts index 3b81ad3b78..0b54892bc7 100644 --- a/packages/api/src/providers/ActivityKeyer/private/getClientActivityId.ts +++ b/packages/api/src/providers/ActivityKeyer/private/getClientActivityId.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; export default function getClientActivityId(activity: WebChatActivity): string { return activity.channelData?.clientActivityID; diff --git a/packages/api/src/providers/ActivityKeyer/private/useContext.ts b/packages/api/src/providers/ActivityKeyer/private/useContext.ts index ee5d2d9e89..961e868230 100644 --- a/packages/api/src/providers/ActivityKeyer/private/useContext.ts +++ b/packages/api/src/providers/ActivityKeyer/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import ActivityKeyerContext from './Context'; -import type { ActivityKeyerContextType } from './Context'; +import { type ActivityKeyerContextType } from './Context'; export default function useActivityKeyerContext(thrownOnUndefined = true): ActivityKeyerContextType { const contextValue = useContext(ActivityKeyerContext); diff --git a/packages/api/src/providers/ActivityKeyer/useGetActivitiesByKey.ts b/packages/api/src/providers/ActivityKeyer/useGetActivitiesByKey.ts index a513e9cd34..c4b3b497d9 100644 --- a/packages/api/src/providers/ActivityKeyer/useGetActivitiesByKey.ts +++ b/packages/api/src/providers/ActivityKeyer/useGetActivitiesByKey.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useActivityKeyerContext from './private/useContext'; diff --git a/packages/api/src/providers/ActivityKeyer/useGetActivityByKey.ts b/packages/api/src/providers/ActivityKeyer/useGetActivityByKey.ts index 2e4a8e7307..0c0c21bc2f 100644 --- a/packages/api/src/providers/ActivityKeyer/useGetActivityByKey.ts +++ b/packages/api/src/providers/ActivityKeyer/useGetActivityByKey.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useActivityKeyerContext from './private/useContext'; diff --git a/packages/api/src/providers/ActivityKeyer/useGetKeyByActivity.ts b/packages/api/src/providers/ActivityKeyer/useGetKeyByActivity.ts index 39d95496dd..c2759f62fb 100644 --- a/packages/api/src/providers/ActivityKeyer/useGetKeyByActivity.ts +++ b/packages/api/src/providers/ActivityKeyer/useGetKeyByActivity.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useActivityKeyerContext from './private/useContext'; diff --git a/packages/api/src/providers/ActivityListener/ActivityListenerComposer.tsx b/packages/api/src/providers/ActivityListener/ActivityListenerComposer.tsx index fc36762b68..b3bfa28d73 100644 --- a/packages/api/src/providers/ActivityListener/ActivityListenerComposer.tsx +++ b/packages/api/src/providers/ActivityListener/ActivityListenerComposer.tsx @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import React, { memo, useMemo, type ReactNode } from 'react'; import usePrevious from '../../hooks/internal/usePrevious'; import useActivities from '../../hooks/useActivities'; diff --git a/packages/api/src/providers/ActivityListener/useUpsertedActivities.ts b/packages/api/src/providers/ActivityListener/useUpsertedActivities.ts index 34489ed90f..1581db3ab2 100644 --- a/packages/api/src/providers/ActivityListener/useUpsertedActivities.ts +++ b/packages/api/src/providers/ActivityListener/useUpsertedActivities.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useActivityListenerContext from './private/useContext'; export default function useUpsertedActivities(): readonly [readonly WebChatActivity[]] { diff --git a/packages/api/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx b/packages/api/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx index 194a85c112..39e8b9d7a9 100644 --- a/packages/api/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx +++ b/packages/api/src/providers/ActivitySendStatus/ActivitySendStatusComposer.tsx @@ -1,12 +1,12 @@ -import React, { useEffect, useMemo, useRef, type FC, type PropsWithChildren } from 'react'; +import React, { useEffect, useMemo, useRef, type ReactNode } from 'react'; import { useActivities, usePonyfill } from '../../hooks/index'; import useForceRender from '../../hooks/internal/useForceRender'; import useGetSendTimeoutForActivity from '../../hooks/useGetSendTimeoutForActivity'; -import type { SendStatus } from '../../types/SendStatus'; +import { type SendStatus } from '../../types/SendStatus'; import freezeArray from '../../utils/freezeArray'; import useGetKeyByActivity from '../ActivityKeyer/useGetKeyByActivity'; -import type { ActivitySendStatusContextType } from './private/Context'; +import { type ActivitySendStatusContextType } from './private/Context'; import ActivitySendStatusContext from './private/Context'; import isMapEqual from './private/isMapEqual'; @@ -14,7 +14,11 @@ import isMapEqual from './private/isMapEqual'; const EXPIRY_SEND_FAILED = -Infinity; const EXPIRY_SENT = Infinity; -const ActivitySendStatusComposer: FC> = ({ children }) => { +type ActivitySendStatusComposerProps = Readonly<{ + children?: ReactNode | undefined; +}>; + +const ActivitySendStatusComposer = ({ children }: ActivitySendStatusComposerProps) => { const [activities] = useActivities(); const [{ clearTimeout, Date, setTimeout }] = usePonyfill(); const forceRender = useForceRender(); diff --git a/packages/api/src/providers/ActivitySendStatus/private/useContext.ts b/packages/api/src/providers/ActivitySendStatus/private/useContext.ts index 7d0cbb66b2..cc8f5007df 100644 --- a/packages/api/src/providers/ActivitySendStatus/private/useContext.ts +++ b/packages/api/src/providers/ActivitySendStatus/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import ActivitySendStatusContext from './Context'; -import type { ActivitySendStatusContextType } from './Context'; +import { type ActivitySendStatusContextType } from './Context'; export default function useActivitySendStatusContext(thrownOnUndefined = true): ActivitySendStatusContextType { const contextValue = useContext(ActivitySendStatusContext); diff --git a/packages/api/src/providers/ActivitySendStatus/useSendStatusByActivityKey.ts b/packages/api/src/providers/ActivitySendStatus/useSendStatusByActivityKey.ts index e78b6c7758..2d3b06a2a5 100644 --- a/packages/api/src/providers/ActivitySendStatus/useSendStatusByActivityKey.ts +++ b/packages/api/src/providers/ActivitySendStatus/useSendStatusByActivityKey.ts @@ -1,6 +1,6 @@ import useActivitySendStatusContext from './private/useContext'; -import type { SendStatus } from '../../types/SendStatus'; +import { type SendStatus } from '../../types/SendStatus'; /** * Returns a key/value map which stores the outgoing activity send status by activity key: diff --git a/packages/api/src/providers/ActivityTyping/ActivityTypingComposer.tsx b/packages/api/src/providers/ActivityTyping/ActivityTypingComposer.tsx index e8408e0edb..c3978f4d3c 100644 --- a/packages/api/src/providers/ActivityTyping/ActivityTypingComposer.tsx +++ b/packages/api/src/providers/ActivityTyping/ActivityTypingComposer.tsx @@ -6,7 +6,7 @@ import numberWithInfinity from '../../hooks/private/numberWithInfinity'; import useActivities from '../../hooks/useActivities'; import usePonyfill from '../../hooks/usePonyfill'; import useUpsertedActivities from '../../providers/ActivityListener/useUpsertedActivities'; -import ActivityTypingContext, { ActivityTypingContextType } from './private/Context'; +import ActivityTypingContext, { type ActivityTypingContextType } from './private/Context'; import useMemoWithPrevious from './private/useMemoWithPrevious'; import { type AllTyping } from './types/AllTyping'; diff --git a/packages/api/src/providers/ActivityTyping/private/useMemoWithPrevious.ts b/packages/api/src/providers/ActivityTyping/private/useMemoWithPrevious.ts index 967dc2b828..28857da680 100644 --- a/packages/api/src/providers/ActivityTyping/private/useMemoWithPrevious.ts +++ b/packages/api/src/providers/ActivityTyping/private/useMemoWithPrevious.ts @@ -1,7 +1,7 @@ // TODO: [P1] Dedupe. import { useEffect, useMemo, useRef } from 'react'; -import type { DependencyList } from 'react'; +import { type DependencyList } from 'react'; export default function useMemoWithPrevious(factory: (prevValue: T | undefined) => T, deps: DependencyList): T { const prevValueRef = useRef(undefined); diff --git a/packages/api/src/providers/ActivityTyping/useAllTyping.ts b/packages/api/src/providers/ActivityTyping/useAllTyping.ts index 1780324a2a..5080d84c79 100644 --- a/packages/api/src/providers/ActivityTyping/useAllTyping.ts +++ b/packages/api/src/providers/ActivityTyping/useAllTyping.ts @@ -1,5 +1,5 @@ import useActivityTypingContext from './private/useContext'; -import type { AllTyping } from './types/AllTyping'; +import { type AllTyping } from './types/AllTyping'; export default function useAllTyping(): readonly [ReadonlyMap] { return useActivityTypingContext().allTypingState; diff --git a/packages/api/src/providers/Ponyfill/PonyfillComposer.tsx b/packages/api/src/providers/Ponyfill/PonyfillComposer.tsx index c5a4aace4e..99af24dca9 100644 --- a/packages/api/src/providers/Ponyfill/PonyfillComposer.tsx +++ b/packages/api/src/providers/Ponyfill/PonyfillComposer.tsx @@ -1,11 +1,12 @@ -import type { GlobalScopePonyfill } from 'botframework-webchat-core'; +import { type GlobalScopePonyfill } from 'botframework-webchat-core'; import PropTypes from 'prop-types'; -import React, { useMemo, useRef, type PropsWithChildren } from 'react'; +import React, { useMemo, useRef, type ReactNode } from 'react'; -import type { ContextOf } from '../../types/ContextOf'; +import { type ContextOf } from '../../types/ContextOf'; import PonyfillContext from './private/PonyfillContext'; -type Props = PropsWithChildren<{ +type Props = Readonly<{ + children?: ReactNode | undefined; ponyfill?: Partial; }>; diff --git a/packages/api/src/providers/Ponyfill/private/PonyfillContext.ts b/packages/api/src/providers/Ponyfill/private/PonyfillContext.ts index ee0a95d083..5221b94ae7 100644 --- a/packages/api/src/providers/Ponyfill/private/PonyfillContext.ts +++ b/packages/api/src/providers/Ponyfill/private/PonyfillContext.ts @@ -1,6 +1,6 @@ import { createContext } from 'react'; -import type { GlobalScopePonyfill } from 'botframework-webchat-core'; +import { type GlobalScopePonyfill } from 'botframework-webchat-core'; type PonyfillContextType = { ponyfillState: readonly [GlobalScopePonyfill]; diff --git a/packages/api/src/providers/Ponyfill/private/useContext.ts b/packages/api/src/providers/Ponyfill/private/useContext.ts index 4571090b99..c4b9414423 100644 --- a/packages/api/src/providers/Ponyfill/private/useContext.ts +++ b/packages/api/src/providers/Ponyfill/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import PonyfillContext from './PonyfillContext'; -import type { Context } from 'react'; +import { type Context } from 'react'; type ContextOf = T extends Context ? C : never; diff --git a/packages/api/src/providers/Ponyfill/usePonyfill.ts b/packages/api/src/providers/Ponyfill/usePonyfill.ts index bbbd4811da..1c65f1f41f 100644 --- a/packages/api/src/providers/Ponyfill/usePonyfill.ts +++ b/packages/api/src/providers/Ponyfill/usePonyfill.ts @@ -1,6 +1,6 @@ import usePonyfillContext from './private/useContext'; -import type { GlobalScopePonyfill } from 'botframework-webchat-core'; +import { type GlobalScopePonyfill } from 'botframework-webchat-core'; export default function usePonyfill(): readonly [GlobalScopePonyfill] { return usePonyfillContext().ponyfillState; diff --git a/packages/api/src/types/ActivityMiddleware.ts b/packages/api/src/types/ActivityMiddleware.ts index 341ca3285a..549f102324 100644 --- a/packages/api/src/types/ActivityMiddleware.ts +++ b/packages/api/src/types/ActivityMiddleware.ts @@ -1,6 +1,6 @@ -import type { ReactNode } from 'react'; -import type { RenderAttachment } from './AttachmentMiddleware'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type ReactNode } from 'react'; +import { type RenderAttachment } from './AttachmentMiddleware'; +import { type WebChatActivity } from 'botframework-webchat-core'; type ActivityProps = { hideTimestamp: boolean; diff --git a/packages/api/src/types/ActivityStatusMiddleware.ts b/packages/api/src/types/ActivityStatusMiddleware.ts index 0357363037..7971bc8f77 100644 --- a/packages/api/src/types/ActivityStatusMiddleware.ts +++ b/packages/api/src/types/ActivityStatusMiddleware.ts @@ -1,7 +1,7 @@ -import type { ReactElement } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type ReactElement } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; -import type { SendStatus } from '../types/SendStatus'; +import { type SendStatus } from '../types/SendStatus'; // TODO: Migrate this legacy middleware signature. type RenderActivityStatusOptions = { diff --git a/packages/api/src/types/AttachmentForScreenReaderMiddleware.ts b/packages/api/src/types/AttachmentForScreenReaderMiddleware.ts index a8b22ad979..480966e3a6 100644 --- a/packages/api/src/types/AttachmentForScreenReaderMiddleware.ts +++ b/packages/api/src/types/AttachmentForScreenReaderMiddleware.ts @@ -1,8 +1,9 @@ -import type { DirectLineAttachment, WebChatActivity } from 'botframework-webchat-core'; +import { type DirectLineAttachment, type WebChatActivity } from 'botframework-webchat-core'; // TODO: We should consider using a prop for "attachmentMiddleware" to render for screen reader, instead of having another middleware. -import ComponentMiddleware, { ComponentFactory } from './ComponentMiddleware'; +import { type ComponentFactory } from './ComponentMiddleware'; +import type ComponentMiddleware from './ComponentMiddleware'; type AttachmentForScreenReaderComponentFactoryOptions = [ { diff --git a/packages/api/src/types/AttachmentMiddleware.ts b/packages/api/src/types/AttachmentMiddleware.ts index a3fc769cd2..9d6e1d82e9 100644 --- a/packages/api/src/types/AttachmentMiddleware.ts +++ b/packages/api/src/types/AttachmentMiddleware.ts @@ -1,5 +1,5 @@ -import { ReactNode } from 'react'; -import type { DirectLineAttachment, WebChatActivity } from 'botframework-webchat-core'; +import { type ReactNode } from 'react'; +import { type DirectLineAttachment, type WebChatActivity } from 'botframework-webchat-core'; type AttachmentProps = { activity: WebChatActivity; diff --git a/packages/api/src/types/AvatarMiddleware.ts b/packages/api/src/types/AvatarMiddleware.ts index b23da2b185..4524610c6c 100644 --- a/packages/api/src/types/AvatarMiddleware.ts +++ b/packages/api/src/types/AvatarMiddleware.ts @@ -1,7 +1,8 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; -import { StrictStyleOptions } from '../StyleOptions'; -import ComponentMiddleware, { ComponentFactory } from './ComponentMiddleware'; +import { type StrictStyleOptions } from '../StyleOptions'; +import type ComponentMiddleware from './ComponentMiddleware'; +import { type ComponentFactory } from './ComponentMiddleware'; type AvatarComponentFactoryArguments = [ { diff --git a/packages/api/src/types/CardActionMiddleware.ts b/packages/api/src/types/CardActionMiddleware.ts index 6f49945610..3c515887ce 100644 --- a/packages/api/src/types/CardActionMiddleware.ts +++ b/packages/api/src/types/CardActionMiddleware.ts @@ -1,6 +1,6 @@ -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; -import FunctionMiddleware from './FunctionMiddleware'; +import type FunctionMiddleware from './FunctionMiddleware'; type PerformCardAction = (cardAction: DirectLineCardAction, event?: { target: EventTarget }) => void; diff --git a/packages/api/src/types/ComponentMiddleware.ts b/packages/api/src/types/ComponentMiddleware.ts index dfa79edfbe..746e39cd34 100644 --- a/packages/api/src/types/ComponentMiddleware.ts +++ b/packages/api/src/types/ComponentMiddleware.ts @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import { type ReactNode } from 'react'; type OnScreenReactNode = Exclude; diff --git a/packages/api/src/types/ContextOf.ts b/packages/api/src/types/ContextOf.ts index 8633c5389b..4eb5ca67ad 100644 --- a/packages/api/src/types/ContextOf.ts +++ b/packages/api/src/types/ContextOf.ts @@ -1,4 +1,4 @@ -import type { Context } from 'react'; +import { type Context } from 'react'; type ContextOf = T extends Context ? P : never; diff --git a/packages/api/src/types/GroupActivitiesMiddleware.ts b/packages/api/src/types/GroupActivitiesMiddleware.ts index 4e335a49d7..9034ac3d95 100644 --- a/packages/api/src/types/GroupActivitiesMiddleware.ts +++ b/packages/api/src/types/GroupActivitiesMiddleware.ts @@ -1,6 +1,7 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; -import FunctionMiddleware, { CallFunction } from './FunctionMiddleware'; +import { type CallFunction } from './FunctionMiddleware'; +import type FunctionMiddleware from './FunctionMiddleware'; type GroupActivities = CallFunction< [{ activities: WebChatActivity[] }], diff --git a/packages/api/src/types/ScrollToEndButtonMiddleware.ts b/packages/api/src/types/ScrollToEndButtonMiddleware.ts index 9090f4a269..4f01a94484 100644 --- a/packages/api/src/types/ScrollToEndButtonMiddleware.ts +++ b/packages/api/src/types/ScrollToEndButtonMiddleware.ts @@ -1,5 +1,6 @@ -import { StrictStyleOptions } from '../StyleOptions'; -import ComponentMiddleware, { ComponentFactory } from './ComponentMiddleware'; +import { type StrictStyleOptions } from '../StyleOptions'; +import { type ComponentFactory } from './ComponentMiddleware'; +import type ComponentMiddleware from './ComponentMiddleware'; /** * @type {object} diff --git a/packages/api/src/types/ToastMiddleware.ts b/packages/api/src/types/ToastMiddleware.ts index 7dfc7de419..22951d6f6e 100644 --- a/packages/api/src/types/ToastMiddleware.ts +++ b/packages/api/src/types/ToastMiddleware.ts @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import { type ReactNode } from 'react'; import { type Notification } from './Notification'; diff --git a/packages/api/src/types/TypingIndicatorMiddleware.ts b/packages/api/src/types/TypingIndicatorMiddleware.ts index 3cde41b1f3..69cfa025db 100644 --- a/packages/api/src/types/TypingIndicatorMiddleware.ts +++ b/packages/api/src/types/TypingIndicatorMiddleware.ts @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import { type ReactNode } from 'react'; import { type Typing } from './Typing'; diff --git a/packages/bundle/src/AddFullBundle.tsx b/packages/bundle/src/AddFullBundle.tsx index c273bc0426..15154fc165 100644 --- a/packages/bundle/src/AddFullBundle.tsx +++ b/packages/bundle/src/AddFullBundle.tsx @@ -16,7 +16,7 @@ import useComposerProps from './useComposerProps'; type AddFullBundleProps = Readonly<{ adaptiveCardsHostConfig?: any; - adaptiveCardsPackage?: AdaptiveCardsPackage; + adaptiveCardsPackage?: Readonly; attachmentForScreenReaderMiddleware?: OneOrMany; attachmentMiddleware?: OneOrMany; children: ({ extraStyleSet }: { extraStyleSet: any }) => ReactNode; @@ -26,8 +26,8 @@ type AddFullBundleProps = Readonly<{ newLineOptions: { markdownRespectCRLF: boolean }, linkOptions: { externalLinkAlt: string } ) => string; - styleOptions?: StyleOptions & AdaptiveCardsStyleOptions; - styleSet?: any & { options: StrictFullBundleStyleOptions }; + styleOptions?: Readonly; + styleSet?: any & Readonly<{ options: StrictFullBundleStyleOptions }>; /** @deprecated Rename to "adaptiveCardsHostConfig" */ adaptiveCardHostConfig?: any; diff --git a/packages/bundle/src/FullComposer.tsx b/packages/bundle/src/FullComposer.tsx index 2d0f440a37..d1d5eff734 100644 --- a/packages/bundle/src/FullComposer.tsx +++ b/packages/bundle/src/FullComposer.tsx @@ -6,7 +6,7 @@ import AddFullBundle, { type AddFullBundleProps } from './AddFullBundle'; const { Composer } = Components; -type FullComposerProps = ComposerProps & AddFullBundleProps; +type FullComposerProps = ComposerProps & Readonly; const FullComposer = (props: FullComposerProps) => ( diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardAttachment.tsx b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardAttachment.tsx index 1a4abb422a..e849dd2c54 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardAttachment.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardAttachment.tsx @@ -1,15 +1,15 @@ import PropTypes from 'prop-types'; -import React, { FC } from 'react'; -import type { DirectLineAttachment } from 'botframework-webchat-core'; +import React from 'react'; +import { type DirectLineAttachment } from 'botframework-webchat-core'; import AdaptiveCardContent from './AdaptiveCardContent'; -type AdaptiveCardAttachmentProps = { +type AdaptiveCardAttachmentProps = Readonly<{ attachment: DirectLineAttachment; disabled?: boolean; -}; +}>; -const AdaptiveCardAttachment: FC = ({ attachment: { content }, disabled }) => ( +const AdaptiveCardAttachment = ({ attachment: { content }, disabled }: AdaptiveCardAttachmentProps) => ( ); diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardBuilder.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardBuilder.ts index 56013d869d..6366b662b9 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardBuilder.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardBuilder.ts @@ -15,7 +15,7 @@ import { type AdaptiveCard, type CardElement } from 'adaptivecards'; -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; import { isForbiddenPropertyName } from 'botframework-webchat-core'; import { type AdaptiveCardsPackage } from '../../types/AdaptiveCardsPackage'; diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardContent.tsx index 8441149ce0..449fd9650a 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardContent.tsx @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import AdaptiveCardRenderer from './AdaptiveCardRenderer'; import useParseAdaptiveCardJSON from '../hooks/internal/useParseAdaptiveCardJSON'; @@ -17,13 +17,13 @@ function stripSubmitAction(card) { return { ...card, nextActions }; } -type AdaptiveCardContentProps = { +type AdaptiveCardContentProps = Readonly<{ actionPerformedClassName?: string; content: any; disabled?: boolean; -}; +}>; -const AdaptiveCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const AdaptiveCardContent = ({ actionPerformedClassName, content, disabled }: AdaptiveCardContentProps) => { const parseAdaptiveCardJSON = useParseAdaptiveCardJSON(); const card = useMemo( diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/findDOMNodeOwner.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/findDOMNodeOwner.ts index 3981618034..9303475c3b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/findDOMNodeOwner.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/findDOMNodeOwner.ts @@ -1,4 +1,4 @@ -import type { AdaptiveCard, CardObject, ShowCardAction } from 'adaptivecards'; +import { type AdaptiveCard, type CardObject, type ShowCardAction } from 'adaptivecards'; // TODO: [P2] Remove this when Adaptive Card fixed their bug #7606. // https://github.com/microsoft/AdaptiveCards/issues/7606 diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useAdaptiveCardModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useAdaptiveCardModEffect.ts index 5b79976eca..a7f84005d4 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useAdaptiveCardModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useAdaptiveCardModEffect.ts @@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useRef } from 'react'; import useLazyRef from './useLazyRef'; import useValueRef from './useValueRef'; -import type { AdaptiveCard } from 'adaptivecards'; +import { type AdaptiveCard } from 'adaptivecards'; type ModFunction = ( adaptiveCard: AdaptiveCard, diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useLazyRef.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useLazyRef.ts index cf296cc03d..272eaf104f 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useLazyRef.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useLazyRef.ts @@ -1,6 +1,4 @@ -import { useRef } from 'react'; - -import type { MutableRefObject } from 'react'; +import { type MutableRefObject, useRef } from 'react'; const UNINITIALIZED = Symbol(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useValueRef.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useValueRef.ts index b22542ce1f..b778e36be0 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useValueRef.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/private/useValueRef.ts @@ -1,6 +1,4 @@ -import { useRef } from 'react'; - -import type { RefObject } from 'react'; +import { type RefObject, useRef } from 'react'; export default function useValueRef(value: T): RefObject { const ref = useRef(value); diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActionShouldBePushButtonModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActionShouldBePushButtonModEffect.ts index f9284a9b6c..6653635569 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActionShouldBePushButtonModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActionShouldBePushButtonModEffect.ts @@ -9,8 +9,8 @@ import setOrRemoveAttributeIfFalseWithUndo from '../../DOMManipulationWithUndo/s import useAdaptiveCardModEffect from './private/useAdaptiveCardModEffect'; import usePrevious from './private/usePrevious'; -import type { AdaptiveCard, CardObject } from 'adaptivecards'; -import type { UndoFunction } from '../../DOMManipulationWithUndo/types/UndoFunction'; +import { type AdaptiveCard, type CardObject } from 'adaptivecards'; +import { type UndoFunction } from '../../DOMManipulationWithUndo/types/UndoFunction'; /** * Accessibility: Action in ActionSet/CardElement should be push button. diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActiveElementModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActiveElementModEffect.ts index e47c49a4d9..ff1a796dce 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActiveElementModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useActiveElementModEffect.ts @@ -4,7 +4,7 @@ import findDOMNodeOwner from './private/findDOMNodeOwner'; import useAdaptiveCardModEffect from './private/useAdaptiveCardModEffect'; import usePrevious from './private/usePrevious'; -import type { AdaptiveCard, CardObject } from 'adaptivecards'; +import { type AdaptiveCard, type CardObject } from 'adaptivecards'; /** * Re-rendering: Last focused element must be persisted during render cycle. diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useDisabledModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useDisabledModEffect.ts index 0fb043c456..3317611165 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useDisabledModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useDisabledModEffect.ts @@ -4,8 +4,8 @@ import bunchUndos from '../../DOMManipulationWithUndo/bunchUndos'; import durableDisableInputElementAccessiblyWithUndo from '../../DOMManipulationWithUndo/durableDisableInputElementAccessiblyWithUndo'; import useAdaptiveCardModEffect from './private/useAdaptiveCardModEffect'; -import type { AdaptiveCard } from 'adaptivecards'; -import type { UndoFunction } from '../../DOMManipulationWithUndo/types/UndoFunction'; +import { type AdaptiveCard } from 'adaptivecards'; +import { type UndoFunction } from '../../DOMManipulationWithUndo/types/UndoFunction'; // This is intended. This is a no-op function and intended to do nothing. // eslint-disable-next-line @typescript-eslint/no-empty-function diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/usePersistValuesModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/usePersistValuesModEffect.ts index 4da2c5a330..3501188d5a 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/usePersistValuesModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/usePersistValuesModEffect.ts @@ -3,7 +3,7 @@ import { useMemo, useRef } from 'react'; import useAdaptiveCardModEffect from './private/useAdaptiveCardModEffect'; import usePrevious from './private/usePrevious'; -import type { AdaptiveCard, CardObject } from 'adaptivecards'; +import { type AdaptiveCard, type CardObject } from 'adaptivecards'; /** * Gets all user-inputted values under a DOM node. diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useRoleModEffect.ts b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useRoleModEffect.ts index 2c84be189d..734c72474b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useRoleModEffect.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useRoleModEffect.ts @@ -3,7 +3,7 @@ import { useMemo } from 'react'; import setOrRemoveAttributeIfFalseWithUndo from '../../DOMManipulationWithUndo/setOrRemoveAttributeIfFalseWithUndo'; import useAdaptiveCardModEffect from './private/useAdaptiveCardModEffect'; -import type { AdaptiveCard } from 'adaptivecards'; +import { type AdaptiveCard } from 'adaptivecards'; /** * Accessibility: "role" attribute must be set if "aria-label" is set. diff --git a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx index ea94c1d459..b0e925e4ac 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardRenderer.tsx @@ -1,24 +1,28 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 2] }] */ -import { AdaptiveCard, Action as AdaptiveCardAction, OpenUrlAction, SubmitAction } from 'adaptivecards'; +import { + type Action as AdaptiveCardAction, + type AdaptiveCard, + type OpenUrlAction, + type SubmitAction +} from 'adaptivecards'; import { Components, getTabIndex, hooks } from 'botframework-webchat-component'; -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import React, { - KeyboardEventHandler, - MouseEventHandler, - VFC, useCallback, useLayoutEffect, useMemo, - useRef + useRef, + type KeyboardEventHandler, + type MouseEventHandler } from 'react'; import useStyleSet from '../../hooks/useStyleSet'; import useAdaptiveCardsHostConfig from '../hooks/useAdaptiveCardsHostConfig'; import useAdaptiveCardsPackage from '../hooks/useAdaptiveCardsPackage'; -import { BotFrameworkCardAction } from './AdaptiveCardBuilder'; +import { type BotFrameworkCardAction } from './AdaptiveCardBuilder'; import useValueRef from './AdaptiveCardHacks/private/useValueRef'; import useActionShouldBePushButtonModEffect from './AdaptiveCardHacks/useActionShouldBePushButtonModEffect'; import useActiveElementModEffect from './AdaptiveCardHacks/useActiveElementModEffect'; @@ -32,19 +36,19 @@ const { useLocalizer, usePerformCardAction, useRenderMarkdownAsHTML, useScrollTo const node_env = process.env.node_env || process.env.NODE_ENV; -type AdaptiveCardRendererProps = { +type AdaptiveCardRendererProps = Readonly<{ actionPerformedClassName?: string; adaptiveCard: AdaptiveCard; disabled?: boolean; tapAction?: DirectLineCardAction; -}; +}>; -const AdaptiveCardRenderer: VFC = ({ +const AdaptiveCardRenderer = ({ actionPerformedClassName, adaptiveCard, disabled: disabledFromProps, tapAction -}) => { +}: AdaptiveCardRendererProps) => { const [{ adaptiveCardRenderer: adaptiveCardRendererStyleSet }] = useStyleSet(); const [{ GlobalSettings, HostConfig }] = useAdaptiveCardsPackage(); const [adaptiveCardsHostConfig] = useAdaptiveCardsHostConfig(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx index 943d9300ce..ea123f5638 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.tsx @@ -2,21 +2,21 @@ import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; -import type { DirectLineAnimationCard } from 'botframework-webchat-core'; +import React from 'react'; +import { type DirectLineAnimationCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; import useStyleSet from '../../hooks/useStyleSet'; const { ImageContent, VideoContent } = Components; -type AnimationCardContentProps = { +type AnimationCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineAnimationCard; disabled?: boolean; -}; +}>; -const AnimationCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const AnimationCardContent = ({ actionPerformedClassName, content, disabled }: AnimationCardContentProps) => { const { media = [] } = content; const [{ animationCardAttachment: animationCardAttachmentStyleSet }] = useStyleSet(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx index a280290e4b..c3ad0a0c41 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/AudioCardContent.tsx @@ -2,21 +2,21 @@ import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; -import type { DirectLineAudioCard } from 'botframework-webchat-core'; +import React from 'react'; +import { type DirectLineAudioCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; import useStyleSet from '../../hooks/useStyleSet'; const { AudioContent } = Components; -type AudioCardContentProps = { +type AudioCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineAudioCard; disabled?: boolean; -}; +}>; -const AudioCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const AudioCardContent = ({ actionPerformedClassName, content, disabled }: AudioCardContentProps) => { const [{ audioCardAttachment: audioCardAttachmentStyleSet }] = useStyleSet(); const { autostart = false, autoloop = false, image: { url: imageURL = '' } = {}, media = [] } = content; diff --git a/packages/bundle/src/adaptiveCards/Attachment/HeroCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/HeroCardContent.tsx index 7cbfa47aca..c12426655b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/HeroCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/HeroCardContent.tsx @@ -1,7 +1,8 @@ import { hooks } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC, useMemo } from 'react'; -import type { DirectLineHeroCard } from 'botframework-webchat-core'; +import React, { useMemo } from 'react'; + +import { type DirectLineHeroCard } from 'botframework-webchat-core'; import AdaptiveCardBuilder from './AdaptiveCardBuilder'; import AdaptiveCardRenderer from './AdaptiveCardRenderer'; @@ -10,13 +11,13 @@ import useStyleOptions from '../../hooks/useStyleOptions'; const { useDirection } = hooks; -type HeroCardContentProps = { +type HeroCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineHeroCard; disabled?: boolean; -}; +}>; -const HeroCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const HeroCardContent = ({ actionPerformedClassName, content, disabled }: HeroCardContentProps) => { const [adaptiveCardsPackage] = useAdaptiveCardsPackage(); const [styleOptions] = useStyleOptions(); const [direction] = useDirection(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/OAuthCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/OAuthCardContent.tsx index 24b6b8fb18..36e6cbb451 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/OAuthCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/OAuthCardContent.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC, useMemo } from 'react'; -import type { DirectLineOAuthCard } from 'botframework-webchat-core'; +import React, { useMemo } from 'react'; +import { type DirectLineOAuthCard } from 'botframework-webchat-core'; import AdaptiveCardBuilder from './AdaptiveCardBuilder'; import AdaptiveCardRenderer from './AdaptiveCardRenderer'; @@ -10,13 +10,13 @@ import useStyleOptions from '../../hooks/useStyleOptions'; const { useDirection } = hooks; -type OAuthCardContentProps = { +type OAuthCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineOAuthCard; disabled?: boolean; -}; +}>; -const OAuthCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const OAuthCardContent = ({ actionPerformedClassName, content, disabled }: OAuthCardContentProps) => { const [adaptiveCardsPackage] = useAdaptiveCardsPackage(); const [direction] = useDirection(); const [styleOptions] = useStyleOptions(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/ReceiptCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/ReceiptCardContent.tsx index efc3a3266d..060f478355 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/ReceiptCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/ReceiptCardContent.tsx @@ -2,8 +2,8 @@ import { hooks } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC, useMemo } from 'react'; -import type { DirectLineReceiptCard } from 'botframework-webchat-core'; +import React, { useMemo } from 'react'; +import { type DirectLineReceiptCard } from 'botframework-webchat-core'; import AdaptiveCardBuilder from './AdaptiveCardBuilder'; import AdaptiveCardRenderer from './AdaptiveCardRenderer'; @@ -16,13 +16,13 @@ function nullOrUndefined(obj) { return obj === null || typeof obj === 'undefined'; } -type ReceiptCardContentProps = { +type ReceiptCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineReceiptCard; disabled?: boolean; -}; +}>; -const ReceiptCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const ReceiptCardContent = ({ actionPerformedClassName, content, disabled }: ReceiptCardContentProps) => { const [adaptiveCardsPackage] = useAdaptiveCardsPackage(); const [direction] = useDirection(); const [styleOptions] = useStyleOptions(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx index 637fd73981..0a5d33348b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/SignInCardContent.tsx @@ -1,17 +1,17 @@ import PropTypes from 'prop-types'; -import React, { FC } from 'react'; -import type { DirectLineSignInCard } from 'botframework-webchat-core'; +import React from 'react'; +import { type DirectLineSignInCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; import useStyleSet from '../../hooks/useStyleSet'; -type SignInCardContentProps = { +type SignInCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineSignInCard; disabled?: boolean; -}; +}>; -const SignInCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const SignInCardContent = ({ actionPerformedClassName, content, disabled }: SignInCardContentProps) => { const [{ animationCardAttachment: animationCardAttachmentStyleSet }] = useStyleSet(); return ( diff --git a/packages/bundle/src/adaptiveCards/Attachment/ThumbnailCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/ThumbnailCardContent.tsx index 085de2d2b2..c14743ed79 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/ThumbnailCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/ThumbnailCardContent.tsx @@ -2,8 +2,8 @@ import { hooks } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC, useMemo } from 'react'; -import type { DirectLineThumbnailCard } from 'botframework-webchat-core'; +import React, { useMemo } from 'react'; +import { type DirectLineThumbnailCard } from 'botframework-webchat-core'; import AdaptiveCardBuilder from './AdaptiveCardBuilder'; import AdaptiveCardRenderer from './AdaptiveCardRenderer'; @@ -12,13 +12,13 @@ import useStyleOptions from '../../hooks/useStyleOptions'; const { useDirection } = hooks; -type ThumbnailCardContentProps = { +type ThumbnailCardContentProps = Readonly<{ actionPerformedClassName?: string; content: DirectLineThumbnailCard; disabled?: boolean; -}; +}>; -const ThumbnailCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const ThumbnailCardContent = ({ actionPerformedClassName, content, disabled }: ThumbnailCardContentProps) => { const [adaptiveCardsPackage] = useAdaptiveCardsPackage(); const [direction] = useDirection(); const [styleOptions] = useStyleOptions(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx b/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx index d2e24cfbe6..2b1f41ea8b 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx +++ b/packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx @@ -2,26 +2,28 @@ import { Components } from 'botframework-webchat-component'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; -import type { DirectLineVideoCard } from 'botframework-webchat-core'; +import React from 'react'; +import { type DirectLineVideoCard } from 'botframework-webchat-core'; import CommonCard from './CommonCard'; import useStyleSet from '../../hooks/useStyleSet'; const { VideoContent } = Components; -type VideoCardContentProps = { +type VideoCardContentProps = Readonly<{ actionPerformedClassName?: string; - content: DirectLineVideoCard & { - autoloop?: boolean; - autostart?: boolean; - image?: { url?: string }; - media?: { profile?: string; url?: string }[]; - }; + content: Readonly< + DirectLineVideoCard & { + autoloop?: boolean; + autostart?: boolean; + image?: { url?: string }; + media?: { profile?: string; url?: string }[]; + } + >; disabled?: boolean; -}; +}>; -const VideoCardContent: FC = ({ actionPerformedClassName, content, disabled }) => { +const VideoCardContent = ({ actionPerformedClassName, content, disabled }: VideoCardContentProps) => { const { autoloop, autostart, image: { url: imageURL } = { url: undefined }, media } = content; const [{ audioCardAttachment: audioCardAttachmentStyleSet }] = useStyleSet(); diff --git a/packages/bundle/src/adaptiveCards/Attachment/private/renderAdaptiveCard.ts b/packages/bundle/src/adaptiveCards/Attachment/private/renderAdaptiveCard.ts index a41cc32e71..515c6fae9e 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/private/renderAdaptiveCard.ts +++ b/packages/bundle/src/adaptiveCards/Attachment/private/renderAdaptiveCard.ts @@ -1,8 +1,8 @@ -import type { - AdaptiveCard, - GlobalSettings as GlobalSettingsType, - HostConfig as HostConfigType, - IMarkdownProcessingResult +import { + type AdaptiveCard, + type GlobalSettings as GlobalSettingsType, + type HostConfig as HostConfigType, + type IMarkdownProcessingResult } from 'adaptivecards'; /** diff --git a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/addEventListenerWithUndo.ts b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/addEventListenerWithUndo.ts index 3a1dfbd164..e1d59eb4df 100644 --- a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/addEventListenerWithUndo.ts +++ b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/addEventListenerWithUndo.ts @@ -1,6 +1,6 @@ import noOp from './private/noOp'; -import type { UndoFunction } from './types/UndoFunction'; +import { type UndoFunction } from './types/UndoFunction'; /** * Listens to event. Returns a function, when called, will stop listening. diff --git a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/bunchUndos.tsx b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/bunchUndos.tsx index b676850e87..f09b62d192 100644 --- a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/bunchUndos.tsx +++ b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/bunchUndos.tsx @@ -1,4 +1,4 @@ -import type { UndoFunction } from './types/UndoFunction'; +import { type UndoFunction } from './types/UndoFunction'; export default function bunchUndos(fns: UndoFunction[]): UndoFunction { let called: boolean; diff --git a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableAddClassWithUndo.ts b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableAddClassWithUndo.ts index b07ccad5c4..fc102be3f4 100644 --- a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableAddClassWithUndo.ts +++ b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableAddClassWithUndo.ts @@ -1,7 +1,7 @@ import { addClass } from './private/addClass'; import noOp from './private/noOp'; -import type { UndoFunction } from './types/UndoFunction'; +import { type UndoFunction } from './types/UndoFunction'; /** * Adds a class to the `HTMLElement` and re-add on mutations. diff --git a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableDisableInputElementAccessiblyWithUndo.ts b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableDisableInputElementAccessiblyWithUndo.ts index e7bcec6e4b..55a94590b6 100644 --- a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableDisableInputElementAccessiblyWithUndo.ts +++ b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/durableDisableInputElementAccessiblyWithUndo.ts @@ -3,7 +3,7 @@ import bunchUndos from './bunchUndos'; import noOp from './private/noOp'; import setOrRemoveAttributeIfFalseWithUndo from './setOrRemoveAttributeIfFalseWithUndo'; -import type { UndoFunction } from './types/UndoFunction'; +import { type UndoFunction } from './types/UndoFunction'; /** * An event handler for disabling event bubbling and propagation. diff --git a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/setOrRemoveAttributeIfFalseWithUndo.ts b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/setOrRemoveAttributeIfFalseWithUndo.ts index a75f5156e1..214d412085 100644 --- a/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/setOrRemoveAttributeIfFalseWithUndo.ts +++ b/packages/bundle/src/adaptiveCards/DOMManipulationWithUndo/setOrRemoveAttributeIfFalseWithUndo.ts @@ -2,7 +2,7 @@ import getAttributeOrFalse from './private/getAttributeOrFalse'; import noOp from './private/noOp'; import setOrRemoveAttributeIfFalse from './private/setOrRemoveAttributeIfFalse'; -import type { UndoFunction } from './types/UndoFunction'; +import { type UndoFunction } from './types/UndoFunction'; /** * Sets or removes an attribute from an element with an undo function. diff --git a/packages/bundle/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts b/packages/bundle/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts index e6f1a7bd81..8d0ed3b7fb 100644 --- a/packages/bundle/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts +++ b/packages/bundle/src/adaptiveCards/Styles/StyleSet/AdaptiveCardRenderer.ts @@ -1,4 +1,4 @@ -import FullBundleStyleOptions from '../../../types/FullBundleStyleOptions'; +import type FullBundleStyleOptions from '../../../types/FullBundleStyleOptions'; export default function ({ cardPushButtonBackgroundColor, diff --git a/packages/bundle/src/adaptiveCards/Styles/adaptiveCardHostConfig.ts b/packages/bundle/src/adaptiveCards/Styles/adaptiveCardHostConfig.ts index 736ad97073..53d2436b9e 100644 --- a/packages/bundle/src/adaptiveCards/Styles/adaptiveCardHostConfig.ts +++ b/packages/bundle/src/adaptiveCards/Styles/adaptiveCardHostConfig.ts @@ -1,6 +1,6 @@ import { normalizeStyleOptions } from 'botframework-webchat-api'; -import FullBundleStyleOptions from '../../types/FullBundleStyleOptions'; +import type FullBundleStyleOptions from '../../types/FullBundleStyleOptions'; import normalizeAdaptiveCardsStyleOptions from '../normalizeStyleOptions'; // https://docs.microsoft.com/en-us/adaptive-cards/rendering-cards/host-config diff --git a/packages/bundle/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.ts b/packages/bundle/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.ts index 85e48f396a..a1549c070d 100644 --- a/packages/bundle/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.ts +++ b/packages/bundle/src/adaptiveCards/Styles/createAdaptiveCardsStyleSet.ts @@ -1,4 +1,4 @@ -import { normalizeStyleOptions, StrictStyleOptions, StyleOptions } from 'botframework-webchat-api'; +import { normalizeStyleOptions, type StrictStyleOptions, type StyleOptions } from 'botframework-webchat-api'; import { type AdaptiveCardsStyleOptions, type StrictAdaptiveCardsStyleOptions } from '../AdaptiveCardsStyleOptions'; import { type AdaptiveCardsStyleSet } from '../AdaptiveCardsStyleSet'; diff --git a/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.tsx b/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.tsx index 3fcd849b10..f4150b138e 100644 --- a/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.tsx +++ b/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware.tsx @@ -1,4 +1,4 @@ -import { AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api'; +import { type AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api'; import React from 'react'; import AdaptiveCardAttachment from './AttachmentForScreenReader/AdaptiveCardAttachment'; diff --git a/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx b/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx index a831f7d2e7..3a5abe6e8c 100644 --- a/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx +++ b/packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { AttachmentMiddleware } from 'botframework-webchat-api'; +import { type AttachmentMiddleware } from 'botframework-webchat-api'; import AdaptiveCardAttachment from './Attachment/AdaptiveCardAttachment'; import AnimationCardAttachment from './Attachment/AnimationCardAttachment'; diff --git a/packages/bundle/src/codeHighlighter/ShikiComposer.tsx b/packages/bundle/src/codeHighlighter/ShikiComposer.tsx index 4ddad77b7f..c897158b81 100644 --- a/packages/bundle/src/codeHighlighter/ShikiComposer.tsx +++ b/packages/bundle/src/codeHighlighter/ShikiComposer.tsx @@ -1,5 +1,5 @@ import { CodeHighlighterComposer, type HighlightCodeFn } from 'botframework-webchat-component/internal'; -import React, { memo, ReactNode, useEffect, useState } from 'react'; +import React, { memo, type ReactNode, useEffect, useState } from 'react'; import { type HighlighterCore } from 'shiki'; import createHighlighter from './shiki'; diff --git a/packages/bundle/src/createBrowserWebSpeechPonyfillFactory.ts b/packages/bundle/src/createBrowserWebSpeechPonyfillFactory.ts index 1982e759e3..ed5c0cb2c4 100644 --- a/packages/bundle/src/createBrowserWebSpeechPonyfillFactory.ts +++ b/packages/bundle/src/createBrowserWebSpeechPonyfillFactory.ts @@ -1,4 +1,4 @@ -import { WebSpeechPonyfill } from 'botframework-webchat-api'; +import { type WebSpeechPonyfill } from 'botframework-webchat-api'; export default function createBrowserWebSpeechPonyfillFactory(): () => WebSpeechPonyfill { if (!window.SpeechRecognition && !window.webkitSpeechRecognition) { diff --git a/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts b/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts index 70a93c1523..aa5d35b79c 100644 --- a/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts +++ b/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts @@ -1,11 +1,11 @@ -import { WebSpeechPonyfillFactory } from 'botframework-webchat-api'; -import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk'; +import { type WebSpeechPonyfillFactory } from 'botframework-webchat-api'; +import { type AudioConfig } from 'microsoft-cognitiveservices-speech-sdk'; import { createSpeechServicesPonyfill } from 'web-speech-cognitive-services'; import createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext'; -import CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat'; -import CognitiveServicesCredentials from './types/CognitiveServicesCredentials'; -import CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization'; +import type CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat'; +import type CognitiveServicesCredentials from './types/CognitiveServicesCredentials'; +import type CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization'; export default function createCognitiveServicesSpeechServicesPonyfillFactory({ audioConfig, diff --git a/packages/bundle/src/createDirectLineSpeechAdapters.ts b/packages/bundle/src/createDirectLineSpeechAdapters.ts index 51ccb4aa49..a3b1b758df 100644 --- a/packages/bundle/src/createDirectLineSpeechAdapters.ts +++ b/packages/bundle/src/createDirectLineSpeechAdapters.ts @@ -1,12 +1,12 @@ import { createAdapters } from 'botframework-directlinespeech-sdk'; -import { WebSpeechPonyfill } from 'botframework-webchat-api'; -import type { DirectLineJSBotConnection } from 'botframework-webchat-core'; -import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk'; +import { type WebSpeechPonyfill } from 'botframework-webchat-api'; +import { type DirectLineJSBotConnection } from 'botframework-webchat-core'; +import { type AudioConfig } from 'microsoft-cognitiveservices-speech-sdk'; import createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext'; -import CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat'; -import CognitiveServicesCredentials from './types/CognitiveServicesCredentials'; -import CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization'; +import type CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat'; +import type CognitiveServicesCredentials from './types/CognitiveServicesCredentials'; +import type CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization'; const DEFAULT_LANGUAGE = 'en-US'; diff --git a/packages/bundle/src/createFullStyleSet.ts b/packages/bundle/src/createFullStyleSet.ts index 148ce5f6fa..4e40322c17 100644 --- a/packages/bundle/src/createFullStyleSet.ts +++ b/packages/bundle/src/createFullStyleSet.ts @@ -1,7 +1,7 @@ import { createStyleSet } from 'botframework-webchat-component'; import createAdaptiveCardsStyleSet from './adaptiveCards/Styles/createAdaptiveCardsStyleSet'; -import FullBundleStyleOptions from './types/FullBundleStyleOptions'; +import type FullBundleStyleOptions from './types/FullBundleStyleOptions'; // TODO: [P4] We should add a notice for people who want to use "styleSet" instead of "styleOptions". // "styleSet" is actually CSS stylesheet and it is based on the DOM tree. diff --git a/packages/bundle/src/fullBundleDefaultStyleOptions.ts b/packages/bundle/src/fullBundleDefaultStyleOptions.ts index 1d33057848..3dbe3fb080 100644 --- a/packages/bundle/src/fullBundleDefaultStyleOptions.ts +++ b/packages/bundle/src/fullBundleDefaultStyleOptions.ts @@ -1,7 +1,7 @@ import { defaultStyleOptions } from 'botframework-webchat-api'; import adaptiveCardsDefaultStyleOptions from './adaptiveCards/defaultStyleOptions'; -import FullBundleStyleOptions from './types/FullBundleStyleOptions'; +import type FullBundleStyleOptions from './types/FullBundleStyleOptions'; const fullBundleDefaultStyleOptions: Required = { ...defaultStyleOptions, diff --git a/packages/bundle/src/hooks/useStyleOptions.ts b/packages/bundle/src/hooks/useStyleOptions.ts index 0e64053a3f..912aa3015d 100644 --- a/packages/bundle/src/hooks/useStyleOptions.ts +++ b/packages/bundle/src/hooks/useStyleOptions.ts @@ -1,6 +1,6 @@ import { hooks } from 'botframework-webchat-component'; -import { StrictFullBundleStyleOptions } from '../types/FullBundleStyleOptions'; +import { type StrictFullBundleStyleOptions } from '../types/FullBundleStyleOptions'; export default function useStyleOptions(): [StrictFullBundleStyleOptions] { const [styleOptions] = hooks.useStyleOptions(); diff --git a/packages/bundle/src/markdown/mathExtension/math.ts b/packages/bundle/src/markdown/mathExtension/math.ts index 8b57182a30..233f6d00b2 100644 --- a/packages/bundle/src/markdown/mathExtension/math.ts +++ b/packages/bundle/src/markdown/mathExtension/math.ts @@ -1,4 +1,4 @@ -import type { Construct, Extension } from 'micromark-util-types'; +import { type Construct, type Extension } from 'micromark-util-types'; import { BACKSLASH, DOLLAR } from './constants'; import makeConstructTokenizer from './tokenizer'; diff --git a/packages/bundle/src/markdown/renderMarkdown.ts b/packages/bundle/src/markdown/renderMarkdown.ts index 3bb9a182ba..ded5ad501f 100644 --- a/packages/bundle/src/markdown/renderMarkdown.ts +++ b/packages/bundle/src/markdown/renderMarkdown.ts @@ -9,7 +9,7 @@ import { micromark } from 'micromark'; import { gfm, gfmHtml } from 'micromark-extension-gfm'; import { math, mathHtml } from './mathExtension'; -import betterLinkDocumentMod, { BetterLinkDocumentModDecoration } from './private/betterLinkDocumentMod'; +import betterLinkDocumentMod, { type BetterLinkDocumentModDecoration } from './private/betterLinkDocumentMod'; import iterateLinkDefinitions from './private/iterateLinkDefinitions'; import { pre as respectCRLFPre } from './private/respectCRLF'; diff --git a/packages/bundle/src/module/exports-minimal.ts b/packages/bundle/src/module/exports-minimal.ts index 246ac57436..ac6c7a63d1 100644 --- a/packages/bundle/src/module/exports-minimal.ts +++ b/packages/bundle/src/module/exports-minimal.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions, StyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions, type StyleOptions } from 'botframework-webchat-api'; import * as apiDecorator from 'botframework-webchat-api/decorator'; import { WebChatDecorator } from 'botframework-webchat-component/decorator'; import { Constants, createStore, createStoreWithDevTools, createStoreWithOptions } from 'botframework-webchat-core'; diff --git a/packages/bundle/src/module/exports.ts b/packages/bundle/src/module/exports.ts index ea1a5cff41..eb2c14d190 100644 --- a/packages/bundle/src/module/exports.ts +++ b/packages/bundle/src/module/exports.ts @@ -30,7 +30,8 @@ import { import renderMarkdown from '../markdown/renderMarkdown'; import coreRenderWebChat from '../renderWebChat'; import { type AdaptiveCardsPackage } from '../types/AdaptiveCardsPackage'; -import FullBundleStyleOptions, { StrictFullBundleStyleOptions } from '../types/FullBundleStyleOptions'; +import { type StrictFullBundleStyleOptions } from '../types/FullBundleStyleOptions'; +import type FullBundleStyleOptions from '../types/FullBundleStyleOptions'; const renderWebChat = coreRenderWebChat.bind(null, ReactWebChat); diff --git a/packages/bundle/src/renderWebChat.tsx b/packages/bundle/src/renderWebChat.tsx index a702bdd147..efde7e95c8 100644 --- a/packages/bundle/src/renderWebChat.tsx +++ b/packages/bundle/src/renderWebChat.tsx @@ -1,4 +1,4 @@ -import React, { ComponentType } from 'react'; +import React, { type ComponentType } from 'react'; import ReactDOM from 'react-dom'; export default function renderWebChat(ReactWebChat: ComponentType, props: any, element: HTMLElement): void { diff --git a/packages/bundle/src/speech/CustomAudioInputStream.ts b/packages/bundle/src/speech/CustomAudioInputStream.ts index 764d23385d..2c10916096 100644 --- a/packages/bundle/src/speech/CustomAudioInputStream.ts +++ b/packages/bundle/src/speech/CustomAudioInputStream.ts @@ -2,7 +2,6 @@ import { AudioInputStream } from 'microsoft-cognitiveservices-speech-sdk'; import { AudioSourceErrorEvent, - AudioSourceEvent, AudioSourceInitializingEvent, AudioSourceOffEvent, AudioSourceReadyEvent, @@ -11,15 +10,16 @@ import { AudioStreamNodeDetachedEvent, AudioStreamNodeErrorEvent, Events, - EventSource + EventSource, + type AudioSourceEvent } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/Exports'; import { AudioStreamFormatImpl } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioStreamFormat'; import { connectivity as Connectivity, - ISpeechConfigAudioDevice, - type as Type + type as Type, + type ISpeechConfigAudioDevice } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Exports'; import { isForbiddenPropertyName, withResolvers } from 'botframework-webchat-core'; diff --git a/packages/bundle/src/speech/createAudioConfig.ts b/packages/bundle/src/speech/createAudioConfig.ts index bd9f1b6e56..b067f3b534 100644 --- a/packages/bundle/src/speech/createAudioConfig.ts +++ b/packages/bundle/src/speech/createAudioConfig.ts @@ -3,7 +3,7 @@ import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk'; -import CustomAudioInputStream, { AudioStreamNode, DeviceInfo, Format } from './CustomAudioInputStream'; +import CustomAudioInputStream, { type AudioStreamNode, type DeviceInfo, type Format } from './CustomAudioInputStream'; type AttachFunction = (audioNodeId: string) => Promise<{ audioStreamNode: AudioStreamNode; diff --git a/packages/bundle/src/speech/createMicrophoneAudioConfigAndAudioContext.ts b/packages/bundle/src/speech/createMicrophoneAudioConfigAndAudioContext.ts index f87743856c..a5dd4d344f 100644 --- a/packages/bundle/src/speech/createMicrophoneAudioConfigAndAudioContext.ts +++ b/packages/bundle/src/speech/createMicrophoneAudioConfigAndAudioContext.ts @@ -1,7 +1,7 @@ import { ChunkedArrayBufferStream } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/Exports'; import { PcmRecorder } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/Exports'; -import { AudioStreamNode, DeviceInfo, Format } from './CustomAudioInputStream'; +import { type AudioStreamNode, type DeviceInfo, type Format } from './CustomAudioInputStream'; import bytesPerSample from './bytesPerSample'; import createAudioConfig from './createAudioConfig'; import createAudioContext from './createAudioContext'; diff --git a/packages/bundle/src/types/AdaptiveCardsPackage.ts b/packages/bundle/src/types/AdaptiveCardsPackage.ts index 6a19938960..f43feed328 100644 --- a/packages/bundle/src/types/AdaptiveCardsPackage.ts +++ b/packages/bundle/src/types/AdaptiveCardsPackage.ts @@ -1,12 +1,12 @@ import { - AdaptiveCard, - GlobalSettings, - HorizontalAlignment, - HostConfig, - SerializationContext, - TextSize, - TextWeight, - Version + type AdaptiveCard, + type GlobalSettings, + type HorizontalAlignment, + type HostConfig, + type SerializationContext, + type TextSize, + type TextWeight, + type Version } from 'adaptivecards'; type AdaptiveCardsPackage = { diff --git a/packages/bundle/src/types/FullBundleStyleOptions.ts b/packages/bundle/src/types/FullBundleStyleOptions.ts index efed1f43cf..c5a57f7fba 100644 --- a/packages/bundle/src/types/FullBundleStyleOptions.ts +++ b/packages/bundle/src/types/FullBundleStyleOptions.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions, StyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions, type StyleOptions } from 'botframework-webchat-api'; import { type AdaptiveCardsStyleOptions, diff --git a/packages/bundle/src/useComposerProps.ts b/packages/bundle/src/useComposerProps.ts index e7eca3b7a9..20ab02bf7e 100644 --- a/packages/bundle/src/useComposerProps.ts +++ b/packages/bundle/src/useComposerProps.ts @@ -1,4 +1,4 @@ -import { AttachmentForScreenReaderMiddleware, AttachmentMiddleware } from 'botframework-webchat-api'; +import { type AttachmentForScreenReaderMiddleware, type AttachmentMiddleware } from 'botframework-webchat-api'; import { type HTMLContentTransformMiddleware } from 'botframework-webchat-component'; import { useMemo } from 'react'; diff --git a/packages/component/src/Activity/Avatar.tsx b/packages/component/src/Activity/Avatar.tsx index e58673f589..3d31504bb7 100644 --- a/packages/component/src/Activity/Avatar.tsx +++ b/packages/component/src/Activity/Avatar.tsx @@ -1,16 +1,16 @@ import PropTypes from 'prop-types'; -import React, { VFC } from 'react'; +import React from 'react'; import { DefaultAvatar } from '../Middleware/Avatar/createCoreMiddleware'; -type AvatarProps = { +type AvatarProps = Readonly<{ 'aria-hidden'?: boolean; className?: string; fromUser?: boolean; -}; +}>; /** @deprecated Please use `useRenderAvatar` hook instead. */ -const Avatar: VFC = ({ 'aria-hidden': ariaHidden, className, fromUser }) => { +const Avatar = ({ 'aria-hidden': ariaHidden, className, fromUser }: AvatarProps) => { console.warn( 'botframework-webchat: component is deprecated and will be removed on or after 2022-02-25. Please use `useRenderAvatar` hook instead.' ); diff --git a/packages/component/src/Activity/Bubble.tsx b/packages/component/src/Activity/Bubble.tsx index df6db61196..b7041440c0 100644 --- a/packages/component/src/Activity/Bubble.tsx +++ b/packages/component/src/Activity/Bubble.tsx @@ -3,7 +3,7 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC, ReactNode, memo } from 'react'; +import React, { memo, type ReactNode } from 'react'; import isZeroOrPositive from '../Utils/isZeroOrPositive'; import useStyleSet from '../hooks/useStyleSet'; @@ -62,15 +62,15 @@ function acuteNubSVG(nubSize, strokeWidth, side, upSideDown = false) { ); } -type BubbleProps = { +type BubbleProps = Readonly<{ 'aria-hidden'?: boolean; - children?: ReactNode; + children?: ReactNode | undefined; className?: string; fromUser?: boolean; nub?: boolean | 'hidden'; -}; +}>; -const Bubble: FC = ({ 'aria-hidden': ariaHidden, children, className, fromUser, nub }) => { +const Bubble = ({ 'aria-hidden': ariaHidden, children, className, fromUser, nub }: BubbleProps) => { const [{ bubble: bubbleStyleSet }] = useStyleSet(); const [direction] = useDirection(); const [ diff --git a/packages/component/src/Activity/Speak.tsx b/packages/component/src/Activity/Speak.tsx index e28d6fad40..f12622caed 100644 --- a/packages/component/src/Activity/Speak.tsx +++ b/packages/component/src/Activity/Speak.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-api'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import PropTypes from 'prop-types'; -import React, { FC, memo, useCallback, useMemo } from 'react'; +import React, { memo, useCallback, useMemo } from 'react'; import ReactSay, { SayUtterance } from 'react-say'; import SayAlt from './SayAlt'; @@ -17,7 +17,7 @@ type SpeakProps = { activity: WebChatActivity; }; -const Speak: FC = ({ activity }) => { +const Speak = ({ activity }: SpeakProps) => { const [{ showSpokenText }] = useStyleOptions(); const markActivityAsSpoken = useMarkActivityAsSpoken(); const selectVoice = useVoiceSelector(activity); diff --git a/packages/component/src/Activity/StackedLayout.tsx b/packages/component/src/Activity/StackedLayout.tsx index 66591c34ad..8bf7ccfb88 100644 --- a/packages/component/src/Activity/StackedLayout.tsx +++ b/packages/component/src/Activity/StackedLayout.tsx @@ -13,9 +13,9 @@ import { useStyleToEmotionObject } from '../hooks/internal/styleToEmotionObject' import useUniqueId from '../hooks/internal/useUniqueId'; import Bubble from './Bubble'; -import type { RenderAttachment } from 'botframework-webchat-api'; +import { type RenderAttachment } from 'botframework-webchat-api'; import { getActivityLivestreamingMetadata, type WebChatActivity } from 'botframework-webchat-core'; -import type { ReactNode } from 'react'; +import { type ReactNode } from 'react'; const { useAvatarForBot, useAvatarForUser, useLocalizer, useStyleOptions } = hooks; diff --git a/packages/component/src/ActivityStatus/OthersActivityStatus.tsx b/packages/component/src/ActivityStatus/OthersActivityStatus.tsx index 6ab15ed222..28c767482c 100644 --- a/packages/component/src/ActivityStatus/OthersActivityStatus.tsx +++ b/packages/component/src/ActivityStatus/OthersActivityStatus.tsx @@ -1,11 +1,11 @@ import { getOrgSchemaMessage, - OrgSchemaAction, - OrgSchemaProject, parseAction, parseClaim, - warnOnce, - type WebChatActivity + type OrgSchemaAction, + type OrgSchemaProject, + type WebChatActivity, + warnOnce } from 'botframework-webchat-core'; import classNames from 'classnames'; import React, { memo, useMemo, type ReactNode } from 'react'; diff --git a/packages/component/src/ActivityStatus/SendStatus/SendStatus.tsx b/packages/component/src/ActivityStatus/SendStatus/SendStatus.tsx index d99e8ec64b..f2ebd9ff09 100644 --- a/packages/component/src/ActivityStatus/SendStatus/SendStatus.tsx +++ b/packages/component/src/ActivityStatus/SendStatus/SendStatus.tsx @@ -1,24 +1,24 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC, useCallback } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import React, { useCallback } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { SENDING, SEND_FAILED, SENT } from '../../types/internal/SendStatus'; import SendFailedRetry from './private/SendFailedRetry'; import useFocus from '../../hooks/useFocus'; import useStyleSet from '../../hooks/useStyleSet'; -import type { SendStatus as SendStatusType } from '../../types/internal/SendStatus'; +import { type SendStatus as SendStatusType } from '../../types/internal/SendStatus'; const { useLocalizer, usePostActivity } = hooks; -type SendStatusProps = { +type SendStatusProps = Readonly<{ activity: WebChatActivity; sendStatus: SendStatusType; -}; +}>; -const SendStatus: FC = ({ activity, sendStatus }) => { +const SendStatus = ({ activity, sendStatus }: SendStatusProps) => { const [{ sendStatus: sendStatusStyleSet }] = useStyleSet(); const focus = useFocus(); const localize = useLocalizer(); diff --git a/packages/component/src/ActivityStatus/Slotted.tsx b/packages/component/src/ActivityStatus/Slotted.tsx index 1c0506eca0..e3c6a71589 100644 --- a/packages/component/src/ActivityStatus/Slotted.tsx +++ b/packages/component/src/ActivityStatus/Slotted.tsx @@ -1,7 +1,10 @@ -import React, { Children, Fragment, memo, type PropsWithChildren } from 'react'; +import React, { Children, Fragment, memo, type ReactNode } from 'react'; import classNames from 'classnames'; -type Props = Readonly>; +type Props = Readonly<{ + children?: ReactNode | undefined; + className?: string; +}>; const Slotted = memo(({ children, className }: Props) => ( diff --git a/packages/component/src/ActivityStatus/Timestamp.tsx b/packages/component/src/ActivityStatus/Timestamp.tsx index e811618976..cf13d8b1e6 100644 --- a/packages/component/src/ActivityStatus/Timestamp.tsx +++ b/packages/component/src/ActivityStatus/Timestamp.tsx @@ -1,17 +1,17 @@ import { hooks } from 'botframework-webchat-api'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import AbsoluteTime from './AbsoluteTime'; import RelativeTime from './private/RelativeTime'; const { useStyleOptions } = hooks; -type TimestampProps = { +type TimestampProps = Readonly<{ timestamp: string; -}; +}>; -const Timestamp: FC = ({ timestamp }) => { +const Timestamp = ({ timestamp }: TimestampProps) => { const [{ timestampFormat }] = useStyleOptions(); return timestampFormat === 'relative' ? : ; diff --git a/packages/component/src/ActivityStatus/private/Feedback/Feedback.tsx b/packages/component/src/ActivityStatus/private/Feedback/Feedback.tsx index b5686dc31f..61a3bad33f 100644 --- a/packages/component/src/ActivityStatus/private/Feedback/Feedback.tsx +++ b/packages/component/src/ActivityStatus/private/Feedback/Feedback.tsx @@ -1,17 +1,16 @@ import { hooks } from 'botframework-webchat-api'; import { type OrgSchemaAction } from 'botframework-webchat-core'; -import React, { Fragment, memo, useEffect, useState, type PropsWithChildren } from 'react'; +import React, { Fragment, memo, useEffect, useState, type ReactNode } from 'react'; import { useRefFrom } from 'use-ref-from'; import FeedbackVoteButton from './private/VoteButton'; const { usePonyfill, usePostActivity } = hooks; -type Props = Readonly< - PropsWithChildren<{ - actions: ReadonlySet; - }> ->; +type Props = Readonly<{ + actions: ReadonlySet; + children?: ReactNode | undefined; +}>; const DEBOUNCE_TIMEOUT = 500; diff --git a/packages/component/src/Attachment/AudioContent.tsx b/packages/component/src/Attachment/AudioContent.tsx index 05c92a6450..2fea5625c4 100644 --- a/packages/component/src/Attachment/AudioContent.tsx +++ b/packages/component/src/Attachment/AudioContent.tsx @@ -1,17 +1,17 @@ import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import useStyleSet from '../hooks/useStyleSet'; -type AudioContentProps = { +type AudioContentProps = Readonly<{ alt?: string; autoPlay?: boolean; loop?: boolean; poster?: string; src: string; -}; +}>; -const AudioContent: FC = ({ alt, autoPlay, loop, src }) => { +const AudioContent = ({ alt, autoPlay, loop, src }: AudioContentProps) => { const [{ audioContent: audioContentStyleSet }] = useStyleSet(); return ( diff --git a/packages/component/src/Attachment/FileContent.tsx b/packages/component/src/Attachment/FileContent.tsx index e5aaf7bffb..610c83f044 100644 --- a/packages/component/src/Attachment/FileContent.tsx +++ b/packages/component/src/Attachment/FileContent.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import DownloadIcon from './Assets/DownloadIcon'; import useStyleSet from '../hooks/useStyleSet'; @@ -34,7 +34,13 @@ function isAllowedProtocol(url) { } } -const FileContentBadge = ({ downloadIcon, fileName, size }) => { +type FileContentBadgeProps = Readonly<{ + downloadIcon?: boolean; + fileName: string; + size?: number; +}>; + +const FileContentBadge = ({ downloadIcon, fileName, size }: FileContentBadgeProps) => { const [direction] = useDirection(); const formatByte = useByteFormatter(); @@ -70,14 +76,14 @@ FileContentBadge.propTypes = { size: PropTypes.number }; -type FileContentProps = { +type FileContentProps = Readonly<{ className?: string; fileName: string; href?: string; size?: number; -}; +}>; -const FileContent: FC = ({ className, href, fileName, size }) => { +const FileContent = ({ className, href, fileName, size }: FileContentProps) => { const [{ fileContent: fileContentStyleSet }] = useStyleSet(); const localize = useLocalizer(); const localizeBytes = useByteFormatter(); diff --git a/packages/component/src/Attachment/HTMLVideoContent.tsx b/packages/component/src/Attachment/HTMLVideoContent.tsx index dcd7e8aabc..7d2ef6e121 100644 --- a/packages/component/src/Attachment/HTMLVideoContent.tsx +++ b/packages/component/src/Attachment/HTMLVideoContent.tsx @@ -1,17 +1,17 @@ import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import useStyleSet from '../hooks/useStyleSet'; -type HTMLVideoContentProps = { +type HTMLVideoContentProps = Readonly<{ alt?: string; autoPlay?: boolean; loop?: boolean; poster?: string; src: string; -}; +}>; -const HTMLVideoContent: FC = ({ alt, autoPlay, loop, poster, src }) => { +const HTMLVideoContent = ({ alt, autoPlay, loop, poster, src }: HTMLVideoContentProps) => { const [{ videoContent: videoContentStyleSet }] = useStyleSet(); return ( diff --git a/packages/component/src/Attachment/Text/TextAttachment.tsx b/packages/component/src/Attachment/Text/TextAttachment.tsx index 5788029d45..79b707fff0 100644 --- a/packages/component/src/Attachment/Text/TextAttachment.tsx +++ b/packages/component/src/Attachment/Text/TextAttachment.tsx @@ -1,5 +1,5 @@ import { type WebChatActivity } from 'botframework-webchat-core'; -import React, { memo, type FC } from 'react'; +import React, { memo } from 'react'; import { type WebChatAttachment } from '../private/types/WebChatAttachment'; import TextContent from './TextContent'; @@ -11,7 +11,7 @@ type Props = Readonly<{ }; }>; -const TextAttachment: FC = memo(({ activity, attachment: { content, contentType } }: Props) => ( +const TextAttachment = memo(({ activity, attachment: { content, contentType } }: Props) => ( )); diff --git a/packages/component/src/Attachment/Text/private/CodeContent.tsx b/packages/component/src/Attachment/Text/private/CodeContent.tsx index 3a720909c9..33e3816039 100644 --- a/packages/component/src/Attachment/Text/private/CodeContent.tsx +++ b/packages/component/src/Attachment/Text/private/CodeContent.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import React, { Fragment, memo, ReactNode } from 'react'; +import React, { Fragment, memo, type ReactNode } from 'react'; import useCodeBlockTag from '../../../providers/CustomElements/useCodeBlockTagName'; diff --git a/packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx b/packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx index b5bdbc2d73..a6cd043337 100644 --- a/packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx +++ b/packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx @@ -7,7 +7,7 @@ import { type WebChatActivity } from 'botframework-webchat-core'; import classNames from 'classnames'; -import type { Definition } from 'mdast'; +import { type Definition } from 'mdast'; import { fromMarkdown } from 'mdast-util-from-markdown'; import React, { memo, useCallback, useMemo, useRef, type MouseEventHandler, type ReactNode } from 'react'; import { useRefFrom } from 'use-ref-from'; diff --git a/packages/component/src/Attachment/VideoContent.tsx b/packages/component/src/Attachment/VideoContent.tsx index 8872d91229..64b44b5ff3 100644 --- a/packages/component/src/Attachment/VideoContent.tsx +++ b/packages/component/src/Attachment/VideoContent.tsx @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import HTMLVideoContent from './HTMLVideoContent'; import VimeoContent from './VimeoContent'; @@ -30,15 +30,15 @@ function parseURL(url) { return { hostname, pathname, search }; } -type VideoContentProps = { +type VideoContentProps = Readonly<{ alt?: string; autoPlay?: boolean; loop?: boolean; poster?: string; src: string; -}; +}>; -const VideoContent: FC = ({ alt, autoPlay, loop, poster, src }) => { +const VideoContent = ({ alt, autoPlay, loop, poster, src }: VideoContentProps) => { const { hostname, pathname, search } = parseURL(src); const lastSegment = pathname.split('/').pop(); const searchParams = new URLSearchParams(search); diff --git a/packages/component/src/Attachment/VimeoContent.tsx b/packages/component/src/Attachment/VimeoContent.tsx index 1a1dd474d2..212a3cce2b 100644 --- a/packages/component/src/Attachment/VimeoContent.tsx +++ b/packages/component/src/Attachment/VimeoContent.tsx @@ -1,19 +1,19 @@ import { hooks } from 'botframework-webchat-api'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import useStyleSet from '../hooks/useStyleSet'; const { useLocalizer } = hooks; -type VimeoContentProps = { +type VimeoContentProps = Readonly<{ alt?: string; autoPlay?: boolean; embedID: string; loop?: boolean; -}; +}>; -const VimeoContent: FC = ({ alt, autoPlay, embedID, loop }) => { +const VimeoContent = ({ alt, autoPlay, embedID, loop }: VimeoContentProps) => { const [{ vimeoContent: vimeoContentStyleSet }] = useStyleSet(); const localize = useLocalizer(); diff --git a/packages/component/src/Attachment/YouTubeContent.tsx b/packages/component/src/Attachment/YouTubeContent.tsx index e07c6a5f72..1e77bcdcf2 100644 --- a/packages/component/src/Attachment/YouTubeContent.tsx +++ b/packages/component/src/Attachment/YouTubeContent.tsx @@ -1,19 +1,19 @@ import { hooks } from 'botframework-webchat-api'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import useStyleSet from '../hooks/useStyleSet'; const { useLocalizer } = hooks; -type YouTubeContentProps = { +type YouTubeContentProps = Readonly<{ alt?: string; autoPlay?: boolean; embedID: string; loop?: boolean; -}; +}>; -const YouTubeContent: FC = ({ alt, autoPlay, embedID, loop }) => { +const YouTubeContent = ({ alt, autoPlay, embedID, loop }: YouTubeContentProps) => { const [{ youTubeContent: youTubeContentStyleSet }] = useStyleSet(); const localize = useLocalizer(); diff --git a/packages/component/src/Attachment/private/types/WebChatAttachment.ts b/packages/component/src/Attachment/private/types/WebChatAttachment.ts index fb49ffa418..7407bde6fb 100644 --- a/packages/component/src/Attachment/private/types/WebChatAttachment.ts +++ b/packages/component/src/Attachment/private/types/WebChatAttachment.ts @@ -1,4 +1,4 @@ -import { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { type TypeOfArray } from '../../../types/internal/TypeOfArray'; diff --git a/packages/component/src/BasicTranscript.tsx b/packages/component/src/BasicTranscript.tsx index b0ad34abf6..ecdb74a01b 100644 --- a/packages/component/src/BasicTranscript.tsx +++ b/packages/component/src/BasicTranscript.tsx @@ -1,3 +1,4 @@ +import { type WebChatActivity } from 'botframework-webchat-core'; import { hooks } from 'botframework-webchat-api'; import { Composer as ReactScrollToBottomComposer, @@ -11,11 +12,17 @@ import { } from 'react-scroll-to-bottom'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { forwardRef, Fragment, memo, useCallback, useMemo, useRef } from 'react'; - -import type { ActivityElementMap } from './Transcript/types'; -import type { FC, KeyboardEventHandler, MutableRefObject, ReactNode } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import React, { + forwardRef, + Fragment, + memo, + useCallback, + useMemo, + useRef, + type KeyboardEventHandler, + type MutableRefObject, + type ReactNode +} from 'react'; import { android } from './Utils/detectBrowser'; import BasicTypingIndicator from './BasicTypingIndicator'; @@ -49,6 +56,7 @@ import { type TranscriptScrollRelativeOptions } from './hooks/transcriptScrollRelative'; import useNonce from './hooks/internal/useNonce'; +import { type ActivityElementMap } from './Transcript/types'; const { useActivityKeys, @@ -568,18 +576,18 @@ InternalTranscript.propTypes = { className: PropTypes.string }; -type InternalTranscriptScrollableProps = { - children?: ReactNode; +type InternalTranscriptScrollableProps = Readonly<{ + children?: ReactNode | undefined; onFocusFiller: () => void; terminatorRef: MutableRefObject; -}; +}>; // Separating high-frequency hooks to improve performance. -const InternalTranscriptScrollable: FC = ({ +const InternalTranscriptScrollable = ({ children, onFocusFiller, terminatorRef -}) => { +}: InternalTranscriptScrollableProps) => { const [{ activities: activitiesStyleSet }] = useStyleSet(); const [animatingToEnd]: [boolean] = useAnimatingToEnd(); const [atEnd]: [boolean] = useAtEnd(); @@ -840,7 +848,7 @@ type BasicTranscriptProps = { className?: string; }; -const BasicTranscript: FC = ({ className }) => { +const BasicTranscript = ({ className }: BasicTranscriptProps) => { const activityElementMapRef = useRef(new Map()); const containerRef = useRef(); diff --git a/packages/component/src/BasicWebChat.tsx b/packages/component/src/BasicWebChat.tsx index 85909e07c2..0c177caca8 100644 --- a/packages/component/src/BasicWebChat.tsx +++ b/packages/component/src/BasicWebChat.tsx @@ -4,7 +4,7 @@ import { SendBoxMiddlewareProxy, hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import BasicConnectivityStatus from './BasicConnectivityStatus'; import BasicToaster from './BasicToaster'; @@ -39,12 +39,12 @@ const TRANSCRIPT_STYLE = { // Subset of landmark roles: https://w3.org/TR/wai-aria/#landmark_roles const ARIA_LANDMARK_ROLES = ['complementary', 'contentinfo', 'form', 'main', 'region']; -type BasicWebChatProps = { +type BasicWebChatProps = Readonly<{ className?: string; role?: 'complementary' | 'contentinfo' | 'form' | 'main' | 'region'; -}; +}>; -const BasicWebChat: FC = ({ className, role }) => { +const BasicWebChat = ({ className, role }: BasicWebChatProps) => { const [{ root: rootStyleSet }] = useStyleSet(); const [options] = useStyleOptions(); const styleToEmotionObject = useStyleToEmotionObject(); diff --git a/packages/component/src/Composer.tsx b/packages/component/src/Composer.tsx index 7847f5917f..10e85f3e34 100644 --- a/packages/component/src/Composer.tsx +++ b/packages/component/src/Composer.tsx @@ -1,14 +1,12 @@ -import type { - ComposerProps as APIComposerProps, - SendBoxMiddleware, - SendBoxToolbarMiddleware -} from 'botframework-webchat-api'; import { Composer as APIComposer, hooks, initSendBoxMiddleware, initSendBoxToolbarMiddleware, - WebSpeechPonyfillFactory + type ComposerProps as APIComposerProps, + type SendBoxMiddleware, + type SendBoxToolbarMiddleware, + type WebSpeechPonyfillFactory } from 'botframework-webchat-api'; import { DecoratorComposer } from 'botframework-webchat-api/decorator'; import { singleToArray } from 'botframework-webchat-core'; @@ -116,7 +114,7 @@ const ComposerCoreUI = memo(({ children }: ComposerCoreUIProps) => { ComposerCoreUI.displayName = 'ComposerCoreUI'; type ComposerCoreProps = Readonly<{ - children?: ReactNode; + children?: ReactNode | undefined; extraStyleSet?: any; htmlContentTransformMiddleware?: readonly HTMLContentTransformMiddleware[] | undefined; nonce?: string; diff --git a/packages/component/src/ErrorBox.tsx b/packages/component/src/ErrorBox.tsx index 0c462d06c1..f31bfa210e 100644 --- a/packages/component/src/ErrorBox.tsx +++ b/packages/component/src/ErrorBox.tsx @@ -2,19 +2,19 @@ import { hooks } from 'botframework-webchat-api'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import ScreenReaderText from './ScreenReaderText'; import useStyleSet from './hooks/useStyleSet'; const { useLocalizer } = hooks; -type ErrorBoxProps = { +type ErrorBoxProps = Readonly<{ error: Error; type?: string; -}; +}>; -const ErrorBox: FC = ({ error, type }) => { +const ErrorBox = ({ error, type }: ErrorBoxProps) => { const [{ errorBox: errorBoxStyleSet }] = useStyleSet(); const localize = useLocalizer(); diff --git a/packages/component/src/LiveRegion/LiveRegionActivity.tsx b/packages/component/src/LiveRegion/LiveRegionActivity.tsx index 8fd87e3aa8..84bf7b09dd 100644 --- a/packages/component/src/LiveRegion/LiveRegionActivity.tsx +++ b/packages/component/src/LiveRegion/LiveRegionActivity.tsx @@ -11,8 +11,7 @@ import LiveRegionSuggestedActions from './private/LiveRegionSuggestedActions'; import useRenderMarkdownAsHTML from '../hooks/useRenderMarkdownAsHTML'; import { useStyleToEmotionObject } from '../hooks/internal/styleToEmotionObject'; -import type { VFC } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; const { useAvatarForBot, useLocalizer } = hooks; @@ -29,11 +28,11 @@ const ROOT_STYLE = { } }; -type LiveRegionActivityProps = { +type LiveRegionActivityProps = Readonly<{ activity: WebChatActivity; -}; +}>; -const LiveRegionActivity: VFC = ({ activity }) => { +const LiveRegionActivity = ({ activity }: LiveRegionActivityProps) => { const [{ initials: botInitials }] = useAvatarForBot(); const { from: { role }, diff --git a/packages/component/src/LiveRegion/private/LiveRegionSuggestedActions.tsx b/packages/component/src/LiveRegion/private/LiveRegionSuggestedActions.tsx index 39f37bdfcc..8ab7fe367c 100644 --- a/packages/component/src/LiveRegion/private/LiveRegionSuggestedActions.tsx +++ b/packages/component/src/LiveRegion/private/LiveRegionSuggestedActions.tsx @@ -3,14 +3,13 @@ import React from 'react'; import computeSuggestedActionText from '../../Utils/computeSuggestedActionText'; -import type { DirectLineSuggestedAction } from 'botframework-webchat-core'; -import type { VFC } from 'react'; +import { type DirectLineSuggestedAction } from 'botframework-webchat-core'; -type LiveRegionSuggestedActionsProps = { - suggestedActions: DirectLineSuggestedAction; -}; +type LiveRegionSuggestedActionsProps = Readonly<{ + suggestedActions: Readonly; +}>; -const LiveRegionSuggestedActions: VFC = ({ suggestedActions }) => +const LiveRegionSuggestedActions = ({ suggestedActions }: LiveRegionSuggestedActionsProps) => suggestedActions.actions?.length && (

{suggestedActions.actions.map((action, index) => ( diff --git a/packages/component/src/Middleware/Activity/createCoreMiddleware.tsx b/packages/component/src/Middleware/Activity/createCoreMiddleware.tsx index ca3e01002b..143cc61ddd 100644 --- a/packages/component/src/Middleware/Activity/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/Activity/createCoreMiddleware.tsx @@ -1,4 +1,4 @@ -import { ActivityMiddleware } from 'botframework-webchat-api'; +import { type ActivityMiddleware } from 'botframework-webchat-api'; import React from 'react'; import { getActivityLivestreamingMetadata } from 'botframework-webchat-core'; diff --git a/packages/component/src/Middleware/ActivityStatus/createCoreMiddleware.tsx b/packages/component/src/Middleware/ActivityStatus/createCoreMiddleware.tsx index a6e5d18540..e7fb3df51f 100644 --- a/packages/component/src/Middleware/ActivityStatus/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/ActivityStatus/createCoreMiddleware.tsx @@ -1,7 +1,7 @@ import createSendStatusMiddleware from './createSendStatusMiddleware'; import createTimestampMiddleware from './createTimestampMiddleware'; -import type { ActivityStatusMiddleware } from 'botframework-webchat-api'; +import { type ActivityStatusMiddleware } from 'botframework-webchat-api'; export default function createCoreMiddleware(): ActivityStatusMiddleware[] { return [createSendStatusMiddleware(), createTimestampMiddleware()]; diff --git a/packages/component/src/Middleware/ActivityStatus/createSendStatusMiddleware.tsx b/packages/component/src/Middleware/ActivityStatus/createSendStatusMiddleware.tsx index 7ba633061c..d5d60b7318 100644 --- a/packages/component/src/Middleware/ActivityStatus/createSendStatusMiddleware.tsx +++ b/packages/component/src/Middleware/ActivityStatus/createSendStatusMiddleware.tsx @@ -1,4 +1,4 @@ -import { ActivityStatusMiddleware } from 'botframework-webchat-api'; +import { type ActivityStatusMiddleware } from 'botframework-webchat-api'; import React from 'react'; import { SENDING, SEND_FAILED } from '../../types/internal/SendStatus'; diff --git a/packages/component/src/Middleware/ActivityStatus/createTimestampMiddleware.tsx b/packages/component/src/Middleware/ActivityStatus/createTimestampMiddleware.tsx index ea8896988f..40b9a07d7e 100644 --- a/packages/component/src/Middleware/ActivityStatus/createTimestampMiddleware.tsx +++ b/packages/component/src/Middleware/ActivityStatus/createTimestampMiddleware.tsx @@ -1,4 +1,4 @@ -import { ActivityStatusMiddleware } from 'botframework-webchat-api'; +import { type ActivityStatusMiddleware } from 'botframework-webchat-api'; import React, { Fragment } from 'react'; import AbsoluteTime from '../../ActivityStatus/AbsoluteTime'; diff --git a/packages/component/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx b/packages/component/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx index c74c55424c..09654a65ad 100644 --- a/packages/component/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx @@ -1,4 +1,4 @@ -import { AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api'; +import { type AttachmentForScreenReaderMiddleware } from 'botframework-webchat-api'; import React from 'react'; import AudioAttachment from './AudioAttachment'; diff --git a/packages/component/src/Middleware/Avatar/createCoreMiddleware.tsx b/packages/component/src/Middleware/Avatar/createCoreMiddleware.tsx index 07863132f0..3ba4d64beb 100644 --- a/packages/component/src/Middleware/Avatar/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/Avatar/createCoreMiddleware.tsx @@ -1,7 +1,7 @@ -import { AvatarMiddleware } from 'botframework-webchat-api'; +import { type AvatarMiddleware } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import ImageAvatar from '../../Avatar/ImageAvatar'; import InitialsAvatar from '../../Avatar/InitialsAvatar'; @@ -19,13 +19,13 @@ const ROOT_STYLE = { } }; -type DefaultAvatarProps = { +type DefaultAvatarProps = Readonly<{ 'aria-hidden'?: boolean; className?: string; fromUser: boolean; -}; +}>; -const DefaultAvatar: FC = ({ 'aria-hidden': ariaHidden, className, fromUser }) => { +const DefaultAvatar = ({ 'aria-hidden': ariaHidden, className, fromUser }: DefaultAvatarProps) => { const [{ avatar: avatarStyleSet }] = useStyleSet(); const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + ''; diff --git a/packages/component/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts b/packages/component/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts index 060befaec3..d869796502 100644 --- a/packages/component/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts +++ b/packages/component/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts @@ -1,4 +1,4 @@ -import { ScrollToEndButtonMiddleware } from 'botframework-webchat-api'; +import { type ScrollToEndButtonMiddleware } from 'botframework-webchat-api'; import ScrollToEndButton from './ScrollToEndButton'; diff --git a/packages/component/src/Middleware/Toast/createCoreMiddleware.tsx b/packages/component/src/Middleware/Toast/createCoreMiddleware.tsx index d75d0db6ab..faf1a12b73 100644 --- a/packages/component/src/Middleware/Toast/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/Toast/createCoreMiddleware.tsx @@ -1,4 +1,4 @@ -import { ToastMiddleware } from 'botframework-webchat-api'; +import { type ToastMiddleware } from 'botframework-webchat-api'; import createToastMiddleware from '../../Toast/createToastMiddleware'; diff --git a/packages/component/src/Middleware/TypingIndicator/createCoreMiddleware.tsx b/packages/component/src/Middleware/TypingIndicator/createCoreMiddleware.tsx index e711878eb4..7de961acfb 100644 --- a/packages/component/src/Middleware/TypingIndicator/createCoreMiddleware.tsx +++ b/packages/component/src/Middleware/TypingIndicator/createCoreMiddleware.tsx @@ -1,4 +1,4 @@ -import { hooks, TypingIndicatorMiddleware } from 'botframework-webchat-api'; +import { hooks, type TypingIndicatorMiddleware } from 'botframework-webchat-api'; import classNames from 'classnames'; import React from 'react'; diff --git a/packages/component/src/ReactWebChat.tsx b/packages/component/src/ReactWebChat.tsx index 2103379247..0b7811298b 100644 --- a/packages/component/src/ReactWebChat.tsx +++ b/packages/component/src/ReactWebChat.tsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import BasicWebChat from './BasicWebChat'; -import Composer, { ComposerProps } from './Composer'; +import Composer, { type ComposerProps } from './Composer'; // Please keep this file as simple as possible. This is for setting up the surface (a.k.a. ) and only. @@ -28,10 +28,12 @@ const ReactWebChat = ({ className, role, ...composerProps }: ReactWebChatProps) ); +const { children: __, ...composerDefaultProps } = Composer.defaultProps; + ReactWebChat.defaultProps = { className: undefined, role: undefined, - ...Composer.defaultProps + ...composerDefaultProps }; const { diff --git a/packages/component/src/ScreenReaderText.tsx b/packages/component/src/ScreenReaderText.tsx index a5b0802a52..c5d57b8e35 100644 --- a/packages/component/src/ScreenReaderText.tsx +++ b/packages/component/src/ScreenReaderText.tsx @@ -3,8 +3,6 @@ import PropTypes from 'prop-types'; import React, { forwardRef, memo } from 'react'; -import type { VFC } from 'react'; - import { useStyleToEmotionObject } from './hooks/internal/styleToEmotionObject'; const ROOT_STYLE = { @@ -23,13 +21,13 @@ const ROOT_STYLE = { width: 1 }; -type ScreenReaderTextProps = { +type ScreenReaderTextProps = Readonly<{ 'aria-hidden'?: boolean; id?: string; text: string; -}; +}>; -const ScreenReaderText: VFC = forwardRef( +const ScreenReaderText = forwardRef( ({ 'aria-hidden': ariaHidden, id, text }, ref) => { const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + ''; diff --git a/packages/component/src/SendBox/AutoResizeTextArea.tsx b/packages/component/src/SendBox/AutoResizeTextArea.tsx index cf59b83d2c..9587e35581 100644 --- a/packages/component/src/SendBox/AutoResizeTextArea.tsx +++ b/packages/component/src/SendBox/AutoResizeTextArea.tsx @@ -1,10 +1,10 @@ import classNames from 'classnames'; import React, { - ChangeEventHandler, - FocusEventHandler, forwardRef, - KeyboardEventHandler, - ReactEventHandler + type ChangeEventHandler, + type FocusEventHandler, + type KeyboardEventHandler, + type ReactEventHandler } from 'react'; import AccessibleTextArea from '../Utils/AccessibleTextArea'; diff --git a/packages/component/src/SendBox/BasicSendBox.tsx b/packages/component/src/SendBox/BasicSendBox.tsx index e4acd9b869..9fee91a8df 100644 --- a/packages/component/src/SendBox/BasicSendBox.tsx +++ b/packages/component/src/SendBox/BasicSendBox.tsx @@ -1,7 +1,7 @@ import { SendBoxToolbarMiddlewareProxy, hooks } from 'botframework-webchat-api'; import { Constants } from 'botframework-webchat-core'; import classNames from 'classnames'; -import React, { FC } from 'react'; +import React from 'react'; import { useStyleToEmotionObject } from '../hooks/internal/styleToEmotionObject'; import useStyleSet from '../hooks/useStyleSet'; @@ -13,7 +13,7 @@ import SendButton from './SendButton'; import SuggestedActions from './SuggestedActions'; import TextBox from './TextBox'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; const { DictateState: { DICTATING, STARTING } @@ -50,7 +50,7 @@ type BasicSendBoxProps = Readonly<{ className?: string; }>; -const BasicSendBox: FC = ({ className }) => { +const BasicSendBox = ({ className }: BasicSendBoxProps) => { const [{ sendBoxButtonAlignment }] = useStyleOptions(); const [{ sendBox: sendBoxStyleSet }] = useStyleSet(); const [{ SpeechRecognition = undefined } = {}] = useWebSpeechPonyfill(); diff --git a/packages/component/src/SendBox/DictationInterims.tsx b/packages/component/src/SendBox/DictationInterims.tsx index ff69dd9c42..1e0246396f 100644 --- a/packages/component/src/SendBox/DictationInterims.tsx +++ b/packages/component/src/SendBox/DictationInterims.tsx @@ -4,7 +4,7 @@ import { Constants } from 'botframework-webchat-core'; import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC } from 'react'; +import React from 'react'; import useStyleSet from '../hooks/useStyleSet'; import { useStyleToEmotionObject } from '../hooks/internal/styleToEmotionObject'; @@ -24,7 +24,7 @@ type DictationInterimsProps = { className?: string; }; -const DictationInterims: FC = ({ className }) => { +const DictationInterims = ({ className }: DictationInterimsProps) => { const [dictateInterims] = useDictateInterims(); const [dictateState] = useDictateState(); const [{ dictationInterims: dictationInterimsStyleSet }] = useStyleSet(); diff --git a/packages/component/src/SendBox/IconButton.tsx b/packages/component/src/SendBox/IconButton.tsx index 4c1ee33960..c9a48c184c 100644 --- a/packages/component/src/SendBox/IconButton.tsx +++ b/packages/component/src/SendBox/IconButton.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { FC, MouseEventHandler, ReactNode, useRef } from 'react'; +import React, { type ReactNode, type MouseEventHandler, useRef } from 'react'; import AccessibleButton from '../Utils/AccessibleButton'; import useFocusVisible from '../hooks/internal/useFocusVisible'; @@ -9,15 +9,15 @@ import useStyleSet from '../hooks/useStyleSet'; const { useStyleOptions } = hooks; -type IconButtonProps = { +type IconButtonProps = Readonly<{ alt?: string; - children?: ReactNode; + children?: ReactNode | undefined; className?: string; disabled?: boolean; onClick?: MouseEventHandler; -}; +}>; -const IconButton: FC = ({ alt, children, className, disabled, onClick }) => { +const IconButton = ({ alt, children, className, disabled, onClick }: IconButtonProps) => { const [{ sendBoxButton: sendBoxButtonStyleSet }] = useStyleSet(); const [{ sendBoxButtonAlignment }] = useStyleOptions(); const buttonRef = useRef(); diff --git a/packages/component/src/SendBox/SendButton.tsx b/packages/component/src/SendBox/SendButton.tsx index f4feab786f..a0def2c0cc 100644 --- a/packages/component/src/SendBox/SendButton.tsx +++ b/packages/component/src/SendBox/SendButton.tsx @@ -7,15 +7,13 @@ import useSubmit from '../providers/internal/SendBox/useSubmit'; import SendIcon from './Assets/SendIcon'; import IconButton from './IconButton'; -import type { FC } from 'react'; - const { useLocalizer, useUIState } = hooks; -type SendButtonProps = { +type SendButtonProps = Readonly<{ className?: string; -}; +}>; -const SendButton: FC = ({ className }) => { +const SendButton = ({ className }: SendButtonProps) => { const [uiState] = useUIState(); const localize = useLocalizer(); const submit = useSubmit(); diff --git a/packages/component/src/SendBox/SuggestedAction.tsx b/packages/component/src/SendBox/SuggestedAction.tsx index 21b4244c32..fcaedcc6d0 100644 --- a/packages/component/src/SendBox/SuggestedAction.tsx +++ b/packages/component/src/SendBox/SuggestedAction.tsx @@ -1,8 +1,8 @@ import { hooks } from 'botframework-webchat-api'; -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { MouseEventHandler, useCallback, VFC } from 'react'; +import React, { type MouseEventHandler, useCallback } from 'react'; import useFocusVisible from '../hooks/internal/useFocusVisible'; import useLocalizeAccessKey from '../hooks/internal/useLocalizeAccessKey'; @@ -47,7 +47,7 @@ type SuggestedActionProps = { value?: any; }; -const SuggestedAction: VFC = ({ +const SuggestedAction = ({ buttonText, className, displayText, @@ -58,7 +58,7 @@ const SuggestedAction: VFC = ({ textClassName, type, value -}) => { +}: SuggestedActionProps) => { const [_, setSuggestedActions] = useSuggestedActions(); const [{ suggestedActionsStackedLayoutButtonTextWrap }] = useStyleOptions(); const [{ suggestedAction: suggestedActionStyleSet }] = useStyleSet(); diff --git a/packages/component/src/SendBox/SuggestedActions.tsx b/packages/component/src/SendBox/SuggestedActions.tsx index be26f7cdf0..8d4ce6284c 100644 --- a/packages/component/src/SendBox/SuggestedActions.tsx +++ b/packages/component/src/SendBox/SuggestedActions.tsx @@ -3,7 +3,7 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React, { useCallback, useMemo, useRef } from 'react'; +import React, { useCallback, useMemo, useRef, type ReactNode } from 'react'; // eslint-disable-next-line import/no-named-as-default import BasicFilm, { createBasicStyleSet as createBasicStyleSetForReactFilm } from 'react-film'; @@ -120,7 +120,13 @@ SuggestedActionCarouselContainer.propTypes = { label: PropTypes.string.isRequired }; -const SuggestedActionFlowContainer = ({ children, className, label }) => { +type SuggestedActionFlowContainerProps = Readonly<{ + children?: ReactNode | undefined; + className?: string | undefined; + label: string; +}>; + +const SuggestedActionFlowContainer = ({ children, className, label }: SuggestedActionFlowContainerProps) => { const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet(); const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + ''; diff --git a/packages/component/src/SendBox/TextBox.tsx b/packages/component/src/SendBox/TextBox.tsx index df2be620f7..ceac1746cc 100644 --- a/packages/component/src/SendBox/TextBox.tsx +++ b/packages/component/src/SendBox/TextBox.tsx @@ -14,7 +14,7 @@ import useSubmit from '../providers/internal/SendBox/useSubmit'; import withEmoji from '../withEmoji/withEmoji'; import AutoResizeTextArea from './AutoResizeTextArea'; -import type { MutableRefObject } from 'react'; +import { type MutableRefObject } from 'react'; import testIds from '../testIds'; const { useLocalizer, usePonyfill, useSendBoxValue, useStopDictate, useStyleOptions, useUIState } = hooks; diff --git a/packages/component/src/Styles/StyleSet/AutoResizeTextArea.ts b/packages/component/src/Styles/StyleSet/AutoResizeTextArea.ts index 5d97d283ce..e9b0e9190e 100644 --- a/packages/component/src/Styles/StyleSet/AutoResizeTextArea.ts +++ b/packages/component/src/Styles/StyleSet/AutoResizeTextArea.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function AutoResizeTextArea({ primaryFont }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/Avatar.ts b/packages/component/src/Styles/StyleSet/Avatar.ts index 5d89af0a73..2707423fe7 100644 --- a/packages/component/src/Styles/StyleSet/Avatar.ts +++ b/packages/component/src/Styles/StyleSet/Avatar.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import CSSTokens from '../CSSTokens'; export default function createAvatarStyle({ avatarBorderRadius }: StrictStyleOptions) { diff --git a/packages/component/src/Styles/StyleSet/BasicTranscript.ts b/packages/component/src/Styles/StyleSet/BasicTranscript.ts index 0e63129a9c..9d232642ca 100644 --- a/packages/component/src/Styles/StyleSet/BasicTranscript.ts +++ b/packages/component/src/Styles/StyleSet/BasicTranscript.ts @@ -1,6 +1,6 @@ /* eslint no-magic-numbers: ["error", { "ignore": [2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createBasicTranscriptStyleSet({ paddingRegular, diff --git a/packages/component/src/Styles/StyleSet/Bubble.ts b/packages/component/src/Styles/StyleSet/Bubble.ts index 7efa2a7eca..aa94079719 100644 --- a/packages/component/src/Styles/StyleSet/Bubble.ts +++ b/packages/component/src/Styles/StyleSet/Bubble.ts @@ -1,5 +1,5 @@ /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import mirrorStyle from '../mirrorStyle'; diff --git a/packages/component/src/Styles/StyleSet/CarouselFilmStrip.ts b/packages/component/src/Styles/StyleSet/CarouselFilmStrip.ts index 4899db8dbe..044673d914 100644 --- a/packages/component/src/Styles/StyleSet/CarouselFilmStrip.ts +++ b/packages/component/src/Styles/StyleSet/CarouselFilmStrip.ts @@ -1,5 +1,5 @@ /* eslint no-magic-numbers: ["error", { "ignore": [2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import CSSTokens from '../CSSTokens'; import mirrorStyle from '../mirrorStyle'; diff --git a/packages/component/src/Styles/StyleSet/CarouselFilmStripAttachment.ts b/packages/component/src/Styles/StyleSet/CarouselFilmStripAttachment.ts index caa5ccb7fc..0d3900a990 100644 --- a/packages/component/src/Styles/StyleSet/CarouselFilmStripAttachment.ts +++ b/packages/component/src/Styles/StyleSet/CarouselFilmStripAttachment.ts @@ -1,5 +1,5 @@ /* eslint no-magic-numbers: ["error", { "ignore": [2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import CSSTokens from '../CSSTokens'; import mirrorStyle from '../mirrorStyle'; diff --git a/packages/component/src/Styles/StyleSet/CarouselFlipper.ts b/packages/component/src/Styles/StyleSet/CarouselFlipper.ts index 289b017a83..6c4108e216 100644 --- a/packages/component/src/Styles/StyleSet/CarouselFlipper.ts +++ b/packages/component/src/Styles/StyleSet/CarouselFlipper.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function CarouselFlipper({ transcriptOverlayButtonBackground, diff --git a/packages/component/src/Styles/StyleSet/ConnectivityNotification.ts b/packages/component/src/Styles/StyleSet/ConnectivityNotification.ts index 751b1243f8..9cfdc0d947 100644 --- a/packages/component/src/Styles/StyleSet/ConnectivityNotification.ts +++ b/packages/component/src/Styles/StyleSet/ConnectivityNotification.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function ConnectivityNotification({ connectivityMarginLeftRight, diff --git a/packages/component/src/Styles/StyleSet/DictationInterims.ts b/packages/component/src/Styles/StyleSet/DictationInterims.ts index d9f7dbd157..e25e29941d 100644 --- a/packages/component/src/Styles/StyleSet/DictationInterims.ts +++ b/packages/component/src/Styles/StyleSet/DictationInterims.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createDictationInterimsStyle({ paddingRegular, primaryFont }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/ErrorBox.ts b/packages/component/src/Styles/StyleSet/ErrorBox.ts index f2b8f2c700..b9f45de7c2 100644 --- a/packages/component/src/Styles/StyleSet/ErrorBox.ts +++ b/packages/component/src/Styles/StyleSet/ErrorBox.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createErrorBoxStyle({ monospaceFont, primaryFont }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/ErrorNotification.ts b/packages/component/src/Styles/StyleSet/ErrorNotification.ts index a0349ace69..1719bdbbd0 100644 --- a/packages/component/src/Styles/StyleSet/ErrorNotification.ts +++ b/packages/component/src/Styles/StyleSet/ErrorNotification.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createErrorNotificationStyle({ connectivityIconPadding, diff --git a/packages/component/src/Styles/StyleSet/FileContent.ts b/packages/component/src/Styles/StyleSet/FileContent.ts index 98e1743593..76af192c13 100644 --- a/packages/component/src/Styles/StyleSet/FileContent.ts +++ b/packages/component/src/Styles/StyleSet/FileContent.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createFileContentStyle({ accent, diff --git a/packages/component/src/Styles/StyleSet/InitialsAvatar.ts b/packages/component/src/Styles/StyleSet/InitialsAvatar.ts index c2fc6f9495..71f467c6f7 100644 --- a/packages/component/src/Styles/StyleSet/InitialsAvatar.ts +++ b/packages/component/src/Styles/StyleSet/InitialsAvatar.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import CSSTokens from '../CSSTokens'; export default function createInitialsAvatarStyle({ diff --git a/packages/component/src/Styles/StyleSet/MicrophoneButton.ts b/packages/component/src/Styles/StyleSet/MicrophoneButton.ts index 9b24bc6b09..4742a06245 100644 --- a/packages/component/src/Styles/StyleSet/MicrophoneButton.ts +++ b/packages/component/src/Styles/StyleSet/MicrophoneButton.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createMicrophoneButtonStyle({ microphoneButtonColorOnDictate }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/Root.ts b/packages/component/src/Styles/StyleSet/Root.ts index f7f5e0a344..4a9ec35eb0 100644 --- a/packages/component/src/Styles/StyleSet/Root.ts +++ b/packages/component/src/Styles/StyleSet/Root.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function ({ backgroundColor, diff --git a/packages/component/src/Styles/StyleSet/ScrollToEndButton.ts b/packages/component/src/Styles/StyleSet/ScrollToEndButton.ts index 2d9548c087..8e959ee67d 100644 --- a/packages/component/src/Styles/StyleSet/ScrollToEndButton.ts +++ b/packages/component/src/Styles/StyleSet/ScrollToEndButton.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createScrollToEndButtonStyle({ paddingRegular, diff --git a/packages/component/src/Styles/StyleSet/SendBox.ts b/packages/component/src/Styles/StyleSet/SendBox.ts index 76ea01c0fc..a3c612b4df 100644 --- a/packages/component/src/Styles/StyleSet/SendBox.ts +++ b/packages/component/src/Styles/StyleSet/SendBox.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createSendBoxStyle({ sendBoxBackground, diff --git a/packages/component/src/Styles/StyleSet/SendBoxButton.ts b/packages/component/src/Styles/StyleSet/SendBoxButton.ts index b2d329f7b4..44fe84f09e 100644 --- a/packages/component/src/Styles/StyleSet/SendBoxButton.ts +++ b/packages/component/src/Styles/StyleSet/SendBoxButton.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createSendBoxButtonStyle({ sendBoxButtonColor, diff --git a/packages/component/src/Styles/StyleSet/SendBoxTextBox.ts b/packages/component/src/Styles/StyleSet/SendBoxTextBox.ts index f30df4734b..ed33bb4aaf 100644 --- a/packages/component/src/Styles/StyleSet/SendBoxTextBox.ts +++ b/packages/component/src/Styles/StyleSet/SendBoxTextBox.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createSendBoxTextBoxStyle({ paddingRegular, diff --git a/packages/component/src/Styles/StyleSet/SpinnerAnimation.ts b/packages/component/src/Styles/StyleSet/SpinnerAnimation.ts index 293add109a..290d0d36e6 100644 --- a/packages/component/src/Styles/StyleSet/SpinnerAnimation.ts +++ b/packages/component/src/Styles/StyleSet/SpinnerAnimation.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import { toByteArray } from 'base64-js'; diff --git a/packages/component/src/Styles/StyleSet/StackedLayout.ts b/packages/component/src/Styles/StyleSet/StackedLayout.ts index b5ad9b47a9..8ffb422933 100644 --- a/packages/component/src/Styles/StyleSet/StackedLayout.ts +++ b/packages/component/src/Styles/StyleSet/StackedLayout.ts @@ -1,6 +1,6 @@ /* eslint no-magic-numbers: ["error", { "ignore": [2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import CSSTokens from '../CSSTokens'; export default function createStackedLayoutStyle({ diff --git a/packages/component/src/Styles/StyleSet/SuggestedAction.ts b/packages/component/src/Styles/StyleSet/SuggestedAction.ts index 97b4d7d4a2..61f01237c2 100644 --- a/packages/component/src/Styles/StyleSet/SuggestedAction.ts +++ b/packages/component/src/Styles/StyleSet/SuggestedAction.ts @@ -1,6 +1,6 @@ /* eslint no-magic-numbers: "off" */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createSuggestedActionStyle({ accent, diff --git a/packages/component/src/Styles/StyleSet/SuggestedActions.ts b/packages/component/src/Styles/StyleSet/SuggestedActions.ts index d395d460bd..d5fd118f32 100644 --- a/packages/component/src/Styles/StyleSet/SuggestedActions.ts +++ b/packages/component/src/Styles/StyleSet/SuggestedActions.ts @@ -1,7 +1,7 @@ /* eslint no-empty-pattern: "off" */ /* eslint no-magic-numbers: ["error", { "ignore": [1.5, 2] }] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createSuggestedActionsStyle({ paddingRegular, diff --git a/packages/component/src/Styles/StyleSet/Toast.ts b/packages/component/src/Styles/StyleSet/Toast.ts index 6ee99e58be..c35cc1cc13 100644 --- a/packages/component/src/Styles/StyleSet/Toast.ts +++ b/packages/component/src/Styles/StyleSet/Toast.ts @@ -1,5 +1,5 @@ /* eslint no-magic-numbers: ["off"] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createToastStyle({ primaryFont, diff --git a/packages/component/src/Styles/StyleSet/Toaster.ts b/packages/component/src/Styles/StyleSet/Toaster.ts index 42df1c28fb..eddb28690e 100644 --- a/packages/component/src/Styles/StyleSet/Toaster.ts +++ b/packages/component/src/Styles/StyleSet/Toaster.ts @@ -1,6 +1,6 @@ /* eslint no-magic-numbers: ["off"] */ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createToasterStyle({ primaryFont, diff --git a/packages/component/src/Styles/StyleSet/TypingAnimation.ts b/packages/component/src/Styles/StyleSet/TypingAnimation.ts index 132672e61c..e8f0c27293 100644 --- a/packages/component/src/Styles/StyleSet/TypingAnimation.ts +++ b/packages/component/src/Styles/StyleSet/TypingAnimation.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; import { toByteArray } from 'base64-js'; const DEFAULT_IMAGE_BASE64 = diff --git a/packages/component/src/Styles/StyleSet/TypingIndicator.ts b/packages/component/src/Styles/StyleSet/TypingIndicator.ts index 9f964c810f..334240e4ff 100644 --- a/packages/component/src/Styles/StyleSet/TypingIndicator.ts +++ b/packages/component/src/Styles/StyleSet/TypingIndicator.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createTypingIndicatorStyle({ paddingRegular }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/UploadButton.ts b/packages/component/src/Styles/StyleSet/UploadButton.ts index b1136ebde9..2becfbf790 100644 --- a/packages/component/src/Styles/StyleSet/UploadButton.ts +++ b/packages/component/src/Styles/StyleSet/UploadButton.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createUploadButtonStyle({ sendBoxButtonColor, diff --git a/packages/component/src/Styles/StyleSet/VideoContent.ts b/packages/component/src/Styles/StyleSet/VideoContent.ts index 9c23dcda52..f7492d301f 100644 --- a/packages/component/src/Styles/StyleSet/VideoContent.ts +++ b/packages/component/src/Styles/StyleSet/VideoContent.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createVideoContentStyle({ videoHeight }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/VimeoContent.ts b/packages/component/src/Styles/StyleSet/VimeoContent.ts index 02e2764862..276b1a0fb7 100644 --- a/packages/component/src/Styles/StyleSet/VimeoContent.ts +++ b/packages/component/src/Styles/StyleSet/VimeoContent.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createVimeoContentStyle({ videoHeight }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/StyleSet/WarningNotification.ts b/packages/component/src/Styles/StyleSet/WarningNotification.ts index 7ec46b92a6..173aa92490 100644 --- a/packages/component/src/Styles/StyleSet/WarningNotification.ts +++ b/packages/component/src/Styles/StyleSet/WarningNotification.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createWarningNotificationStyle({ connectivityIconPadding, diff --git a/packages/component/src/Styles/StyleSet/YouTubeContent.ts b/packages/component/src/Styles/StyleSet/YouTubeContent.ts index 27cfd14749..6d357298e3 100644 --- a/packages/component/src/Styles/StyleSet/YouTubeContent.ts +++ b/packages/component/src/Styles/StyleSet/YouTubeContent.ts @@ -1,4 +1,4 @@ -import { StrictStyleOptions } from 'botframework-webchat-api'; +import { type StrictStyleOptions } from 'botframework-webchat-api'; export default function createYouTubeContentStyle({ videoHeight }: StrictStyleOptions) { return { diff --git a/packages/component/src/Styles/createStyleSet.ts b/packages/component/src/Styles/createStyleSet.ts index ecf70b65e1..b04a927ec0 100644 --- a/packages/component/src/Styles/createStyleSet.ts +++ b/packages/component/src/Styles/createStyleSet.ts @@ -1,4 +1,4 @@ -import { normalizeStyleOptions, StyleOptions } from 'botframework-webchat-api'; +import { normalizeStyleOptions, type StyleOptions } from 'botframework-webchat-api'; import createActivitiesStyle from './StyleSet/Activities'; import createActivityButtonStyle from './StyleSet/ActivityButton'; diff --git a/packages/component/src/Toast/createToastMiddleware.tsx b/packages/component/src/Toast/createToastMiddleware.tsx index 15b64b2e2c..7e9f99467f 100644 --- a/packages/component/src/Toast/createToastMiddleware.tsx +++ b/packages/component/src/Toast/createToastMiddleware.tsx @@ -1,6 +1,6 @@ /* eslint react/prop-types: "off" */ -import { ToastMiddleware } from 'botframework-webchat-api'; +import { type ToastMiddleware } from 'botframework-webchat-api'; import React from 'react'; import BasicToast from '../BasicToast'; diff --git a/packages/component/src/Transcript/ActivityRow.tsx b/packages/component/src/Transcript/ActivityRow.tsx index da25c9b1f8..67a675d449 100644 --- a/packages/component/src/Transcript/ActivityRow.tsx +++ b/packages/component/src/Transcript/ActivityRow.tsx @@ -12,13 +12,13 @@ import useActivityAccessibleName from './useActivityAccessibleName'; import useFocusByActivityKey from '../providers/TranscriptFocus/useFocusByActivityKey'; import useGetDescendantIdByActivityKey from '../providers/TranscriptFocus/useGetDescendantIdByActivityKey'; -import type { MouseEventHandler, PropsWithChildren } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type MouseEventHandler, type ReactNode } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { useRefFrom } from 'use-ref-from'; const { useActivityKeysByRead, useGetHasAcknowledgedByActivityKey, useGetKeyByActivity } = hooks; -type ActivityRowProps = PropsWithChildren<{ activity: WebChatActivity }>; +type ActivityRowProps = Readonly<{ activity: WebChatActivity; children?: ReactNode | undefined }>; const ActivityRow = forwardRef(({ activity, children }, ref) => { const [activeDescendantId] = useActiveDescendantId(); diff --git a/packages/component/src/Transcript/LiveRegion/isPresentational.ts b/packages/component/src/Transcript/LiveRegion/isPresentational.ts index c2b42a6455..a72c3c35b9 100644 --- a/packages/component/src/Transcript/LiveRegion/isPresentational.ts +++ b/packages/component/src/Transcript/LiveRegion/isPresentational.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; /** * Determines if the rendering activity is presentational or not. diff --git a/packages/component/src/Transcript/LiveRegionTranscript.tsx b/packages/component/src/Transcript/LiveRegionTranscript.tsx index a56adb2524..7d7fec97e2 100644 --- a/packages/component/src/Transcript/LiveRegionTranscript.tsx +++ b/packages/component/src/Transcript/LiveRegionTranscript.tsx @@ -1,6 +1,6 @@ import { hooks } from 'botframework-webchat-api'; -import type { WebChatActivity } from 'botframework-webchat-core'; -import type { RefObject } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; +import { type RefObject } from 'react'; import React, { memo, useEffect, useMemo, useRef } from 'react'; import LiveRegionActivity from '../LiveRegion/LiveRegionActivity'; @@ -12,7 +12,7 @@ import LiveRegionSendFailed from './LiveRegion/SendFailed'; import isPresentational from './LiveRegion/isPresentational'; import useTypistNames from './useTypistNames'; -import type { ActivityElementMap } from './types'; +import { type ActivityElementMap } from './types'; const { useActivities, useGetKeyByActivity, useLocalizer } = hooks; diff --git a/packages/component/src/Transcript/useActivityAccessibleName.ts b/packages/component/src/Transcript/useActivityAccessibleName.ts index 9e3d9d3473..b6b3dd998b 100644 --- a/packages/component/src/Transcript/useActivityAccessibleName.ts +++ b/packages/component/src/Transcript/useActivityAccessibleName.ts @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-api'; import { useEffect, useMemo, useState } from 'react'; -import type { RefObject } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type RefObject } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; import { SEND_FAILED } from '../types/internal/SendStatus'; import activityAltText from '../Utils/activityAltText'; diff --git a/packages/component/src/TranscriptActivity.tsx b/packages/component/src/TranscriptActivity.tsx index 3aef0b65fb..b27eb0c99c 100644 --- a/packages/component/src/TranscriptActivity.tsx +++ b/packages/component/src/TranscriptActivity.tsx @@ -1,8 +1,8 @@ import React, { memo, useCallback, useMemo } from 'react'; import { hooks, type ActivityComponentFactory } from 'botframework-webchat-api'; -import type { ActivityElementMap } from './Transcript/types'; -import type { MutableRefObject, ReactNode } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type ActivityElementMap } from './Transcript/types'; +import { type MutableRefObject, type ReactNode } from 'react'; +import { type WebChatActivity } from 'botframework-webchat-core'; import ActivityRow from './Transcript/ActivityRow'; const { useCreateActivityStatusRenderer } = hooks; diff --git a/packages/component/src/Utils/AccessibleButton.tsx b/packages/component/src/Utils/AccessibleButton.tsx index 24f3280ad9..674f2db8fc 100644 --- a/packages/component/src/Utils/AccessibleButton.tsx +++ b/packages/component/src/Utils/AccessibleButton.tsx @@ -1,7 +1,7 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-1] }] */ import PropTypes from 'prop-types'; -import React, { forwardRef, MouseEventHandler, ReactNode, useRef } from 'react'; +import React, { forwardRef, type MouseEventHandler, type ReactNode, useRef } from 'react'; const PREVENT_DEFAULT_HANDLER = event => event.preventDefault(); diff --git a/packages/component/src/Utils/AccessibleInputText.tsx b/packages/component/src/Utils/AccessibleInputText.tsx index 3e19f3c57d..b496e54859 100644 --- a/packages/component/src/Utils/AccessibleInputText.tsx +++ b/packages/component/src/Utils/AccessibleInputText.tsx @@ -1,11 +1,11 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-1] }] */ import React, { - ChangeEventHandler, - FocusEventHandler, forwardRef, - KeyboardEventHandler, - ReactEventHandler, + type ChangeEventHandler, + type FocusEventHandler, + type KeyboardEventHandler, + type ReactEventHandler, useRef } from 'react'; diff --git a/packages/component/src/Utils/AccessibleTextArea.tsx b/packages/component/src/Utils/AccessibleTextArea.tsx index d239678264..1893e989bf 100644 --- a/packages/component/src/Utils/AccessibleTextArea.tsx +++ b/packages/component/src/Utils/AccessibleTextArea.tsx @@ -2,11 +2,11 @@ import PropTypes from 'prop-types'; import React, { - ChangeEventHandler, - FocusEventHandler, + type ChangeEventHandler, + type FocusEventHandler, forwardRef, - KeyboardEventHandler, - ReactEventHandler, + type KeyboardEventHandler, + type ReactEventHandler, useRef } from 'react'; diff --git a/packages/component/src/Utils/FocusRedirector.tsx b/packages/component/src/Utils/FocusRedirector.tsx index 170e749f2c..b14aef3101 100644 --- a/packages/component/src/Utils/FocusRedirector.tsx +++ b/packages/component/src/Utils/FocusRedirector.tsx @@ -1,7 +1,5 @@ import PropTypes from 'prop-types'; -import React, { useCallback } from 'react'; - -import type { FC, MutableRefObject } from 'react'; +import React, { useCallback, type MutableRefObject } from 'react'; // This is an element, when focused, will send the focus to the ref specified in "redirectRef". // Although the focus is being redirected, browser will scroll this redirector element into view. @@ -12,13 +10,13 @@ import type { FC, MutableRefObject } from 'react'; // When this focus redirector is put inside a scrollable container, you may want to resize or reposition // it to prevent unintentional scroll done by the browser default behavior. -type FocusRedirectorProps = { +type FocusRedirectorProps = Readonly<{ className?: string; onFocus?: () => void; redirectRef?: MutableRefObject; -}; +}>; -const FocusRedirector: FC = ({ className, onFocus, redirectRef }) => { +const FocusRedirector = ({ className, onFocus, redirectRef }: FocusRedirectorProps) => { const handleFocus = useCallback(() => { redirectRef?.current?.focus(); onFocus && onFocus(); diff --git a/packages/component/src/Utils/computeSuggestedActionText.ts b/packages/component/src/Utils/computeSuggestedActionText.ts index 9ccb74d83a..73e456651d 100644 --- a/packages/component/src/Utils/computeSuggestedActionText.ts +++ b/packages/component/src/Utils/computeSuggestedActionText.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; // Please refer to this article to find out how to compute the "button text" for suggested action. // https://github.com/Microsoft/botframework-sdk/blob/main/specs/botframework-activity/botframework-activity.md#card-action diff --git a/packages/component/src/Utils/getActivityUniqueId.ts b/packages/component/src/Utils/getActivityUniqueId.ts index 7e4441d75f..091d9a2d97 100644 --- a/packages/component/src/Utils/getActivityUniqueId.ts +++ b/packages/component/src/Utils/getActivityUniqueId.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; export default function getActivityUniqueId(activity: WebChatActivity): string { return activity?.channelData?.clientActivityID || activity?.id; diff --git a/packages/component/src/hooks/internal/codeHighlighter/private/defaultHighlightCode.tsx b/packages/component/src/hooks/internal/codeHighlighter/private/defaultHighlightCode.tsx index dca0631d2b..64e99f2abb 100644 --- a/packages/component/src/hooks/internal/codeHighlighter/private/defaultHighlightCode.tsx +++ b/packages/component/src/hooks/internal/codeHighlighter/private/defaultHighlightCode.tsx @@ -1,4 +1,4 @@ -import type { HighlightCodeFn } from './CodeHighlighterComposer'; +import { type HighlightCodeFn } from './CodeHighlighterComposer'; export const defaultHighlightCode: HighlightCodeFn = (source, language) => { try { diff --git a/packages/component/src/hooks/internal/useFocusVisible.ts b/packages/component/src/hooks/internal/useFocusVisible.ts index ca0c96fe4e..4e335b2503 100644 --- a/packages/component/src/hooks/internal/useFocusVisible.ts +++ b/packages/component/src/hooks/internal/useFocusVisible.ts @@ -1,4 +1,4 @@ -import { RefObject, useCallback, useEffect, useState } from 'react'; +import { type RefObject, useCallback, useEffect, useState } from 'react'; import useObserveFocusVisible from './useObserveFocusVisible'; diff --git a/packages/component/src/hooks/internal/useFocusWithin.ts b/packages/component/src/hooks/internal/useFocusWithin.ts index cbf5560fd8..25b988969b 100644 --- a/packages/component/src/hooks/internal/useFocusWithin.ts +++ b/packages/component/src/hooks/internal/useFocusWithin.ts @@ -1,6 +1,4 @@ -import { useCallback, useEffect, useState } from 'react'; - -import type { RefObject } from 'react'; +import { type RefObject, useCallback, useEffect, useState } from 'react'; export default function useFocusWithin(targetRef: RefObject): readonly [boolean] { const [focusWithin, setFocusWithin] = useState(false); diff --git a/packages/component/src/hooks/internal/useForceRenderAtInterval.ts b/packages/component/src/hooks/internal/useForceRenderAtInterval.ts index a68b990ec8..b6a90674b4 100644 --- a/packages/component/src/hooks/internal/useForceRenderAtInterval.ts +++ b/packages/component/src/hooks/internal/useForceRenderAtInterval.ts @@ -1,11 +1,10 @@ import { hooks } from 'botframework-webchat-api'; -import { useCallback, useState } from 'react'; +import { type Dispatch, type SetStateAction, useCallback, useState } from 'react'; import random from 'math-random'; import useTimer from './useTimer'; -import type { Dispatch, SetStateAction } from 'react'; -import type { GlobalScopePonyfill } from 'botframework-webchat-core'; +import { type GlobalScopePonyfill } from 'botframework-webchat-core'; const { usePonyfill } = hooks; diff --git a/packages/component/src/hooks/internal/useMemoWithPrevious.ts b/packages/component/src/hooks/internal/useMemoWithPrevious.ts index 31368d5bed..95f618406d 100644 --- a/packages/component/src/hooks/internal/useMemoWithPrevious.ts +++ b/packages/component/src/hooks/internal/useMemoWithPrevious.ts @@ -1,6 +1,4 @@ -import { useEffect, useMemo, useRef } from 'react'; - -import type { DependencyList } from 'react'; +import { type DependencyList, useEffect, useMemo, useRef } from 'react'; export default function useMemoWithPrevious(factory: (prevValue: T) => T, deps: DependencyList): T { const prevValueRef = useRef(); diff --git a/packages/component/src/hooks/internal/useObserveFocusVisible.ts b/packages/component/src/hooks/internal/useObserveFocusVisible.ts index 62cd85431a..3c3e6f4be1 100644 --- a/packages/component/src/hooks/internal/useObserveFocusVisible.ts +++ b/packages/component/src/hooks/internal/useObserveFocusVisible.ts @@ -1,5 +1,5 @@ import { hooks } from 'botframework-webchat-api'; -import { MutableRefObject, RefObject, useCallback, useEffect, useMemo, useRef } from 'react'; +import { type MutableRefObject, type RefObject, useCallback, useEffect, useMemo, useRef } from 'react'; import supportPseudoClass from '../../Utils/supportPseudoClass'; import useNonce from './useNonce'; diff --git a/packages/component/src/hooks/internal/useStateRef.ts b/packages/component/src/hooks/internal/useStateRef.ts index 3d735f7951..ef093d5593 100644 --- a/packages/component/src/hooks/internal/useStateRef.ts +++ b/packages/component/src/hooks/internal/useStateRef.ts @@ -1,6 +1,4 @@ -import { useCallback, useRef, useState } from 'react'; - -import type { Dispatch, MutableRefObject, SetStateAction } from 'react'; +import { type Dispatch, type MutableRefObject, type SetStateAction, useCallback, useRef, useState } from 'react'; export default function useStateRef( initialValue?: T diff --git a/packages/component/src/hooks/internal/useValueRef.ts b/packages/component/src/hooks/internal/useValueRef.ts index 26704acc19..3952ea83c7 100644 --- a/packages/component/src/hooks/internal/useValueRef.ts +++ b/packages/component/src/hooks/internal/useValueRef.ts @@ -1,5 +1,5 @@ // TODO: [P0] #4133 Don't copy. -import { RefObject, useMemo, useRef } from 'react'; +import { type RefObject, useMemo, useRef } from 'react'; export default function useValueRef(value: T): RefObject { const ref = useRef(); diff --git a/packages/component/src/hooks/sendBoxFocus.ts b/packages/component/src/hooks/sendBoxFocus.ts index 065097b0e5..0304586afa 100644 --- a/packages/component/src/hooks/sendBoxFocus.ts +++ b/packages/component/src/hooks/sendBoxFocus.ts @@ -1,4 +1,4 @@ -import { WaitUntilable } from './internal/createWaitUntilable'; +import { type WaitUntilable } from './internal/createWaitUntilable'; import { createPropagation } from 'use-propagate'; export type SendBoxFocusOptions = WaitUntilable<{ noKeyboard: boolean }>; diff --git a/packages/component/src/hooks/useObserveScrollPosition.ts b/packages/component/src/hooks/useObserveScrollPosition.ts index cb5b7432b9..01422e0cfc 100644 --- a/packages/component/src/hooks/useObserveScrollPosition.ts +++ b/packages/component/src/hooks/useObserveScrollPosition.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react'; -import ScrollPosition from '../types/ScrollPosition'; +import type ScrollPosition from '../types/ScrollPosition'; import useWebChatUIContext from './internal/useWebChatUIContext'; export default function useObserveScrollPosition( diff --git a/packages/component/src/hooks/useObserveTranscriptFocus.ts b/packages/component/src/hooks/useObserveTranscriptFocus.ts index 6b39fb265e..11e899ab2b 100644 --- a/packages/component/src/hooks/useObserveTranscriptFocus.ts +++ b/packages/component/src/hooks/useObserveTranscriptFocus.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import useWebChatUIContext from './internal/useWebChatUIContext'; diff --git a/packages/component/src/hooks/useRenderMarkdownAsHTML.ts b/packages/component/src/hooks/useRenderMarkdownAsHTML.ts index 8eae1dd4a7..e9a0ced723 100644 --- a/packages/component/src/hooks/useRenderMarkdownAsHTML.ts +++ b/packages/component/src/hooks/useRenderMarkdownAsHTML.ts @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import { hooks, StrictStyleOptions } from 'botframework-webchat-api'; +import { hooks, type StrictStyleOptions } from 'botframework-webchat-api'; import { useMemo } from 'react'; import { useTransformHTMLContent } from '../providers/HTMLContentTransformCOR/index'; diff --git a/packages/component/src/hooks/useScrollTo.ts b/packages/component/src/hooks/useScrollTo.ts index 6157eaee49..610026fd07 100644 --- a/packages/component/src/hooks/useScrollTo.ts +++ b/packages/component/src/hooks/useScrollTo.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react'; -import ScrollPosition from '../types/ScrollPosition'; +import type ScrollPosition from '../types/ScrollPosition'; import useWebChatUIContext from './internal/useWebChatUIContext'; export default function useScrollTo(): ( diff --git a/packages/component/src/hooks/useWebSpeechPonyfill.ts b/packages/component/src/hooks/useWebSpeechPonyfill.ts index 41bf7f02d7..61c733d5f2 100644 --- a/packages/component/src/hooks/useWebSpeechPonyfill.ts +++ b/packages/component/src/hooks/useWebSpeechPonyfill.ts @@ -1,4 +1,4 @@ -import { WebSpeechPonyfill } from 'botframework-webchat-api'; +import { type WebSpeechPonyfill } from 'botframework-webchat-api'; import useWebChatUIContext from './internal/useWebChatUIContext'; diff --git a/packages/component/src/index.ts b/packages/component/src/index.ts index 0835d92936..91cb83bdf6 100644 --- a/packages/component/src/index.ts +++ b/packages/component/src/index.ts @@ -1,16 +1,16 @@ import { hooks as apiHooks, concatMiddleware, localize } from 'botframework-webchat-api'; import { type WebChatActivity } from 'botframework-webchat-core'; -import ReactWebChat, { ReactWebChatProps } from './ReactWebChat'; +import ReactWebChat, { type ReactWebChatProps } from './ReactWebChat'; -import Composer, { ComposerProps } from './Composer'; +import Composer, { type ComposerProps } from './Composer'; import AccessKeySinkSurface from './Utils/AccessKeySink/Surface'; import BasicConnectivityStatus from './BasicConnectivityStatus'; import BasicToaster from './BasicToaster'; import BasicTranscript from './BasicTranscript'; -import BasicWebChat, { BasicWebChatProps } from './BasicWebChat'; +import BasicWebChat, { type BasicWebChatProps } from './BasicWebChat'; import BasicSendBox from './SendBox/BasicSendBox'; import BasicSendBoxToolbar from './SendBoxToolbar/BasicSendBoxToolbar'; diff --git a/packages/component/src/providers/ActivityTree/ActivityTreeComposer.tsx b/packages/component/src/providers/ActivityTree/ActivityTreeComposer.tsx index d5569b92ce..d70dbc9c14 100644 --- a/packages/component/src/providers/ActivityTree/ActivityTreeComposer.tsx +++ b/packages/component/src/providers/ActivityTree/ActivityTreeComposer.tsx @@ -1,15 +1,15 @@ import { hooks, type ActivityComponentFactory } from 'botframework-webchat-api'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import React, { useMemo, type ReactNode } from 'react'; import useMemoWithPrevious from '../../hooks/internal/useMemoWithPrevious'; import ActivityTreeContext from './private/Context'; -import { ActivityWithRenderer, ReadonlyActivityTree } from './private/types'; +import { type ActivityWithRenderer, type ReadonlyActivityTree } from './private/types'; import useActivitiesWithRenderer from './private/useActivitiesWithRenderer'; import useActivityTreeWithRenderer from './private/useActivityTreeWithRenderer'; import useActivityTreeContext from './private/useContext'; -import type { ActivityTreeContextType } from './private/Context'; +import { type ActivityTreeContextType } from './private/Context'; type ActivityTreeComposerProps = Readonly<{ children?: ReactNode | undefined }>; diff --git a/packages/component/src/providers/ActivityTree/private/Context.ts b/packages/component/src/providers/ActivityTree/private/Context.ts index dcd1c99b1d..d7d082c23f 100644 --- a/packages/component/src/providers/ActivityTree/private/Context.ts +++ b/packages/component/src/providers/ActivityTree/private/Context.ts @@ -1,6 +1,6 @@ import { createContext } from 'react'; -import type { ActivityWithRenderer, ReadonlyActivityTree } from './types'; +import { type ActivityWithRenderer, type ReadonlyActivityTree } from './types'; type ActivityTreeContextType = { activityTreeWithRendererState: readonly [ReadonlyActivityTree]; diff --git a/packages/component/src/providers/ActivityTree/private/types.ts b/packages/component/src/providers/ActivityTree/private/types.ts index b0f40b0ed9..3d919536f0 100644 --- a/packages/component/src/providers/ActivityTree/private/types.ts +++ b/packages/component/src/providers/ActivityTree/private/types.ts @@ -1,5 +1,5 @@ -import type { ActivityComponentFactory } from 'botframework-webchat-api'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type ActivityComponentFactory } from 'botframework-webchat-api'; +import { type WebChatActivity } from 'botframework-webchat-core'; type ActivityWithRenderer = { activity: WebChatActivity; diff --git a/packages/component/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts b/packages/component/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts index 82cc58f07e..b9f08c1b83 100644 --- a/packages/component/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts +++ b/packages/component/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; -import type { ActivityWithRenderer } from './types'; +import { type ActivityWithRenderer } from './types'; import useMemoized from '../../../hooks/internal/useMemoized'; export default function useActivitiesWithRenderer( diff --git a/packages/component/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts b/packages/component/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts index db0f8c2a02..62e2ef8202 100644 --- a/packages/component/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts +++ b/packages/component/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts @@ -1,10 +1,10 @@ import { hooks } from 'botframework-webchat-api'; import { useMemo } from 'react'; -import type { WebChatActivity } from 'botframework-webchat-core'; +import { type WebChatActivity } from 'botframework-webchat-core'; import intersectionOf from '../../../Utils/intersectionOf'; import removeInline from '../../../Utils/removeInline'; -import type { ActivityWithRenderer, ReadonlyActivityTree } from './types'; +import { type ActivityWithRenderer, type ReadonlyActivityTree } from './types'; const { useGroupActivities } = hooks; diff --git a/packages/component/src/providers/ActivityTree/private/useContext.ts b/packages/component/src/providers/ActivityTree/private/useContext.ts index d543fe4a18..e43eae8e68 100644 --- a/packages/component/src/providers/ActivityTree/private/useContext.ts +++ b/packages/component/src/providers/ActivityTree/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import ActivityTreeContext from './Context'; -import type { ActivityTreeContextType } from './Context'; +import { type ActivityTreeContextType } from './Context'; export default function useActivityTreeContext(thrownOnUndefined = true): ActivityTreeContextType { const contextValue = useContext(ActivityTreeContext); diff --git a/packages/component/src/providers/ActivityTree/useActivityTreeWithRenderer.ts b/packages/component/src/providers/ActivityTree/useActivityTreeWithRenderer.ts index dda028c7df..60936438c8 100644 --- a/packages/component/src/providers/ActivityTree/useActivityTreeWithRenderer.ts +++ b/packages/component/src/providers/ActivityTree/useActivityTreeWithRenderer.ts @@ -1,6 +1,6 @@ import useActivityTreeContext from './private/useContext'; -import type { ActivityWithRenderer, ReadonlyActivityTree } from './private/types'; +import { type ActivityWithRenderer, type ReadonlyActivityTree } from './private/types'; export default function useActivityTreeWithRenderer(options?: { flat?: false }): readonly [ReadonlyActivityTree]; export default function useActivityTreeWithRenderer(options: { diff --git a/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts b/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts index e8942e68d6..f02dc7ae41 100644 --- a/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts +++ b/packages/component/src/providers/CustomElements/customElements/CodeBlock.ts @@ -1,9 +1,9 @@ /* eslint-disable class-methods-use-this */ import { hooks } from 'botframework-webchat-api'; -import { ReactNode, useMemo, useRef } from 'react'; +import { type ReactNode, useMemo, useRef } from 'react'; import { useStyleSet } from '../../../hooks'; -import { defaultHighlightCode, HighlightCodeFn } from '../../../hooks/internal/codeHighlighter'; +import { defaultHighlightCode, type HighlightCodeFn } from '../../../hooks/internal/codeHighlighter'; import { parseDocumentFragmentFromString, useCodeHighlighter } from '../../../internal'; const { useStyleOptions, useLocalizer } = hooks; diff --git a/packages/component/src/providers/CustomElements/useCodeBlockTagName.ts b/packages/component/src/providers/CustomElements/useCodeBlockTagName.ts index 3313272d3a..bb04752794 100644 --- a/packages/component/src/providers/CustomElements/useCodeBlockTagName.ts +++ b/packages/component/src/providers/CustomElements/useCodeBlockTagName.ts @@ -1,6 +1,6 @@ import { createElement, memo, useMemo } from 'react'; -import { CodeBlockProps } from './customElements/CodeBlock'; +import { type CodeBlockProps } from './customElements/CodeBlock'; import useCustomElementsContext from './private/useCustomElementsContext'; export default function useCodeBlockTag() { diff --git a/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinComposer.ts b/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinComposer.ts index 6908f0b1fb..11e944f965 100644 --- a/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinComposer.ts +++ b/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinComposer.ts @@ -1,7 +1,7 @@ import { createContext } from 'react'; import createLiveRegionTwinComposer from './createLiveRegionTwinComposer'; -import type { StaticElement, StaticElementEntry } from './types'; +import { type StaticElement, type StaticElementEntry } from './types'; export type LiveRegionTwinContextType = { markAllAsRendered: () => void; diff --git a/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx b/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx index 0f571c79a2..da54a5df2d 100644 --- a/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx +++ b/packages/component/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx @@ -1,29 +1,27 @@ import PropTypes from 'prop-types'; import React, { Fragment } from 'react'; -import type { VFC } from 'react'; - import useMarkAllAsRenderedEffect from './useMarkAllAsRenderedEffect'; import useStaticElementEntries from './useStaticElementEntries'; -type LiveRegionTwinContainerProps = { +type LiveRegionTwinContainerProps = Readonly<{ 'aria-label'?: string; 'aria-live': 'assertive' | 'polite'; 'aria-roledescription'?: string; className?: string; role?: string; textElementClassName?: string; -}; +}>; // This container is marked as private because we assume there is only one instance under the . -const LiveRegionTwinContainer: VFC = ({ +const LiveRegionTwinContainer = ({ 'aria-label': ariaLabel, 'aria-live': ariaLive, 'aria-roledescription': ariaRoleDescription, className, role, textElementClassName -}) => { +}: LiveRegionTwinContainerProps) => { const [staticElementEntries] = useStaticElementEntries(); // We assume there is only one instance under the . diff --git a/packages/component/src/providers/LiveRegionTwin/private/createLiveRegionTwinComposer.tsx b/packages/component/src/providers/LiveRegionTwin/private/createLiveRegionTwinComposer.tsx index 7a59585c1f..518bbee736 100644 --- a/packages/component/src/providers/LiveRegionTwin/private/createLiveRegionTwinComposer.tsx +++ b/packages/component/src/providers/LiveRegionTwin/private/createLiveRegionTwinComposer.tsx @@ -5,7 +5,7 @@ import { useRefFrom } from 'use-ref-from'; import { type LiveRegionTwinContextType } from './LiveRegionTwinComposer'; import LiveRegionTwinContainer from './LiveRegionTwinContainer'; -import type { StaticElement, StaticElementEntry } from './types'; +import { type StaticElement, type StaticElementEntry } from './types'; const { usePonyfill } = hooks; diff --git a/packages/component/src/providers/LiveRegionTwin/private/types.ts b/packages/component/src/providers/LiveRegionTwin/private/types.ts index c7a4342ece..546b4f85c6 100644 --- a/packages/component/src/providers/LiveRegionTwin/private/types.ts +++ b/packages/component/src/providers/LiveRegionTwin/private/types.ts @@ -1,4 +1,4 @@ -import type { ReactElement } from 'react'; +import { type ReactElement } from 'react'; type StaticElement = Exclude; diff --git a/packages/component/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts b/packages/component/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts index cc2fcd0919..f6e3914def 100644 --- a/packages/component/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts +++ b/packages/component/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts @@ -1,6 +1,6 @@ import useLiveRegionTwinContext from './useContext'; -import type { StaticElementEntry } from './types'; +import { type StaticElementEntry } from './types'; export default function useStaticElementEntries(): readonly [readonly StaticElementEntry[]] { return useLiveRegionTwinContext().staticElementEntriesState; diff --git a/packages/component/src/providers/LiveRegionTwin/useQueueStaticElement.ts b/packages/component/src/providers/LiveRegionTwin/useQueueStaticElement.ts index 50d69d77a6..2f974a9b51 100644 --- a/packages/component/src/providers/LiveRegionTwin/useQueueStaticElement.ts +++ b/packages/component/src/providers/LiveRegionTwin/useQueueStaticElement.ts @@ -1,6 +1,6 @@ import useLiveRegionTwinContext from './private/useContext'; -import type { StaticElement } from './private/types'; +import { type StaticElement } from './private/types'; /** * Queues a static element to the live region. diff --git a/packages/component/src/providers/ModalDialog/private/Popover.tsx b/packages/component/src/providers/ModalDialog/private/Popover.tsx index 97e307d3e0..f3b9621482 100644 --- a/packages/component/src/providers/ModalDialog/private/Popover.tsx +++ b/packages/component/src/providers/ModalDialog/private/Popover.tsx @@ -1,19 +1,18 @@ import { hooks } from 'botframework-webchat-api'; import classNames from 'classnames'; -import React, { memo, type PropsWithChildren, useCallback, useLayoutEffect, useRef } from 'react'; +import React, { memo, useCallback, useLayoutEffect, useRef, type ReactNode } from 'react'; import useStyleSet from '../../../hooks/useStyleSet'; const { useLocalizer } = hooks; -type Props = Readonly< - PropsWithChildren<{ - 'aria-label'?: string; - 'aria-labelledby'?: string; - className?: string; - onDismiss?: () => void; - }> ->; +type Props = Readonly<{ + 'aria-label'?: string; + 'aria-labelledby'?: string; + children?: ReactNode | undefined; + className?: string; + onDismiss?: () => void; +}>; const ModalDialog = memo( ({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, className, onDismiss }: Props) => { diff --git a/packages/component/src/providers/RovingTabIndex/RovingTabIndexComposer.tsx b/packages/component/src/providers/RovingTabIndex/RovingTabIndexComposer.tsx index 28c06db473..9f2fe50b52 100644 --- a/packages/component/src/providers/RovingTabIndex/RovingTabIndexComposer.tsx +++ b/packages/component/src/providers/RovingTabIndex/RovingTabIndexComposer.tsx @@ -1,21 +1,21 @@ /* eslint complexity: ["error", 50] */ import PropTypes from 'prop-types'; -import React, { useCallback, useEffect, useMemo, useRef } from 'react'; +import React, { type MutableRefObject, type ReactNode, useCallback, useEffect, useMemo, useRef } from 'react'; import RovingTabIndexContext from './private/Context'; -import type { FC, MutableRefObject, PropsWithChildren } from 'react'; -import type { RovingTabIndexContextType } from './private/Context'; +import { type RovingTabIndexContextType } from './private/Context'; type ItemRef = MutableRefObject; -type RovingTabIndexContextProps = PropsWithChildren<{ +type RovingTabIndexContextProps = Readonly<{ + children?: ReactNode | undefined; onEscapeKey?: () => void; orientation?: 'horizontal' | 'vertical'; }>; -const RovingTabIndexComposer: FC = ({ children, onEscapeKey, orientation }) => { +const RovingTabIndexComposer = ({ children, onEscapeKey, orientation }: RovingTabIndexContextProps) => { const activeItemIndexRef = useRef(0); const itemRefsRef = useRef([]); diff --git a/packages/component/src/providers/RovingTabIndex/private/Context.ts b/packages/component/src/providers/RovingTabIndex/private/Context.ts index cd117fd15e..bbe4fdce49 100644 --- a/packages/component/src/providers/RovingTabIndex/private/Context.ts +++ b/packages/component/src/providers/RovingTabIndex/private/Context.ts @@ -1,6 +1,6 @@ import { createContext } from 'react'; -import type { MutableRefObject } from 'react'; +import { type MutableRefObject } from 'react'; type RovingTabIndexContextType = { itemEffector: (ref: MutableRefObject, index: number) => () => void; diff --git a/packages/component/src/providers/RovingTabIndex/useItemRef.ts b/packages/component/src/providers/RovingTabIndex/useItemRef.ts index e67e396e46..87b3be884c 100644 --- a/packages/component/src/providers/RovingTabIndex/useItemRef.ts +++ b/packages/component/src/providers/RovingTabIndex/useItemRef.ts @@ -1,7 +1,7 @@ import { useEffect, useRef } from 'react'; import useContext from './private/useContext'; -import type { MutableRefObject } from 'react'; +import { type MutableRefObject } from 'react'; export default function useItemRef(itemIndex: number): MutableRefObject { const ref = useRef(); diff --git a/packages/component/src/providers/Theme/private/Context.ts b/packages/component/src/providers/Theme/private/Context.ts index dbc1bdb291..558eba083f 100644 --- a/packages/component/src/providers/Theme/private/Context.ts +++ b/packages/component/src/providers/Theme/private/Context.ts @@ -1,17 +1,17 @@ -import type { - ActivityMiddleware, - ActivityStatusMiddleware, - AttachmentForScreenReaderMiddleware, - AttachmentMiddleware, - AvatarMiddleware, - CardActionMiddleware, - GroupActivitiesMiddleware, - ScrollToEndButtonMiddleware, - SendBoxMiddleware, - SendBoxToolbarMiddleware, - StyleOptions, - ToastMiddleware, - TypingIndicatorMiddleware +import { + type ActivityMiddleware, + type ActivityStatusMiddleware, + type AttachmentForScreenReaderMiddleware, + type AttachmentMiddleware, + type AvatarMiddleware, + type CardActionMiddleware, + type GroupActivitiesMiddleware, + type ScrollToEndButtonMiddleware, + type SendBoxMiddleware, + type SendBoxToolbarMiddleware, + type StyleOptions, + type ToastMiddleware, + type TypingIndicatorMiddleware } from 'botframework-webchat-api'; import { createContext } from 'react'; diff --git a/packages/component/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx b/packages/component/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx index 5b410be65d..cec80427e0 100644 --- a/packages/component/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx +++ b/packages/component/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-api'; import PropTypes from 'prop-types'; import random from 'math-random'; -import React, { useCallback, useMemo } from 'react'; +import React, { type MutableRefObject, type ReactNode, useCallback, useMemo } from 'react'; import scrollIntoViewWithBlockNearest from '../../Utils/scrollIntoViewWithBlockNearest'; import TranscriptFocusContext from './private/Context'; @@ -10,12 +10,12 @@ import usePrevious from '../../hooks/internal/usePrevious'; import useStateRef from '../../hooks/internal/useStateRef'; import useValueRef from '../../hooks/internal/useValueRef'; -import type { FC, MutableRefObject, PropsWithChildren } from 'react'; -import type { TranscriptFocusContextType } from './private/Context'; +import { type TranscriptFocusContextType } from './private/Context'; const { useGetKeyByActivity } = hooks; -type TranscriptFocusComposerProps = PropsWithChildren<{ +type TranscriptFocusComposerProps = Readonly<{ + children?: ReactNode | undefined; containerRef: MutableRefObject; }>; @@ -33,7 +33,7 @@ function uniqueId(count = Infinity) { ); } -const TranscriptFocusComposer: FC = ({ children, containerRef }) => { +const TranscriptFocusComposer = ({ children, containerRef }: TranscriptFocusComposerProps) => { const [flattenedActivityTree] = useActivityTreeWithRenderer({ flat: true }); const [_, setRawFocusedActivityKey, rawFocusedActivityKeyRef] = useStateRef(); const getKeyByActivity = useGetKeyByActivity(); diff --git a/packages/component/src/providers/internal/SendBox/private/Context.ts b/packages/component/src/providers/internal/SendBox/private/Context.ts index 5e632bab32..ec95898015 100644 --- a/packages/component/src/providers/internal/SendBox/private/Context.ts +++ b/packages/component/src/providers/internal/SendBox/private/Context.ts @@ -1,6 +1,6 @@ import { createContext } from 'react'; -import type { ContextType } from './types'; +import { type ContextType } from './types'; const SendBoxContext = createContext(undefined); diff --git a/packages/component/src/providers/internal/SendBox/private/useContext.ts b/packages/component/src/providers/internal/SendBox/private/useContext.ts index ec61c87d06..b48f480e4e 100644 --- a/packages/component/src/providers/internal/SendBox/private/useContext.ts +++ b/packages/component/src/providers/internal/SendBox/private/useContext.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import Context from './Context'; -import type { ContextType } from './types'; +import { type ContextType } from './types'; export default function useSendBoxContext(): ContextType { const context = useContext(Context); diff --git a/packages/component/src/withEmoji/withEmoji.tsx b/packages/component/src/withEmoji/withEmoji.tsx index 9d2f8c6dde..da6fb1c3d4 100644 --- a/packages/component/src/withEmoji/withEmoji.tsx +++ b/packages/component/src/withEmoji/withEmoji.tsx @@ -1,16 +1,16 @@ import { useRefFrom } from 'use-ref-from'; import mergeRefs from 'merge-refs'; import React, { - type ChangeEvent, - type ComponentType, - type FocusEvent, forwardRef, - type KeyboardEvent, - type SyntheticEvent, useCallback, useMemo, useRef, - type Ref + type ChangeEvent, + type ComponentType, + type FocusEvent, + type KeyboardEvent, + type Ref, + type SyntheticEvent } from 'react'; import useUndoStack from './private/useUndoStack'; diff --git a/packages/core/src/actions/incomingActivity.ts b/packages/core/src/actions/incomingActivity.ts index 2f73195513..9700415e53 100644 --- a/packages/core/src/actions/incomingActivity.ts +++ b/packages/core/src/actions/incomingActivity.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type WebChatActivity } from '../types/WebChatActivity'; type IncomingActivityActionType = 'DIRECT_LINE/INCOMING_ACTIVITY'; diff --git a/packages/core/src/actions/postActivity.ts b/packages/core/src/actions/postActivity.ts index fe9cde2f26..4e1f8545c2 100644 --- a/packages/core/src/actions/postActivity.ts +++ b/packages/core/src/actions/postActivity.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type WebChatActivity } from '../types/WebChatActivity'; type PostActivityActionType = 'DIRECT_LINE/POST_ACTIVITY'; type PostActivityFulfilledActionType = 'DIRECT_LINE/POST_ACTIVITY_FULFILLED'; diff --git a/packages/core/src/actions/setNotification.ts b/packages/core/src/actions/setNotification.ts index e275ea54e9..3061c0f7c5 100644 --- a/packages/core/src/actions/setNotification.ts +++ b/packages/core/src/actions/setNotification.ts @@ -1,6 +1,6 @@ import uniqueID from '../utils/uniqueID'; -import type { Notification } from '../types/internal/Notification'; +import { type Notification } from '../types/internal/Notification'; const SET_NOTIFICATION = 'WEB_CHAT/SET_NOTIFICATION'; diff --git a/packages/core/src/actions/setSendBoxAttachments.ts b/packages/core/src/actions/setSendBoxAttachments.ts index 98f3b55eb9..d77942f123 100644 --- a/packages/core/src/actions/setSendBoxAttachments.ts +++ b/packages/core/src/actions/setSendBoxAttachments.ts @@ -1,4 +1,4 @@ -import type { SendBoxAttachment } from '../types/SendBoxAttachment'; +import { type SendBoxAttachment } from '../types/SendBoxAttachment'; const SET_SEND_BOX_ATTACHMENTS = 'WEB_CHAT/SET_SEND_BOX_ATTACHMENTS'; diff --git a/packages/core/src/actions/setSuggestedActions.ts b/packages/core/src/actions/setSuggestedActions.ts index e9e55ff194..aaa0b18aae 100644 --- a/packages/core/src/actions/setSuggestedActions.ts +++ b/packages/core/src/actions/setSuggestedActions.ts @@ -1,5 +1,5 @@ -import type { DirectLineCardAction } from '../types/external/DirectLineCardAction'; -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type DirectLineCardAction } from '../types/external/DirectLineCardAction'; +import { type WebChatActivity } from '../types/WebChatActivity'; const EMPTY_ARRAY: readonly DirectLineCardAction[] = Object.freeze([]); diff --git a/packages/core/src/createReducer.ts b/packages/core/src/createReducer.ts index 3e9c9894b1..1101cf0a62 100644 --- a/packages/core/src/createReducer.ts +++ b/packages/core/src/createReducer.ts @@ -18,7 +18,7 @@ import shouldSpeakIncomingActivity from './reducers/shouldSpeakIncomingActivity' import suggestedActions from './reducers/suggestedActions'; import suggestedActionsOriginActivity from './reducers/suggestedActionsOriginActivity'; -import type { GlobalScopePonyfill } from './types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from './types/GlobalScopePonyfill'; export default function createReducer(ponyfill: GlobalScopePonyfill) { return combineReducers({ diff --git a/packages/core/src/createSagas.ts b/packages/core/src/createSagas.ts index 1fda27ee4f..45306d83cd 100644 --- a/packages/core/src/createSagas.ts +++ b/packages/core/src/createSagas.ts @@ -23,8 +23,8 @@ import stopDictateOnCardActionSaga from './sagas/stopDictateOnCardActionSaga'; import stopSpeakingActivityOnInputSaga from './sagas/stopSpeakingActivityOnInputSaga'; import submitSendBoxSaga from './sagas/submitSendBoxSaga'; -import type { GlobalScopePonyfill } from './types/GlobalScopePonyfill'; -import type { Saga } from 'redux-saga'; +import { type GlobalScopePonyfill } from './types/GlobalScopePonyfill'; +import { type Saga } from 'redux-saga'; type CreateSagasOptions = { ponyfill: GlobalScopePonyfill; diff --git a/packages/core/src/createStore.ts b/packages/core/src/createStore.ts index 33e581e09e..402fa99d7f 100644 --- a/packages/core/src/createStore.ts +++ b/packages/core/src/createStore.ts @@ -6,7 +6,7 @@ import createReducer from './createReducer'; import createSagas from './createSagas'; import sagaError from './actions/sagaError'; -import type { GlobalScopePonyfill } from './types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from './types/GlobalScopePonyfill'; type CreateStoreOptions = { /** diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 2eb76a2da6..8408862c05 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -31,7 +31,7 @@ import createStore, { withDevTools as createStoreWithDevTools, withOptions as createStoreWithOptions } from './createStore'; -import OneOrMany from './types/OneOrMany'; +import type OneOrMany from './types/OneOrMany'; import { parseAction } from './types/external/OrgSchema/Action'; import { parseClaim } from './types/external/OrgSchema/Claim'; import { parseCreativeWork } from './types/external/OrgSchema/CreativeWork'; @@ -46,29 +46,29 @@ import onErrorResumeNext from './utils/onErrorResumeNext'; import singleToArray from './utils/singleToArray'; import warnOnce from './utils/warnOnce'; -import type { GlobalScopePonyfill } from './types/GlobalScopePonyfill'; -import type { SendBoxAttachment } from './types/SendBoxAttachment'; -import type { WebChatActivity } from './types/WebChatActivity'; -import type { DirectLineActivity } from './types/external/DirectLineActivity'; -import type { DirectLineAnimationCard } from './types/external/DirectLineAnimationCard'; -import type { DirectLineAttachment } from './types/external/DirectLineAttachment'; -import type { DirectLineAudioCard } from './types/external/DirectLineAudioCard'; -import type { DirectLineCardAction } from './types/external/DirectLineCardAction'; -import type { DirectLineHeroCard } from './types/external/DirectLineHeroCard'; -import type { DirectLineJSBotConnection } from './types/external/DirectLineJSBotConnection'; -import type { DirectLineOAuthCard } from './types/external/DirectLineOAuthCard'; -import type { DirectLineReceiptCard } from './types/external/DirectLineReceiptCard'; -import type { DirectLineSignInCard } from './types/external/DirectLineSignInCard'; -import type { DirectLineSuggestedAction } from './types/external/DirectLineSuggestedAction'; -import type { DirectLineThumbnailCard } from './types/external/DirectLineThumbnailCard'; -import type { DirectLineVideoCard } from './types/external/DirectLineVideoCard'; -import type { Observable } from './types/external/Observable'; -import type { Action as OrgSchemaAction } from './types/external/OrgSchema/Action'; -import type { Claim as OrgSchemaClaim } from './types/external/OrgSchema/Claim'; -import type { CreativeWork as OrgSchemaCreativeWork } from './types/external/OrgSchema/CreativeWork'; -import type { DefinedTerm as OrgSchemaDefinedTerm } from './types/external/OrgSchema/DefinedTerm'; -import type { Project as OrgSchemaProject } from './types/external/OrgSchema/Project'; -import type { Thing as OrgSchemaThing } from './types/external/OrgSchema/Thing'; +import { type GlobalScopePonyfill } from './types/GlobalScopePonyfill'; +import { type SendBoxAttachment } from './types/SendBoxAttachment'; +import { type WebChatActivity } from './types/WebChatActivity'; +import { type DirectLineActivity } from './types/external/DirectLineActivity'; +import { type DirectLineAnimationCard } from './types/external/DirectLineAnimationCard'; +import { type DirectLineAttachment } from './types/external/DirectLineAttachment'; +import { type DirectLineAudioCard } from './types/external/DirectLineAudioCard'; +import { type DirectLineCardAction } from './types/external/DirectLineCardAction'; +import { type DirectLineHeroCard } from './types/external/DirectLineHeroCard'; +import { type DirectLineJSBotConnection } from './types/external/DirectLineJSBotConnection'; +import { type DirectLineOAuthCard } from './types/external/DirectLineOAuthCard'; +import { type DirectLineReceiptCard } from './types/external/DirectLineReceiptCard'; +import { type DirectLineSignInCard } from './types/external/DirectLineSignInCard'; +import { type DirectLineSuggestedAction } from './types/external/DirectLineSuggestedAction'; +import { type DirectLineThumbnailCard } from './types/external/DirectLineThumbnailCard'; +import { type DirectLineVideoCard } from './types/external/DirectLineVideoCard'; +import { type Observable } from './types/external/Observable'; +import { type Action as OrgSchemaAction } from './types/external/OrgSchema/Action'; +import { type Claim as OrgSchemaClaim } from './types/external/OrgSchema/Claim'; +import { type CreativeWork as OrgSchemaCreativeWork } from './types/external/OrgSchema/CreativeWork'; +import { type DefinedTerm as OrgSchemaDefinedTerm } from './types/external/OrgSchema/DefinedTerm'; +import { type Project as OrgSchemaProject } from './types/external/OrgSchema/Project'; +import { type Thing as OrgSchemaThing } from './types/external/OrgSchema/Thing'; const Constants = { ActivityClientState, DictateState }; const buildTool = process.env.build_tool; diff --git a/packages/core/src/reducers/createActivitiesReducer.ts b/packages/core/src/reducers/createActivitiesReducer.ts index 4cd7a2ab79..4b0f1c78f3 100644 --- a/packages/core/src/reducers/createActivitiesReducer.ts +++ b/packages/core/src/reducers/createActivitiesReducer.ts @@ -15,18 +15,18 @@ import { SENDING, SEND_FAILED, SENT } from '../types/internal/SendStatus'; import getActivityLivestreamingMetadata from '../utils/getActivityLivestreamingMetadata'; import findBeforeAfter from './private/findBeforeAfter'; -import type { Reducer } from 'redux'; -import type { DeleteActivityAction } from '../actions/deleteActivity'; -import type { IncomingActivityAction } from '../actions/incomingActivity'; -import type { MarkActivityAction } from '../actions/markActivity'; -import type { - PostActivityFulfilledAction, - PostActivityImpededAction, - PostActivityPendingAction, - PostActivityRejectedAction +import { type Reducer } from 'redux'; +import { type DeleteActivityAction } from '../actions/deleteActivity'; +import { type IncomingActivityAction } from '../actions/incomingActivity'; +import { type MarkActivityAction } from '../actions/markActivity'; +import { + type PostActivityFulfilledAction, + type PostActivityImpededAction, + type PostActivityPendingAction, + type PostActivityRejectedAction } from '../actions/postActivity'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type WebChatActivity } from '../types/WebChatActivity'; type ActivitiesAction = | DeleteActivityAction diff --git a/packages/core/src/reducers/createInternalReducer.ts b/packages/core/src/reducers/createInternalReducer.ts index e29db5e365..ad3630fcbc 100644 --- a/packages/core/src/reducers/createInternalReducer.ts +++ b/packages/core/src/reducers/createInternalReducer.ts @@ -1,4 +1,4 @@ -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; /** * Creates a Redux reducer to store the ponyfill. diff --git a/packages/core/src/reducers/createNotificationsReducer.ts b/packages/core/src/reducers/createNotificationsReducer.ts index 721b87e900..8734d85087 100644 --- a/packages/core/src/reducers/createNotificationsReducer.ts +++ b/packages/core/src/reducers/createNotificationsReducer.ts @@ -5,12 +5,12 @@ import { SAGA_ERROR } from '../actions/sagaError'; import { SET_NOTIFICATION } from '../actions/setNotification'; import isForbiddenPropertyName from '../utils/isForbiddenPropertyName'; -import type { DismissNotificationAction } from '../actions/dismissNotification'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; -import type { Notification } from '../types/internal/Notification'; -import type { Reducer } from 'redux'; -import type { SagaErrorAction } from '../actions/sagaError'; -import type { SetNotificationAction } from '../actions/setNotification'; +import { type DismissNotificationAction } from '../actions/dismissNotification'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type Notification } from '../types/internal/Notification'; +import { type Reducer } from 'redux'; +import { type SagaErrorAction } from '../actions/sagaError'; +import { type SetNotificationAction } from '../actions/setNotification'; type NotificationsAction = DismissNotificationAction | SagaErrorAction | SetNotificationAction; type NotificationsState = Record; diff --git a/packages/core/src/reducers/createTypingReducer.ts b/packages/core/src/reducers/createTypingReducer.ts index 54fc11a078..9c85a39c94 100644 --- a/packages/core/src/reducers/createTypingReducer.ts +++ b/packages/core/src/reducers/createTypingReducer.ts @@ -6,10 +6,10 @@ import updateIn from 'simple-update-in'; import { INCOMING_ACTIVITY } from '../actions/incomingActivity'; import { POST_ACTIVITY_PENDING } from '../actions/postActivity'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; -import type { IncomingActivityAction } from '../actions/incomingActivity'; -import type { PostActivityPendingAction } from '../actions/postActivity'; -import type { Reducer } from 'redux'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type IncomingActivityAction } from '../actions/incomingActivity'; +import { type PostActivityPendingAction } from '../actions/postActivity'; +import { type Reducer } from 'redux'; type TypingState = Record< string, diff --git a/packages/core/src/reducers/sendBoxAttachments.ts b/packages/core/src/reducers/sendBoxAttachments.ts index 7a8f929532..f8229e4d5e 100644 --- a/packages/core/src/reducers/sendBoxAttachments.ts +++ b/packages/core/src/reducers/sendBoxAttachments.ts @@ -1,5 +1,5 @@ import { SET_SEND_BOX_ATTACHMENTS } from '../actions/setSendBoxAttachments'; -import type { SendBoxAttachment } from '../types/SendBoxAttachment'; +import { type SendBoxAttachment } from '../types/SendBoxAttachment'; const DEFAULT_STATE: readonly SendBoxAttachment[] = Object.freeze([]); diff --git a/packages/core/src/reducers/suggestedActionsOriginActivity.ts b/packages/core/src/reducers/suggestedActionsOriginActivity.ts index 8b2d06cd10..461292942b 100644 --- a/packages/core/src/reducers/suggestedActionsOriginActivity.ts +++ b/packages/core/src/reducers/suggestedActionsOriginActivity.ts @@ -2,7 +2,7 @@ import type clearSuggestedActions from '../actions/clearSuggestedActions'; import { CLEAR_SUGGESTED_ACTIONS } from '../actions/clearSuggestedActions'; import type setSuggestedActions from '../actions/setSuggestedActions'; import { SET_SUGGESTED_ACTIONS } from '../actions/setSuggestedActions'; -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type WebChatActivity } from '../types/WebChatActivity'; type ClearSuggestedActions = ReturnType; type SetSuggestedActions = ReturnType; diff --git a/packages/core/src/sagas/detectSlowConnectionSaga.ts b/packages/core/src/sagas/detectSlowConnectionSaga.ts index c26ed176a3..1899d65880 100644 --- a/packages/core/src/sagas/detectSlowConnectionSaga.ts +++ b/packages/core/src/sagas/detectSlowConnectionSaga.ts @@ -4,7 +4,7 @@ import { CONNECT_FULFILLED, CONNECT_PENDING, CONNECT_REJECTED, CONNECT_STILL_PEN import { RECONNECT_FULFILLED, RECONNECT_PENDING, RECONNECT_REJECTED } from '../actions/reconnect'; import sleep from '../utils/sleep'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; const SLOW_CONNECTION_AFTER = 15000; diff --git a/packages/core/src/sagas/effects/observeOnce.ts b/packages/core/src/sagas/effects/observeOnce.ts index 2bd8128bb8..32a3dc67b1 100644 --- a/packages/core/src/sagas/effects/observeOnce.ts +++ b/packages/core/src/sagas/effects/observeOnce.ts @@ -1,6 +1,6 @@ import { call } from 'redux-saga/effects'; -import { Observable, Observer, Subscription } from '../../types/external/Observable'; +import { type Observable, type Observer, type Subscription } from '../../types/external/Observable'; export default function observeOnceEffect(observable: Observable) { return call(function* observeOnce() { diff --git a/packages/core/src/sagas/effects/whileConnected.ts b/packages/core/src/sagas/effects/whileConnected.ts index d14909a480..37c03a701b 100644 --- a/packages/core/src/sagas/effects/whileConnected.ts +++ b/packages/core/src/sagas/effects/whileConnected.ts @@ -4,7 +4,7 @@ import { CONNECT_FULFILLING } from '../../actions/connect'; import { DISCONNECT_PENDING } from '../../actions/disconnect'; import { RECONNECT_PENDING, RECONNECT_FULFILLING } from '../../actions/reconnect'; -import type { DirectLineJSBotConnection } from '../../types/external/DirectLineJSBotConnection'; +import { type DirectLineJSBotConnection } from '../../types/external/DirectLineJSBotConnection'; export default function whileConnectedEffect

( fn: ( diff --git a/packages/core/src/sagas/observeActivitySaga.ts b/packages/core/src/sagas/observeActivitySaga.ts index 3378c4c655..db93dcd029 100644 --- a/packages/core/src/sagas/observeActivitySaga.ts +++ b/packages/core/src/sagas/observeActivitySaga.ts @@ -4,9 +4,9 @@ import updateIn from 'simple-update-in'; import observeEach from './effects/observeEach'; import queueIncomingActivity from '../actions/queueIncomingActivity'; import whileConnected from './effects/whileConnected'; -import type { DirectLineActivity } from '../types/external/DirectLineActivity'; -import type { DirectLineJSBotConnection } from '../types/external/DirectLineJSBotConnection'; -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type DirectLineActivity } from '../types/external/DirectLineActivity'; +import { type DirectLineJSBotConnection } from '../types/external/DirectLineJSBotConnection'; +import { type WebChatActivity } from '../types/WebChatActivity'; const PASSTHRU_FN = (value: unknown) => value; diff --git a/packages/core/src/sagas/postActivitySaga.ts b/packages/core/src/sagas/postActivitySaga.ts index 7bf8ab2e9b..17588b237d 100644 --- a/packages/core/src/sagas/postActivitySaga.ts +++ b/packages/core/src/sagas/postActivitySaga.ts @@ -17,19 +17,19 @@ import sleep from '../utils/sleep'; import uniqueID from '../utils/uniqueID'; import whileConnected from './effects/whileConnected'; -import type { DirectLineActivity } from '../types/external/DirectLineActivity'; -import type { DirectLineJSBotConnection } from '../types/external/DirectLineJSBotConnection'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; -import type { IncomingActivityAction } from '../actions/incomingActivity'; -import type { - PostActivityAction, - PostActivityFulfilledAction, - PostActivityImpededAction, - PostActivityPendingAction, - PostActivityRejectedAction +import { type DirectLineActivity } from '../types/external/DirectLineActivity'; +import { type DirectLineJSBotConnection } from '../types/external/DirectLineJSBotConnection'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type IncomingActivityAction } from '../actions/incomingActivity'; +import { + type PostActivityAction, + type PostActivityFulfilledAction, + type PostActivityImpededAction, + type PostActivityPendingAction, + type PostActivityRejectedAction } from '../actions/postActivity'; -import type { WebChatActivity } from '../types/WebChatActivity'; -import type { WebChatOutgoingActivity } from '../types/internal/WebChatOutgoingActivity'; +import { type WebChatActivity } from '../types/WebChatActivity'; +import { type WebChatOutgoingActivity } from '../types/internal/WebChatOutgoingActivity'; // After 5 minutes, the saga will stop from listening for echo backs and consider the outgoing message as permanently undeliverable. // This value must be equals to or larger than the user-defined `styleOptions.sendTimeout`. diff --git a/packages/core/src/sagas/queueIncomingActivitySaga.ts b/packages/core/src/sagas/queueIncomingActivitySaga.ts index 88717edc3e..8a25455d6f 100644 --- a/packages/core/src/sagas/queueIncomingActivitySaga.ts +++ b/packages/core/src/sagas/queueIncomingActivitySaga.ts @@ -8,7 +8,7 @@ import activitiesSelector, { ofType as activitiesOfType } from '../selectors/act import sleep from '../utils/sleep'; import whileConnected from './effects/whileConnected'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; // We will hold up the replying activity if the originating activity did not arrive, up to 5 seconds. const REPLY_TIMEOUT = 5000; diff --git a/packages/core/src/sagas/sendMessageToPostActivitySaga.ts b/packages/core/src/sagas/sendMessageToPostActivitySaga.ts index a72bff526e..04128fd5f1 100644 --- a/packages/core/src/sagas/sendMessageToPostActivitySaga.ts +++ b/packages/core/src/sagas/sendMessageToPostActivitySaga.ts @@ -1,7 +1,8 @@ import { put, takeEvery } from 'redux-saga/effects'; import postActivity from '../actions/postActivity'; -import sendMessage, { SEND_MESSAGE } from '../actions/sendMessage'; +import type sendMessage from '../actions/sendMessage'; +import { SEND_MESSAGE } from '../actions/sendMessage'; import whileConnected from './effects/whileConnected'; function* postActivityWithMessage({ diff --git a/packages/core/src/sagas/sendTypingIndicatorOnSetSendBoxSaga.ts b/packages/core/src/sagas/sendTypingIndicatorOnSetSendBoxSaga.ts index e520203034..5ccb37c620 100644 --- a/packages/core/src/sagas/sendTypingIndicatorOnSetSendBoxSaga.ts +++ b/packages/core/src/sagas/sendTypingIndicatorOnSetSendBoxSaga.ts @@ -11,7 +11,7 @@ import sendTypingIndicatorSelector from '../selectors/sendTypingIndicator'; import sleep from '../utils/sleep'; import whileConnected from './effects/whileConnected'; -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; import type setSendTypingIndicator from '../actions/setSendTypingIndicator'; type SetSendTypingIndicatorAction = ReturnType; diff --git a/packages/core/src/selectors/activities.ts b/packages/core/src/selectors/activities.ts index de6216f2dd..c82b433163 100644 --- a/packages/core/src/selectors/activities.ts +++ b/packages/core/src/selectors/activities.ts @@ -1,5 +1,5 @@ -import type { ReduxState } from '../types/internal/ReduxState'; -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type ReduxState } from '../types/internal/ReduxState'; +import { type WebChatActivity } from '../types/WebChatActivity'; const activities = ({ activities }: ReduxState) => activities; diff --git a/packages/core/src/selectors/dictateState.ts b/packages/core/src/selectors/dictateState.ts index bedd660204..57e3a2aef5 100644 --- a/packages/core/src/selectors/dictateState.ts +++ b/packages/core/src/selectors/dictateState.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ dictateState }: ReduxState) => dictateState; diff --git a/packages/core/src/selectors/language.ts b/packages/core/src/selectors/language.ts index 9e30077f4f..bb68007ded 100644 --- a/packages/core/src/selectors/language.ts +++ b/packages/core/src/selectors/language.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ language }: ReduxState): string => language; diff --git a/packages/core/src/selectors/notifications.ts b/packages/core/src/selectors/notifications.ts index 870e4ebfc2..52fc278de9 100644 --- a/packages/core/src/selectors/notifications.ts +++ b/packages/core/src/selectors/notifications.ts @@ -1,5 +1,5 @@ -import type { Notification } from '../types/internal/Notification'; -import type { ReduxState } from '../types/internal/ReduxState'; +import { type Notification } from '../types/internal/Notification'; +import { type ReduxState } from '../types/internal/ReduxState'; const notifications = ({ notifications }: ReduxState): { [key: string]: Notification } => notifications; diff --git a/packages/core/src/selectors/sendBoxAttachments.ts b/packages/core/src/selectors/sendBoxAttachments.ts index c5ee850382..35bbb4a86f 100644 --- a/packages/core/src/selectors/sendBoxAttachments.ts +++ b/packages/core/src/selectors/sendBoxAttachments.ts @@ -1,5 +1,5 @@ -import type { SendBoxAttachment } from '../types/SendBoxAttachment'; -import type { ReduxState } from '../types/internal/ReduxState'; +import { type SendBoxAttachment } from '../types/SendBoxAttachment'; +import { type ReduxState } from '../types/internal/ReduxState'; export default function sendBoxAttachments({ sendBoxAttachments }: ReduxState): readonly SendBoxAttachment[] { return sendBoxAttachments; diff --git a/packages/core/src/selectors/sendBoxValue.ts b/packages/core/src/selectors/sendBoxValue.ts index f36589141a..54bd94fe17 100644 --- a/packages/core/src/selectors/sendBoxValue.ts +++ b/packages/core/src/selectors/sendBoxValue.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ sendBoxValue }: ReduxState): string => sendBoxValue; diff --git a/packages/core/src/selectors/sendTimeout.ts b/packages/core/src/selectors/sendTimeout.ts index c85c3adeed..ffe3a72a77 100644 --- a/packages/core/src/selectors/sendTimeout.ts +++ b/packages/core/src/selectors/sendTimeout.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ sendTimeout }: ReduxState): number => sendTimeout; diff --git a/packages/core/src/selectors/sendTypingIndicator.ts b/packages/core/src/selectors/sendTypingIndicator.ts index c5b5da10a9..23b2657e73 100644 --- a/packages/core/src/selectors/sendTypingIndicator.ts +++ b/packages/core/src/selectors/sendTypingIndicator.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ sendTypingIndicator }: ReduxState): boolean => sendTypingIndicator; diff --git a/packages/core/src/selectors/shouldSpeakIncomingActivity.ts b/packages/core/src/selectors/shouldSpeakIncomingActivity.ts index a67140a995..b9e15ad034 100644 --- a/packages/core/src/selectors/shouldSpeakIncomingActivity.ts +++ b/packages/core/src/selectors/shouldSpeakIncomingActivity.ts @@ -1,3 +1,3 @@ -import type { ReduxState } from '../types/internal/ReduxState'; +import { type ReduxState } from '../types/internal/ReduxState'; export default ({ shouldSpeakIncomingActivity }: ReduxState): boolean => shouldSpeakIncomingActivity; diff --git a/packages/core/src/types/GlobalScopePonyfill.ts b/packages/core/src/types/GlobalScopePonyfill.ts index 22259db08b..300c3efb0e 100644 --- a/packages/core/src/types/GlobalScopePonyfill.ts +++ b/packages/core/src/types/GlobalScopePonyfill.ts @@ -1,4 +1,4 @@ -import type { GlobalScopeClock } from './internal/GlobalScopeClock'; +import { type GlobalScopeClock } from './internal/GlobalScopeClock'; // TODO: Should we rename this to "globalThisOverrides"? diff --git a/packages/core/src/types/WebChatActivity.ts b/packages/core/src/types/WebChatActivity.ts index f67fe08b47..27efe56c38 100644 --- a/packages/core/src/types/WebChatActivity.ts +++ b/packages/core/src/types/WebChatActivity.ts @@ -7,10 +7,10 @@ // - However, we do not expect the server to return "localTimestamp" as they may not have capability to store this information // - "conversationUpdate" activity is never sent to Web Chat, thus, it is not defined -import type { AnyAnd } from './AnyAnd'; -// import type { AsEntity, Thing } from './external/OrgSchema/Thing'; -import type { DirectLineAttachment } from './external/DirectLineAttachment'; -import type { DirectLineSuggestedAction } from './external/DirectLineSuggestedAction'; +import { type AnyAnd } from './AnyAnd'; +// import { type AsEntity, Thing } from './external/OrgSchema/Thing'; +import { type DirectLineAttachment } from './external/DirectLineAttachment'; +import { type DirectLineSuggestedAction } from './external/DirectLineSuggestedAction'; type SupportedRole = 'bot' | 'channel' | 'user'; type SupportedSendStatus = 'sending' | 'send failed' | 'sent'; diff --git a/packages/core/src/types/external/DirectLineAnimationCard.ts b/packages/core/src/types/external/DirectLineAnimationCard.ts index 37e5e3f9c1..39035d24fb 100644 --- a/packages/core/src/types/external/DirectLineAnimationCard.ts +++ b/packages/core/src/types/external/DirectLineAnimationCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; +import { type DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#Animation-card type DirectLineAnimationCard = DirectLineMediaCardEssence & { diff --git a/packages/core/src/types/external/DirectLineAudioCard.ts b/packages/core/src/types/external/DirectLineAudioCard.ts index 78ddeb876d..06e63162e3 100644 --- a/packages/core/src/types/external/DirectLineAudioCard.ts +++ b/packages/core/src/types/external/DirectLineAudioCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; +import { type DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#audio-card type DirectLineAudioCard = DirectLineMediaCardEssence & { diff --git a/packages/core/src/types/external/DirectLineBasicCardEssence.ts b/packages/core/src/types/external/DirectLineBasicCardEssence.ts index 81041df4ca..6c0e1eba3c 100644 --- a/packages/core/src/types/external/DirectLineBasicCardEssence.ts +++ b/packages/core/src/types/external/DirectLineBasicCardEssence.ts @@ -1,5 +1,5 @@ -import type { DirectLineCardImage } from './DirectLineCardImage'; -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardImage } from './DirectLineCardImage'; +import { type DirectLineCardAction } from './DirectLineCardAction'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#basic-cards type DirectLineBasicCardEssence = { diff --git a/packages/core/src/types/external/DirectLineCardImage.ts b/packages/core/src/types/external/DirectLineCardImage.ts index 83ff6cffa4..437ee69705 100644 --- a/packages/core/src/types/external/DirectLineCardImage.ts +++ b/packages/core/src/types/external/DirectLineCardImage.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardAction } from './DirectLineCardAction'; type DirectLineCardImage = { alt: string; diff --git a/packages/core/src/types/external/DirectLineHeroCard.ts b/packages/core/src/types/external/DirectLineHeroCard.ts index db52924f3c..672192898b 100644 --- a/packages/core/src/types/external/DirectLineHeroCard.ts +++ b/packages/core/src/types/external/DirectLineHeroCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineBasicCardEssence } from './DirectLineBasicCardEssence'; +import { type DirectLineBasicCardEssence } from './DirectLineBasicCardEssence'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#Hero-cards type DirectLineHeroCard = DirectLineBasicCardEssence & { diff --git a/packages/core/src/types/external/DirectLineMediaCardEssence.ts b/packages/core/src/types/external/DirectLineMediaCardEssence.ts index 30831bf851..f5b5d29b01 100644 --- a/packages/core/src/types/external/DirectLineMediaCardEssence.ts +++ b/packages/core/src/types/external/DirectLineMediaCardEssence.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardAction } from './DirectLineCardAction'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#media-cards type DirectLineMediaCardEssence = { diff --git a/packages/core/src/types/external/DirectLineOAuthCard.ts b/packages/core/src/types/external/DirectLineOAuthCard.ts index bd5665b458..40df55d546 100644 --- a/packages/core/src/types/external/DirectLineOAuthCard.ts +++ b/packages/core/src/types/external/DirectLineOAuthCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardAction } from './DirectLineCardAction'; type DirectLineOAuthCard = { buttons?: DirectLineCardAction[]; diff --git a/packages/core/src/types/external/DirectLineReceiptCard.ts b/packages/core/src/types/external/DirectLineReceiptCard.ts index b6afeefce9..372dccba74 100644 --- a/packages/core/src/types/external/DirectLineReceiptCard.ts +++ b/packages/core/src/types/external/DirectLineReceiptCard.ts @@ -1,5 +1,5 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; -import type { DirectLineCardImage } from './DirectLineCardImage'; +import { type DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardImage } from './DirectLineCardImage'; type Fact = { key?: string; diff --git a/packages/core/src/types/external/DirectLineSignInCard.ts b/packages/core/src/types/external/DirectLineSignInCard.ts index 4871cebbbe..c7070a827c 100644 --- a/packages/core/src/types/external/DirectLineSignInCard.ts +++ b/packages/core/src/types/external/DirectLineSignInCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardAction } from './DirectLineCardAction'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#Signin-card type DirectLineSignInCard = { diff --git a/packages/core/src/types/external/DirectLineSuggestedAction.ts b/packages/core/src/types/external/DirectLineSuggestedAction.ts index 275bd241a1..9f7da2e01a 100644 --- a/packages/core/src/types/external/DirectLineSuggestedAction.ts +++ b/packages/core/src/types/external/DirectLineSuggestedAction.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from './DirectLineCardAction'; +import { type DirectLineCardAction } from './DirectLineCardAction'; type DirectLineSuggestedAction = { actions?: DirectLineCardAction[]; diff --git a/packages/core/src/types/external/DirectLineThumbnailCard.ts b/packages/core/src/types/external/DirectLineThumbnailCard.ts index d3d157908d..fbdea22585 100644 --- a/packages/core/src/types/external/DirectLineThumbnailCard.ts +++ b/packages/core/src/types/external/DirectLineThumbnailCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineBasicCardEssence } from './DirectLineBasicCardEssence'; +import { type DirectLineBasicCardEssence } from './DirectLineBasicCardEssence'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#Thumbnail-cards type DirectLineThumbnailCard = DirectLineBasicCardEssence & { diff --git a/packages/core/src/types/external/DirectLineVideoCard.ts b/packages/core/src/types/external/DirectLineVideoCard.ts index 98ba1369b1..c28229463e 100644 --- a/packages/core/src/types/external/DirectLineVideoCard.ts +++ b/packages/core/src/types/external/DirectLineVideoCard.ts @@ -1,4 +1,4 @@ -import type { DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; +import { type DirectLineMediaCardEssence } from './DirectLineMediaCardEssence'; // https://github.com/microsoft/botframework-sdk/blob/master/specs/botframework-activity/botframework-cards.md#video-card type DirectLineVideoCard = DirectLineMediaCardEssence & { diff --git a/packages/core/src/types/internal/ReduxState.ts b/packages/core/src/types/internal/ReduxState.ts index a3c00c16d5..b98983be4f 100644 --- a/packages/core/src/types/internal/ReduxState.ts +++ b/packages/core/src/types/internal/ReduxState.ts @@ -1,6 +1,6 @@ import type sendBoxAttachments from '../../reducers/sendBoxAttachments'; -import type { WebChatActivity } from '../WebChatActivity'; -import type { Notification } from './Notification'; +import { type WebChatActivity } from '../WebChatActivity'; +import { type Notification } from './Notification'; // TODO: Should build this using typings of createReducer. type ReduxState = { diff --git a/packages/core/src/utils/getActivityLivestreamingMetadata.spec.ts b/packages/core/src/utils/getActivityLivestreamingMetadata.spec.ts index 739b1cac50..22949ff76e 100644 --- a/packages/core/src/utils/getActivityLivestreamingMetadata.spec.ts +++ b/packages/core/src/utils/getActivityLivestreamingMetadata.spec.ts @@ -1,4 +1,4 @@ -import type { WebChatActivity } from '../types/WebChatActivity'; +import { type WebChatActivity } from '../types/WebChatActivity'; import getActivityLivestreamingMetadata from './getActivityLivestreamingMetadata'; describe.each([['with "streamId"' as const], ['without "streamId"' as const]])('activity %s', variant => { diff --git a/packages/core/src/utils/sleep.ts b/packages/core/src/utils/sleep.ts index c4c1430d22..1154c1f660 100644 --- a/packages/core/src/utils/sleep.ts +++ b/packages/core/src/utils/sleep.ts @@ -1,4 +1,4 @@ -import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; +import { type GlobalScopePonyfill } from '../types/GlobalScopePonyfill'; export default function sleep(interval: number, ponyfill: GlobalScopePonyfill): Promise { return new Promise(resolve => ponyfill.setTimeout(resolve, Math.max(interval, 0))); diff --git a/packages/fluent-theme/src/components/activity/ActivityDecorator.tsx b/packages/fluent-theme/src/components/activity/ActivityDecorator.tsx index 22a3bdc63c..919799bfdf 100644 --- a/packages/fluent-theme/src/components/activity/ActivityDecorator.tsx +++ b/packages/fluent-theme/src/components/activity/ActivityDecorator.tsx @@ -1,6 +1,6 @@ -import { WebChatActivity } from 'botframework-webchat-component'; +import { type WebChatActivity } from 'botframework-webchat-component'; import cx from 'classnames'; -import React, { ReactNode, memo } from 'react'; +import React, { type ReactNode, memo } from 'react'; import useVariants from '../../private/useVariants'; import { useStyles, useVariantClassName } from '../../styles'; import styles from './ActivityDecorator.module.css'; diff --git a/packages/fluent-theme/src/components/activity/CopilotMessageHeader.tsx b/packages/fluent-theme/src/components/activity/CopilotMessageHeader.tsx index 51ef3e6688..b4e16e85e4 100644 --- a/packages/fluent-theme/src/components/activity/CopilotMessageHeader.tsx +++ b/packages/fluent-theme/src/components/activity/CopilotMessageHeader.tsx @@ -1,5 +1,5 @@ import React, { memo, useMemo, type CSSProperties } from 'react'; -import { WebChatActivity, hooks } from 'botframework-webchat-component'; +import { type WebChatActivity, hooks } from 'botframework-webchat-component'; import useActivityStyleOptions from './private/useActivityStyleOptions'; import isAIGeneratedActivity from './private/isAIGeneratedActivity'; diff --git a/packages/fluent-theme/src/components/suggestedActions/AccessibleButton.tsx b/packages/fluent-theme/src/components/suggestedActions/AccessibleButton.tsx index fb9039f689..148793f3ff 100644 --- a/packages/fluent-theme/src/components/suggestedActions/AccessibleButton.tsx +++ b/packages/fluent-theme/src/components/suggestedActions/AccessibleButton.tsx @@ -1,4 +1,4 @@ -import React, { MouseEventHandler, ReactNode, forwardRef, memo, useRef } from 'react'; +import React, { type MouseEventHandler, type ReactNode, forwardRef, memo, useRef } from 'react'; const preventDefaultHandler: MouseEventHandler = event => event.preventDefault(); diff --git a/packages/fluent-theme/src/components/suggestedActions/SuggestedAction.tsx b/packages/fluent-theme/src/components/suggestedActions/SuggestedAction.tsx index d51b43229a..81e5652f93 100644 --- a/packages/fluent-theme/src/components/suggestedActions/SuggestedAction.tsx +++ b/packages/fluent-theme/src/components/suggestedActions/SuggestedAction.tsx @@ -1,7 +1,7 @@ import { hooks } from 'botframework-webchat-component'; import { type DirectLineCardAction } from 'botframework-webchat-core'; import cx from 'classnames'; -import React, { MouseEventHandler, memo, useCallback } from 'react'; +import React, { type MouseEventHandler, memo, useCallback } from 'react'; import { useStyles } from '../../styles'; import testIds from '../../testIds'; diff --git a/packages/fluent-theme/src/components/suggestedActions/private/computeSuggestedActionText.ts b/packages/fluent-theme/src/components/suggestedActions/private/computeSuggestedActionText.ts index 9f4c604224..bc07a9ee75 100644 --- a/packages/fluent-theme/src/components/suggestedActions/private/computeSuggestedActionText.ts +++ b/packages/fluent-theme/src/components/suggestedActions/private/computeSuggestedActionText.ts @@ -1,4 +1,4 @@ -import type { DirectLineCardAction } from 'botframework-webchat-core'; +import { type DirectLineCardAction } from 'botframework-webchat-core'; // Please refer to this article to find out how to compute the "button text" for suggested action. // https://github.com/Microsoft/botframework-sdk/blob/main/specs/botframework-activity/botframework-activity.md#card-action diff --git a/packages/fluent-theme/src/components/suggestedActions/private/rovingFocus.tsx b/packages/fluent-theme/src/components/suggestedActions/private/rovingFocus.tsx index b604a9a452..3b867e7576 100644 --- a/packages/fluent-theme/src/components/suggestedActions/private/rovingFocus.tsx +++ b/packages/fluent-theme/src/components/suggestedActions/private/rovingFocus.tsx @@ -1,13 +1,13 @@ /* eslint-disable no-magic-numbers */ import React, { - type MutableRefObject, createContext, memo, useCallback, useContext, useEffect, useMemo, - useRef + useRef, + type MutableRefObject } from 'react'; type ItemRef = MutableRefObject; diff --git a/packages/fluent-theme/src/components/telephoneKeypad/Surrogate.tsx b/packages/fluent-theme/src/components/telephoneKeypad/Surrogate.tsx index 3f6584d016..4f803334cb 100644 --- a/packages/fluent-theme/src/components/telephoneKeypad/Surrogate.tsx +++ b/packages/fluent-theme/src/components/telephoneKeypad/Surrogate.tsx @@ -1,6 +1,6 @@ import React, { memo } from 'react'; -import type { PropsOf } from '../../types'; +import { type PropsOf } from '../../types'; import TelephoneKeypad from './private/TelephoneKeypad'; import useShown from './useShown'; diff --git a/packages/fluent-theme/src/private/FluentThemeProvider.tsx b/packages/fluent-theme/src/private/FluentThemeProvider.tsx index 7c1fcdfa6d..58a96e4e77 100644 --- a/packages/fluent-theme/src/private/FluentThemeProvider.tsx +++ b/packages/fluent-theme/src/private/FluentThemeProvider.tsx @@ -1,4 +1,4 @@ -import type { ActivityMiddleware } from 'botframework-webchat-api'; +import { type ActivityMiddleware } from 'botframework-webchat-api'; import { Components } from 'botframework-webchat-component'; import { WebChatDecorator } from 'botframework-webchat-component/decorator'; import React, { memo, type ReactNode } from 'react'; @@ -9,7 +9,7 @@ import { PrimarySendBox } from '../components/sendBox'; import { TelephoneKeypadProvider } from '../components/telephoneKeypad'; import { WebChatTheme } from '../components/theme'; import { createStyles } from '../styles'; -import VariantComposer, { VariantList } from './VariantComposer'; +import VariantComposer, { type VariantList } from './VariantComposer'; import { isLinerMessageActivity, LinerMessageActivity } from '../components/linerActivity'; const { ThemeProvider } = Components; diff --git a/packages/styles/src/build/private/injectCSSPlugin.ts b/packages/styles/src/build/private/injectCSSPlugin.ts index b6957f5ecd..3615f00fc8 100644 --- a/packages/styles/src/build/private/injectCSSPlugin.ts +++ b/packages/styles/src/build/private/injectCSSPlugin.ts @@ -1,5 +1,5 @@ import { decode, encode } from '@jridgewell/sourcemap-codec'; -import type { Plugin } from 'esbuild'; +import { type Plugin } from 'esbuild'; export interface InjectCSSPluginOptions { stylesPlaceholder: string; diff --git a/samples/01.getting-started/l.sharepoint-web-part/README.md b/samples/01.getting-started/l.sharepoint-web-part/README.md index d00b48a455..5193ccbd4a 100644 --- a/samples/01.getting-started/l.sharepoint-web-part/README.md +++ b/samples/01.getting-started/l.sharepoint-web-part/README.md @@ -109,16 +109,14 @@ The component code is being replaced by a React function component. It connects ```ts -import { useEffect, useState } from 'react'; -import * as React from 'react'; +import React, { type ReactNode, useEffect, useState } from 'react'; import ReactWebChat, { createDirectLine, createDirectLineAppServiceExtension } from 'botframework-webchat'; import { IWebChatProps } from './IWebChatProps'; import styles from './WebChat.module.scss'; -import type { VFC } from 'react'; -const WebChat: VFC = ({ domain, token }) => { +const WebChat = ({ domain, token }: IWebChatProps): ReactNode => { const [directLine, setDirectLine] = useState(); useEffect(() => { diff --git a/samples/01.getting-started/l.sharepoint-web-part/src/spfx/src/webparts/webChat/components/WebChat.tsx b/samples/01.getting-started/l.sharepoint-web-part/src/spfx/src/webparts/webChat/components/WebChat.tsx index e5339a54de..2a27b8dbd5 100644 --- a/samples/01.getting-started/l.sharepoint-web-part/src/spfx/src/webparts/webChat/components/WebChat.tsx +++ b/samples/01.getting-started/l.sharepoint-web-part/src/spfx/src/webparts/webChat/components/WebChat.tsx @@ -1,13 +1,10 @@ -import { useEffect, useState } from 'react'; -import * as React from 'react'; +import React, { type ReactNode, useEffect, useState } from 'react'; import ReactWebChat, { createDirectLine, createDirectLineAppServiceExtension } from 'botframework-webchat'; import { IWebChatProps } from './IWebChatProps'; import styles from './WebChat.module.scss'; -import type { VFC } from 'react'; - -const WebChat: VFC = ({ domain, token }) => { +const WebChat = ({ domain, token }: IWebChatProps) => { const [directLine, setDirectLine] = useState(); useEffect(() => {