src/Sippo.ts
import 'webrtc-adapter';
import {Session} from './session/Session';
import {SessionConfig} from './session/SessionConfig';
/**
* Factory method for session creation
* @param {string} issuer The authorization token issuer identifier
* @param {string} token The authorization token from the given issuer.
* @param {Object} config Session configuration
* @param {string} config.wacUri The address where the WAC is available
* @param {string} config.applicationToken A token for the application
* @param {string} config.deviceId string which identifies the device this session belongs to
* @return {Promise<Session>} A promise of a new SippoJS session
*/
export async function createSession(issuer: string, token: string, config: SessionConfig): Promise<Session> {
const session = Session.withOAuth2(issuer, token, config);
return Promise.resolve(session);
}
/**
* Factory method for anonymous user session creation
* @param {string} issuer The authorization token issuer identifier
* @param {Object} config Session configuration
* @param {string} config.wacUri The address where the WAC is available
* @param {string} config.applicationToken A token for the application
* @param {string} config.deviceId string which identifies the device this session belongs to
* @return {Promise<Session>} A promise of a new SippoJS session
*/
export async function createAnonymousSession(issuer: string, config: SessionConfig): Promise<Session> {
const session = Session.withoutToken(issuer, config);
return Promise.resolve(session);
}
/**
* Factory method for session recovery
* @param {string} token The authorization token
* @param {Object} config Session configuration
* @param {string} config.wacUri The address where the WAC is available
* @param {string} config.applicationToken A token for the application
* @param {string} config.deviceId string which identifies the device this session belongs to
* @return {Promise<Session>} A promise of a new SippoJS session
*/
export async function recoverSession(token: string, config: SessionConfig): Promise<Session> {
const session = Session.withSessionToken(token, config);
return Promise.resolve(session);
}
/**
* Allows obtaining the available providers enabled in the specified WAC instance
* @param {string} wacUri The address where the WAC is available
* @return {Promise<ProviderInfo[]>} A promise with an array with information for each provider
*/
export async function getAuthProviders(wacUri: string): Promise<AuthProvider[]> {
return window.fetch(`${wacUri}/sapi/oauth2/providers`).then(async response => response.json());
}
export interface AuthProvider {
authorization_endpoint: string; // eslint-disable-line @typescript-eslint/naming-convention
displayName: string;
grant_type: string; // eslint-disable-line @typescript-eslint/naming-convention
id: string;
revocation_endpoint: string; // eslint-disable-line @typescript-eslint/naming-convention
scope: string;
signout_endpoint?: string; // eslint-disable-line @typescript-eslint/naming-convention
token_endpoint?: string; // eslint-disable-line @typescript-eslint/naming-convention
tokenInfo: string;
uid: string;
uidType: string;
}
export * from './chat/Chat';
export * from './chat/ChatManager';
export * from './chat/ChatMessage';
export * from './chat/ChatMessageDirection';
export * from './chat/ChatMessageFile';
export * from './chat/ChatMessageStatus';
export * from './chat/ChatMessageType';
export * from './chat/ChatParticipantRole';
export * from './chat/ChatParticipantState';
export * from './chat/ChatType';
export * from './chat/SupportChat';
export * from './conferences/Conference';
export * from './conferences/ConferenceEndReason';
export * from './conferences/ConferenceInvite';
export * from './conferences/ConferenceLog';
export * from './conferences/ConferenceLogEntry';
export * from './conferences/ConferenceManager';
export * from './conferences/ConferenceStatus';
export * from './conferences/Invitation';
export * from './conferences/errors/AccessBeforeTimeError';
export * from './conferences/errors/WrongPasswordError';
export * from './contacts/AddressType';
export * from './contacts/Contact';
export * from './contacts/ContactRepository';
export * from './contacts/ContactType';
export * from './contacts/Email';
export * from './contacts/Phone';
export * from './datapipe/DataPipe';
export * from './datapipe/DataPipeStatus';
export * from './datapipe/DataPipeType';
export * from './file-sharing/FileManager';
export * from './file-sharing/FileUpload';
export * from './file-sharing/FileUploadManager';
export * from './file-sharing/FileUploadStatus';
export * from './groups/Group';
export * from './groups/GroupRepository';
export * from './media/ManagedStream';
export * from './media/LocalMediaHandler';
export * from './media/StreamRecorder';
export * from './media/StreamRecorderStatus';
export * from './meetings/Meeting';
export * from './meetings/MeetingManager';
export * from './meetings/MeetingParticipant';
export * from './permissions/PermissionManager';
export * from './session/RemoteSession';
export * from './session/Session';
export * from './session/SessionConfig';
export * from './session/SessionError';
export * from './session/SessionStatus';
export * from './session/User';
export * from './users/Presence';
export * from './users/PresenceActivity';
export * from './users/PresenceMood';
export * from './users/PresenceState';
export type {User as UserNg} from './users/User';
export * from './users/UserRepository';
export * from './users/UserRole';
export * from './utils/scaleImage';
export * from './voice-mail/VoiceMailManager';
export * from './whiteboard/Whiteboard';
export * from './types';