import { GroupLocator , TeamsMeetingLinkLocator } from '@azure/communication-calling' ; import { v1 as generateGUID } from 'uuid' ; /**
 * Get ACS user token from the Contoso server.
 */ export const fetchTokenResponse = async ( ) : Promise < any > => { const response = await fetch ( '/token' ) ; if ( response . ok ) { const responseAsJson = await response . json ( ) ; const token = responseAsJson . token ; if ( token ) { return responseAsJson ; } } throw 'Invalid token response' ; } ; /**
 * Get group id from the url's query params.
 */ export const getGroupIdFromUrl = ( ) : GroupLocator | undefined => { const urlParams = new URLSearchParams ( window . location . search ) ; const gid = urlParams . get ( 'groupId' ) ; return gid ? { groupId : gid } : undefined ; } ; export const createGroupId = ( ) : GroupLocator => ( { groupId : generateGUID ( ) } ) ; /**
 * Get teams meeting link from the url's query params.
 */ export const getTeamsLinkFromUrl = ( ) : TeamsMeetingLinkLocator | undefined => { const urlParams = new URLSearchParams ( window . location . search ) ; const teamsLink = urlParams . get ( 'teamsLink' ) ; return teamsLink ? { meetingLink : teamsLink } : undefined ; } ; export const isOnIphoneAndNotSafari = ( ) : boolean => { const userAgent = navigator . userAgent ; return userAgent . includes ( 'iPhone' ) && ( userAgent . includes ( 'FxiOS' ) || userAgent . includes ( 'CriOS' ) ) ; } ; export const isSmallScreen = ( ) : boolean => window . innerWidth < 700 || window . innerHeight < 400 ; export const navigateToHomePage = ( ) : void => { window . location . href = window . location . href . split ( '?' ) [ 0 ] ; } ; declare let __BUILDTIME__ ; export const buildTime = __BUILDTIME__ ; declare let __CALLINGVERSION__ ; export const callingSDKVersion = __CALLINGVERSION__ ; declare let __CHATVERSION__ ; export const chatSDKVersion = __CHATVERSION__ ;