From 81221479ee18c3f13380755e76e71c5c1a306a33 Mon Sep 17 00:00:00 2001 From: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:18:29 -0600 Subject: [PATCH] [Dialpad] dialpad cc removal (#4336) * CC dialpad removal * Change files * remove from features file * remove old comment * remoe trampoline --- ...on-react-144c474e-707c-43e1-957d-32134be1d2b5.json | 9 +++++++++ common/config/babel/features.js | 2 -- .../src/handlers/createCommonHandlers.ts | 5 +---- .../src/hooks/usePropsFor.ts | 4 +--- .../review/stable/communication-react.api.md | 6 +++--- packages/communication-react/src/index.ts | 2 -- .../src/components/Dialpad/Dialpad.test.tsx | 8 -------- .../src/components/Dialpad/Dialpad.tsx | 11 +---------- .../src/localization/LocalizationProvider.tsx | 2 -- packages/react-components/src/theming/icons.tsx | 4 ---- 10 files changed, 15 insertions(+), 38 deletions(-) create mode 100644 change/@azure-communication-react-144c474e-707c-43e1-957d-32134be1d2b5.json diff --git a/change/@azure-communication-react-144c474e-707c-43e1-957d-32134be1d2b5.json b/change/@azure-communication-react-144c474e-707c-43e1-957d-32134be1d2b5.json new file mode 100644 index 00000000000..ab547c48341 --- /dev/null +++ b/change/@azure-communication-react-144c474e-707c-43e1-957d-32134be1d2b5.json @@ -0,0 +1,9 @@ +{ + "type": "none", + "area": "improvement", + "workstream": "Dialpad", + "comment": "Remove Conditional Compilation of dialpad", + "packageName": "@azure/communication-react", + "email": "dmceachern@microsoft.com", + "dependentChangeType": "none" +} diff --git a/common/config/babel/features.js b/common/config/babel/features.js index 1d328f01f62..6bb44edd86d 100644 --- a/common/config/babel/features.js +++ b/common/config/babel/features.js @@ -122,8 +122,6 @@ module.exports = { "close-captions", // Feature for the DTMF dialer for Teams voice apps "dtmf-dialer", - // dialpad - "dialpad", // Feature for call transfer "call-transfer", // custom branding for the composites diff --git a/packages/calling-component-bindings/src/handlers/createCommonHandlers.ts b/packages/calling-component-bindings/src/handlers/createCommonHandlers.ts index 0706564bc1e..0d3ff4e7dfa 100644 --- a/packages/calling-component-bindings/src/handlers/createCommonHandlers.ts +++ b/packages/calling-component-bindings/src/handlers/createCommonHandlers.ts @@ -14,7 +14,6 @@ import { } from '@azure/communication-calling'; /* @conditional-compile-remove(end-of-call-survey) */ import { CallSurvey, CallSurveyResponse } from '@azure/communication-calling'; -/* @conditional-compile-remove(dialpad) */ import { DtmfTone } from '@azure/communication-calling'; /* @conditional-compile-remove(PSTN-calls) */ import { AddPhoneNumberOptions } from '@azure/communication-calling'; @@ -85,7 +84,6 @@ export interface CommonCallingHandlers { onDisposeLocalStreamView: () => Promise; onDisposeRemoteVideoStreamView: (userId: string) => Promise; onDisposeRemoteScreenShareStreamView: (userId: string) => Promise; - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ onSendDtmfTone: (dtmfTone: DtmfTone) => Promise; onRemoveParticipant(userId: string): Promise; /* @conditional-compile-remove(PSTN-calls) */ @@ -531,7 +529,6 @@ export const createDefaultCommonCallingHandlers = memoizeOne( await disposeAllLocalPreviewViews(callClient); }; - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ const onSendDtmfTone = async (dtmfTone: DtmfTone): Promise => await call?.sendDtmf(dtmfTone); const notImplemented = (): any => { @@ -686,7 +683,7 @@ export const createDefaultCommonCallingHandlers = memoizeOne( onAddParticipant: notImplemented, onRemoveParticipant: notImplemented, onStartCall: notImplemented, - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ onSendDtmfTone, + onSendDtmfTone, /* @conditional-compile-remove(call-readiness) */ askDevicePermission, diff --git a/packages/calling-component-bindings/src/hooks/usePropsFor.ts b/packages/calling-component-bindings/src/hooks/usePropsFor.ts index 0f02229e520..5d70d598c8b 100644 --- a/packages/calling-component-bindings/src/hooks/usePropsFor.ts +++ b/packages/calling-component-bindings/src/hooks/usePropsFor.ts @@ -11,7 +11,6 @@ import { ScreenShareButton, VideoGallery } from '@internal/react-components'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ import { Dialpad } from '@internal/react-components'; /* @conditional-compile-remove(PSTN-calls) */ import { HoldButton } from '@internal/react-components'; @@ -120,7 +119,7 @@ export type GetSelector JSX.Element | undefine : AreEqual extends true ? ErrorBarSelector : AreEqual extends true - ? /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ EmptySelector + ? EmptySelector : AreEqual extends true ? /* @conditional-compile-remove(PSTN-calls) */ HoldButtonSelector : undefined; @@ -149,7 +148,6 @@ export const getSelector = JSX.Element | unde }; const findSelector = (component: (props: any) => JSX.Element | undefined): any => { - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ // Dialpad only has handlers currently and doesn't require any props from the stateful layer so return the emptySelector if (component === Dialpad) { return emptySelector; diff --git a/packages/communication-react/review/stable/communication-react.api.md b/packages/communication-react/review/stable/communication-react.api.md index 965ad0ba8f0..61b8e100b7e 100644 --- a/packages/communication-react/review/stable/communication-react.api.md +++ b/packages/communication-react/review/stable/communication-react.api.md @@ -1856,10 +1856,10 @@ export function createAzureCommunicationCallAdapter(args: AzureCommunicationCall export function createAzureCommunicationCallAdapter(args: AzureCommunicationOutboundCallAdapterArgs): Promise; // @public -export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, targetCallees: StartCallIdentifier[], options?: AzureCommunicationCallAdapterOptions): Promise; +export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, targetCallees: StartCallIdentifier[], options?: AzureCommunicationCallAdapterOptions): Promise; // @public -export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator, options?: AzureCommunicationCallAdapterOptions): Promise; +export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator, options?: AzureCommunicationCallAdapterOptions): Promise; // @public export const createAzureCommunicationCallWithChatAdapter: ({ userId, displayName, credential, endpoint, locator, callAdapterOptions }: AzureCommunicationCallWithChatAdapterArgs) => Promise; @@ -1874,7 +1874,7 @@ export const createAzureCommunicationChatAdapter: ({ endpoint: endpointUrl, user export function createAzureCommunicationChatAdapterFromClient(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): Promise; // @public -export type CreateDefaultCallingHandlers = (callClient: StatefulCallClient, callAgent: CallAgent | undefined, deviceManager: StatefulDeviceManager | undefined, call: Call | undefined, options?: CallingHandlersOptions) => CallingHandlers; +export type CreateDefaultCallingHandlers = (callClient: StatefulCallClient, callAgent: CallAgent | undefined, deviceManager: StatefulDeviceManager | undefined, call: Call | undefined, options?: CallingHandlersOptions) => CallingHandlers; // @public export const createDefaultCallingHandlers: CreateDefaultCallingHandlers; diff --git a/packages/communication-react/src/index.ts b/packages/communication-react/src/index.ts index 79398e5014a..20fec747366 100644 --- a/packages/communication-react/src/index.ts +++ b/packages/communication-react/src/index.ts @@ -157,7 +157,6 @@ export { HoldButton } from '../../react-components/src'; export { RaiseHandButton } from '../../react-components/src'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ export { Dialpad } from '../../react-components/src'; /* @conditional-compile-remove(call-readiness) */ @@ -312,7 +311,6 @@ export type { Spotlight } from '../../react-components/src'; export type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src'; /* @conditional-compile-remove(data-loss-prevention) */ export type { BlockedMessage } from '../../react-components/src'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ export type { DialpadMode, DialpadProps, diff --git a/packages/react-components/src/components/Dialpad/Dialpad.test.tsx b/packages/react-components/src/components/Dialpad/Dialpad.test.tsx index 4e453145ea8..ae1640500b8 100644 --- a/packages/react-components/src/components/Dialpad/Dialpad.test.tsx +++ b/packages/react-components/src/components/Dialpad/Dialpad.test.tsx @@ -3,7 +3,6 @@ import React from 'react'; import { Dialpad, DialpadStrings, DtmfTone } from './Dialpad'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ import { createTestLocale, renderWithLocalization } from '../utils/testUtils'; import { act, fireEvent, render, screen } from '@testing-library/react'; import { registerIcons } from '@fluentui/react'; @@ -30,13 +29,6 @@ describe('Dialpad tests', () => { beforeEach(() => { mockSendDTMF.mockClear(); }); - /* - * Localization depends on public API for `LocalizationProvider` that does not - * have the strings for the beta-only `Dialpad` component. - * skip this test for stable build. - * - * @conditional-compile-remove(dialpad) - */ test('Should localize default text ', async () => { const dialpadStrings: DialpadStrings = { placeholderText: Math.random().toString(), diff --git a/packages/react-components/src/components/Dialpad/Dialpad.tsx b/packages/react-components/src/components/Dialpad/Dialpad.tsx index 3a840591070..5afdc9e815f 100644 --- a/packages/react-components/src/components/Dialpad/Dialpad.tsx +++ b/packages/react-components/src/components/Dialpad/Dialpad.tsx @@ -17,7 +17,6 @@ import { } from '@fluentui/react'; import { _formatString } from '@internal/acs-ui-common'; import { useState } from 'react'; -/* @conditional-compile-remove(dialpad) */ import { useLocale } from '../../localization'; import { buttonStyles, @@ -445,17 +444,9 @@ const DialpadContainer = (props: { * @public */ export const Dialpad = (props: DialpadProps): JSX.Element => { - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ const localeStrings = useLocale().strings.dialpad; - const dialpadLocaleStringsTrampoline = (): DialpadStrings => { - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ - return localeStrings; - // Even though the component strings type doesn't have `DialpadStrings` in stable build, - // the string values exist. So unsafe cast for stable build. - return '' as unknown as DialpadStrings; - }; - const strings = { ...dialpadLocaleStringsTrampoline(), ...props.strings }; + const strings = { ...localeStrings, ...props.strings }; return ; }; diff --git a/packages/react-components/src/localization/LocalizationProvider.tsx b/packages/react-components/src/localization/LocalizationProvider.tsx index c664473e2fe..d6a6c962bf1 100644 --- a/packages/react-components/src/localization/LocalizationProvider.tsx +++ b/packages/react-components/src/localization/LocalizationProvider.tsx @@ -21,7 +21,6 @@ import { import { RaiseHandButtonStrings } from '../components'; /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ import { HoldButtonStrings } from '../components'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ import { DialpadStrings } from '../components'; /* @conditional-compile-remove(call-readiness) */ import { SitePermissionsStrings } from '../components/DevicePermissions/SitePermissionsScaffolding'; @@ -114,7 +113,6 @@ export interface ComponentStrings { errorBar: ErrorBarStrings; /** Strings for VideoGallery */ videoGallery: VideoGalleryStrings; - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ /** Strings for Dialpad */ dialpad: DialpadStrings; /* @conditional-compile-remove(one-to-n-calling) */ diff --git a/packages/react-components/src/theming/icons.tsx b/packages/react-components/src/theming/icons.tsx index ef07422479d..2cde3247847 100644 --- a/packages/react-components/src/theming/icons.tsx +++ b/packages/react-components/src/theming/icons.tsx @@ -83,7 +83,6 @@ import { Important20Filled } from '@fluentui/react-icons'; import { VideoBackgroundEffect20Filled, VideoBackgroundEffect20Regular } from '@fluentui/react-icons'; -/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ import { Backspace20Regular } from '@fluentui/react-icons'; /* @conditional-compile-remove(call-readiness) */ @@ -93,7 +92,6 @@ import { Sparkle20Filled, VideoProhibited20Filled, MicProhibited20Filled } from import { ArrowDownload16Regular } from '@fluentui/react-icons'; /* @conditional-compile-remove(PSTN-calls) */ import { CallPause20Regular, CallPause20Filled, Play20Regular } from '@fluentui/react-icons'; -/* @conditional-compile-remove(dialpad) */ import { People20Regular } from '@fluentui/react-icons'; /* @conditional-compile-remove(data-loss-prevention) */ @@ -270,7 +268,6 @@ export const DEFAULT_COMPONENT_ICONS = { ControlButtonMicOn: , ControlButtonOptions: , ControlButtonParticipants: , - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ ControlButtonParticipantsContextualMenuItem: , ControlButtonScreenShareStart: , ControlButtonScreenShareStop: , @@ -329,7 +326,6 @@ export const DEFAULT_COMPONENT_ICONS = { SendBoxSend: , SendBoxSendHovered: , VideoTileMicOff: , - /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ DialpadBackspace: , /* @conditional-compile-remove(call-readiness) */ SitePermissionsSparkle: ,