1- import React , {
2- useMemo ,
3- } from 'react' ;
4- import { TeamsMeetingLinkLocator } from '@azure/communication-calling' ;
5- import { AzureCommunicationTokenCredential , CommunicationUserIdentifier } from '@azure/communication-common' ;
1+ import React , { useMemo } from "react" ;
2+ import { TeamsMeetingLinkLocator } from "@azure/communication-calling" ;
3+ import {
4+ AzureCommunicationTokenCredential ,
5+ CommunicationUserIdentifier ,
6+ } from "@azure/communication-common" ;
67import {
78 CallAndChatLocator ,
89 CallWithChatComposite ,
910 useAzureCommunicationCallWithChatAdapter ,
10- CallWithChatCompositeOptions
11- } from ' @azure/communication-react' ;
12- import { Theme , PartialTheme , Spinner } from ' @fluentui/react' ;
11+ CallWithChatCompositeOptions ,
12+ } from " @azure/communication-react" ;
13+ import { Theme , PartialTheme , Spinner } from " @fluentui/react" ;
1314
1415/**
1516 * Authentication information needed for your client application to use
@@ -21,18 +22,18 @@ import { Theme, PartialTheme, Spinner } from '@fluentui/react';
2122 * In a real application, your backend service would provide these to the client
2223 * application after the user goes through your authentication flow.
2324 */
24- const ENDPOINT_URL = ' <Azure Communication Resource Endpoint URL>' ;
25- const USER_ID = '<Azure Communication User ID>' ;
26- const TOKEN = ' <Azure Communication Service Resource Token>' ;
27- const TEAMS_MEETING_LINK = ' <Teams Meeting Link>' ;
25+ const ENDPOINT_URL = " <Azure Communication Services Resource Endpoint>" ;
26+ const USER_ID = "<User Id associated to the token>" ;
27+ const TOKEN = " <Azure Communication Services Resource Access Token>" ;
28+ const TEAMS_MEETING_LINK = " <Teams Meeting Link>" ;
2829
2930/**
3031 * Display name for the local participant.
3132 * In a real application, this would be part of the user data that your
3233 * backend services provides to the client application after the user
3334 * goes through your authentication flow.
3435 */
35- const DISPLAY_NAME = '<Azure Communication User Display Name>' ;
36+ const DISPLAY_NAME = "< Display Name>" ;
3637/**
3738 * By default, the `richTextEditorEnabled` is set to false,
3839 * which means the plain text editor will be used for the SendBox component and the MessageThread component's edit function.
@@ -41,7 +42,6 @@ const DISPLAY_NAME = '<Azure Communication User Display Name>';
4142 */
4243const richTextEditorEnabled = false ;
4344
44-
4545export type CallWithChatExampleProps = {
4646 // Props needed for the construction of the CallWithChatAdapter
4747 userId : CommunicationUserIdentifier ;
@@ -56,10 +56,15 @@ export type CallWithChatExampleProps = {
5656 callInvitationURL ?: string ;
5757} ;
5858
59- export const CallWithChatExperience = ( props : CallWithChatExampleProps ) : JSX . Element => {
59+ export const CallWithChatExperience = (
60+ props : CallWithChatExampleProps
61+ ) : JSX . Element => {
6062 // Construct a credential for the user with the token retrieved from your server. This credential
6163 // must be memoized to ensure useAzureCommunicationCallWithChatAdapter is not retriggered on every render pass.
62- const credential = useMemo ( ( ) => new AzureCommunicationTokenCredential ( props . token ) , [ props . token ] ) ;
64+ const credential = useMemo (
65+ ( ) => new AzureCommunicationTokenCredential ( props . token ) ,
66+ [ props . token ]
67+ ) ;
6368
6469 // Create the adapter using a custom react hook provided in the @azure /communication-react package.
6570 // See https://aka.ms/acsstorybook?path=/docs/composite-adapters--page for more information on adapter construction and alternative constructors.
@@ -68,7 +73,7 @@ export const CallWithChatExperience = (props: CallWithChatExampleProps): JSX.Ele
6873 displayName : props . displayName ,
6974 credential,
7075 locator : props . locator ,
71- endpoint : props . endpointUrl
76+ endpoint : props . endpointUrl ,
7277 } ) ;
7378
7479 // The adapter is created asynchronously by the useAzureCommunicationCallWithChatAdapter hook.
@@ -77,23 +82,29 @@ export const CallWithChatExperience = (props: CallWithChatExampleProps): JSX.Ele
7782 return < Spinner label = "Initializing..." /> ;
7883 }
7984
80- return < CallWithChatComposite adapter = { adapter } fluentTheme = { props . fluentTheme } options = { props . compositeOptions } /> ;
85+ return (
86+ < CallWithChatComposite
87+ adapter = { adapter }
88+ fluentTheme = { props . fluentTheme }
89+ options = { props . compositeOptions }
90+ />
91+ ) ;
8192} ;
8293
8394/**
8495 * Entry point of your application.
8596 */
8697function App ( ) : JSX . Element {
87- return (
88- < CallWithChatExperience
89- userId = { { communicationUserId : USER_ID } }
90- token = { TOKEN }
91- displayName = { DISPLAY_NAME }
92- endpointUrl = { ENDPOINT_URL }
93- locator = { { meetingLink : TEAMS_MEETING_LINK } }
94- compositeOptions = { { richTextEditor : richTextEditorEnabled } }
95- />
96- ) ;
98+ return (
99+ < CallWithChatExperience
100+ userId = { { communicationUserId : USER_ID } }
101+ token = { TOKEN }
102+ displayName = { DISPLAY_NAME }
103+ endpointUrl = { ENDPOINT_URL }
104+ locator = { { meetingLink : TEAMS_MEETING_LINK } }
105+ compositeOptions = { { richTextEditor : richTextEditorEnabled } }
106+ />
107+ ) ;
97108}
98109
99110export default App ;
0 commit comments