Skip to content

Commit

Permalink
[Dialpad] dialpad cc removal (#4336)
Browse files Browse the repository at this point in the history
* CC dialpad removal

* Change files

* remove from features file

* remove old comment

* remoe trampoline
  • Loading branch information
dmceachernmsft authored Mar 26, 2024
1 parent ece7e38 commit 8122147
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "none",
"area": "improvement",
"workstream": "Dialpad",
"comment": "Remove Conditional Compilation of dialpad",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 0 additions & 2 deletions common/config/babel/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -85,7 +84,6 @@ export interface CommonCallingHandlers {
onDisposeLocalStreamView: () => Promise<void>;
onDisposeRemoteVideoStreamView: (userId: string) => Promise<void>;
onDisposeRemoteScreenShareStreamView: (userId: string) => Promise<void>;
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
onSendDtmfTone: (dtmfTone: DtmfTone) => Promise<void>;
onRemoveParticipant(userId: string): Promise<void>;
/* @conditional-compile-remove(PSTN-calls) */
Expand Down Expand Up @@ -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<void> => await call?.sendDtmf(dtmfTone);

const notImplemented = (): any => {
Expand Down Expand Up @@ -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,

Expand Down
4 changes: 1 addition & 3 deletions packages/calling-component-bindings/src/hooks/usePropsFor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -120,7 +119,7 @@ export type GetSelector<Component extends (props: any) => JSX.Element | undefine
: AreEqual<Component, typeof ErrorBar> extends true
? ErrorBarSelector
: AreEqual<Component, typeof Dialpad> extends true
? /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */ EmptySelector
? EmptySelector
: AreEqual<Component, typeof HoldButton> extends true
? /* @conditional-compile-remove(PSTN-calls) */ HoldButtonSelector
: undefined;
Expand Down Expand Up @@ -149,7 +148,6 @@ export const getSelector = <Component extends (props: any) => 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1856,10 +1856,10 @@ export function createAzureCommunicationCallAdapter(args: AzureCommunicationCall
export function createAzureCommunicationCallAdapter(args: AzureCommunicationOutboundCallAdapterArgs): Promise<CallAdapter>;

// @public
export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, targetCallees: StartCallIdentifier[], options?: AzureCommunicationCallAdapterOptions): Promise<CallAdapter>;
export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, targetCallees: StartCallIdentifier[], options?: AzureCommunicationCallAdapterOptions): Promise<CallAdapter>;

// @public
export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator, options?: AzureCommunicationCallAdapterOptions): Promise<CallAdapter>;
export function createAzureCommunicationCallAdapterFromClient(callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator, options?: AzureCommunicationCallAdapterOptions): Promise<CallAdapter>;

// @public
export const createAzureCommunicationCallWithChatAdapter: ({ userId, displayName, credential, endpoint, locator, callAdapterOptions }: AzureCommunicationCallWithChatAdapterArgs) => Promise<CallWithChatAdapter>;
Expand All @@ -1874,7 +1874,7 @@ export const createAzureCommunicationChatAdapter: ({ endpoint: endpointUrl, user
export function createAzureCommunicationChatAdapterFromClient(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): Promise<ChatAdapter>;

// @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;
Expand Down
2 changes: 0 additions & 2 deletions packages/communication-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(),
Expand Down
11 changes: 1 addition & 10 deletions packages/react-components/src/components/Dialpad/Dialpad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 <DialpadContainer strings={strings} {...props} />;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) */
Expand Down
4 changes: 0 additions & 4 deletions packages/react-components/src/theming/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand All @@ -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) */
Expand Down Expand Up @@ -270,7 +268,6 @@ export const DEFAULT_COMPONENT_ICONS = {
ControlButtonMicOn: <Mic20Filled />,
ControlButtonOptions: <Settings20Filled />,
ControlButtonParticipants: <People20Filled />,
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
ControlButtonParticipantsContextualMenuItem: <People20Regular />,
ControlButtonScreenShareStart: <ShareScreenStart20Filled />,
ControlButtonScreenShareStop: <ShareScreenStop20Filled />,
Expand Down Expand Up @@ -329,7 +326,6 @@ export const DEFAULT_COMPONENT_ICONS = {
SendBoxSend: <Send20Regular />,
SendBoxSendHovered: <Send20Filled />,
VideoTileMicOff: <MicOff16Filled />,
/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
DialpadBackspace: <Backspace20Regular />,
/* @conditional-compile-remove(call-readiness) */
SitePermissionsSparkle: <SitePermissionSparkle20Filled />,
Expand Down

0 comments on commit 8122147

Please sign in to comment.