import { WebexAppsApplication, IWebexAppsApplicationState, IWebexAppsUserState } from './application'; import ShareOptimizationMode from './constants/shareoptimizationmode'; import { WebexAppsMeeting, IWebexAppsMeetingState } from './meeting'; import WebexAppsSpace from './space'; import { IBadge, IWebexAppsSidebar, ICalls, ICall, IParticipant } from './types/sidebar.interfaces'; import { IWebexAppsSpaceState } from './types/space.interfaces'; import { IContext, IResponse, IApplication } from './types/api.interfaces'; import WebexAppsUser from './user'; import { IApplicationConfig } from './types/application.interfaces'; import { ILog } from './helpers/types/log.interfaces'; /** * Main webex.Application object. You use this object to obtain information about the application and its context, specify URLs for sharing, and register event listeners. * * @example * ```javascript * const app = new window.webex.Application(); * await app.onReady(); * //Access any of the app properties / events / methods below * ``` * * @remarks * Available since 1.1.0 * * @public */ declare class Application implements IApplication { #private; /** * @internal */ static ErrorCodes: { 0: string; 1: string; 2: string; 3: string; 4: string; 5: string; 6: string; 7: string; 8: string; 9: string; 10: string; SUCCESS: number; GENERIC_ERROR: number; INVALID_ARGUMENT: number; EVENT_ALREADY_REGISTERED: number; EVENT_UNKNOWN: number; BAD_CONTEXT: number; NOT_SUPPORTED: number; NOT_INITIALIZED: number; ACCESS_DENIED: number; TIMED_OUT: number; RATE_LIMITED: number; }; /** * * @internal */ static instance: Application; /** * * @internal */ static ShareOptimizationMode: { AUTO_DETECT: number; VIDEO: number; TEXT: number; 0: string; 1: string; 2: string; }; /** * * Object that holds state information about an embedded app and other actions * * This is an instance of {@link WebexAppsApplication} */ application: WebexAppsApplication; /** * This context object can provide you with contextual information such as information about one of the following, * * - Meeting ({@link IContext.getMeeting | context.getMeeting()}) * * - Space ({@link IContext.getSpace | context.getSpace()}) * * - Sidebar ({@link IContext.getSidebar | context.getSidebar()}) * * @readonly @public */ context: IContext; /** * * @internal */ isLegacyAndroidMC: boolean; /** * * @internal */ isPhase1Version: boolean; /** * * @internal */ isUCF: boolean; /** * * Object that holds state information about a meeting and other meeting actions * * This is an instance of {@link WebexAppsMeeting} */ meeting: WebexAppsMeeting; /** * Instance that has information about a space's state and other space related actions * * This is an instance of {@link WebexAppsSpace} */ space: WebexAppsSpace; /** * * This holds information about the user. The information obtained will be based on PII restrictions * @internal */ user: WebexAppsUser; /** * Instance that has information about a log class's state and other log related actions * * This is an instance of {@link ILog} */ log: ILog; ucfAllowedEvents: string[]; /** * The given device form factor. One of the following: * * - "DESKTOP" - Desktop client * * - "MOBILE" - Mobile device client (iPhone or Android device, for example) * * - "BROWSER" - Web browser client * * - "ROOM_SYSTEM_PERSONAL" - Webex Device running in personal mode * * - "ROOM_SYSTEM_SHARED" - Webex Device running in shared mode (currently not supported) * * * @readonly * @remarks * Available since 1.1.0 */ get deviceType(): string | null; set deviceType(v: string | null); /** * Display context in which the embedded app is running. * * Can be one of the following strings "MEETING_SIDEBAR", "MEETING_STANDALONE_WINDOW", "MEETING_MAINVIEW", or "SPACE_TAB". * * The default is "MEETING_SIDEBAR" for meeting-based apps and "SPACE_TAB" for messaging-based apps. * * @readonly * @remarks Available since 1.1.0 */ get displayContext(): string | null; set displayContext(v: string | null); /** * Indicates if the app has access to personally identifiable information for the current user, meeting, or space (`true`), or if those values are empty or derived (`false`). * * See {@link https://developer.webex.com/docs/embedded-apps-guide#personally-identifiable-information-pii-and-embedded-apps | Personally Identifiable Information (PII) and Embedded Apps} for more information about derived PII values. * * @readonly * @remarks * Available since 1.1.0 */ get isPrivateDataAvailable(): boolean | null; set isPrivateDataAvailable(v: boolean | null); /** * Indicates the capabilities of the device on which the embedded app is running. * * Can be combination of the following: "TOUCH", "SHARED_SYSTEM", "MULTIPLE_USER_SYSTEM", and "VIEW_ONLY". * * Currently not in use and subject to change. An empty string array is currently returned. * * @readonly * @remarks Available since 1.1.0 */ get capabilities(): string[] | null; set capabilities(v: string[] | null); /** * Indicates if the URL specified with a previous call to {@link Application.setShareUrl | setShareUrl()} has been shared in a meeting or space by the user clicking **Open Together** or **Add to Tab**. A value of `TRUE` indicates the URL has been shared; `FALSE` indicates the URL has not been shared. * * @readonly * * @example The following example checks if a sharing session is in progress before calling `setShareUrl()`. * ```javascript * function handleSetShare(url) * if (app.isShared) { * console.log('ERROR: setShareUrl() should not be called while session is active'); * return; * } * // Call setShareUrl() as usual... * } *``` * * @remarks Available since 1.1.0 */ get isShared(): boolean | null; set isShared(v: boolean | null); /** * Indicates the color theme that the user has selected for Webex or Meeting Center. Possible values are `Theme.LIGHT` or `Theme.DARK`. * * @readonly * @remarks Available since 1.1.0 */ get theme(): string | null; set theme(v: string | null); /** * Contains the ISO-639 language code of the language being used by the client (for example, "en-US", "da-DK", etc.). * * @readonly * @remarks Available since 1.1.0 */ get language(): string | null; set language(v: string | null); /** * Indicates the maximum SDK version that the client (Meeting Center or Webex app, for example) implements, following {@link https://semver.org/ | semantic versioning} rules. For example, a value of "1.1.0" might be returned for Meeting Center client versions 41.6-41.9. The {@link Application.embeddedSdkVersion | webex.Application.embeddedSdkVersion} property contains the actual version of the SDK embedded in the client. * * @readonly * @remarks Available since 1.1.0 */ get sdkVersion(): string | null; set sdkVersion(v: string | null); /** * Contains general information about the client app (Webex or Meeting Center) in which the app is running. This format is subject to change and should only be used for diagnostic purposes. * * @readonly * @remarks Available since 1.1.0 */ get about(): string | null; set about(v: string | null); /** * Indicates the actual version of the SDK embedded in the client following {@link https://semver.org/ | semantic versioning} rules. The {@link Application.sdkVersion | webex.Application.sdkVersion} property provides the maximum SDK version that the client implements. * * @readonly * @remarks Available since 1.1.0 */ get embeddedSdkVersion(): string | null; set embeddedSdkVersion(v: string | null); constructor(config?: IApplicationConfig); /** * * @internal */ jsRequestCallback: (response: IResponse) => void; /** * Sets the URL to share in a meeting or space. Calling this method in a meeting causes the **Open Together** button to appear. In a space, calling this method causes the **Add to Tab** button to appear. * * @param internalUrl - Required. URL to share with meeting participants, or add as a tab to a space. The application at the specified URL must integrate with the embedded app framework. (Maxiumum length: 2083 characters) * @param externalUrl - Optional. URL of a version of the application for viewing outside of Webex or Meeting Center (i.e. in a standard web browser). This URL is used in a messaging space when a user selects **Open in Browser** or **Copy URL** from your app's space tab menu. Pass an empty string (`""`) for this parameter if you don't want users to open an external version of your app from a messaging space. This value is currently not used by in-meeting apps. (Max length: 2083 characters). * @param optional - * @param title - Required. Title of the application window for an in-meeting app, or of the tab for an in-space app. (Max length 256 characters.) * @param optionals - Empty JSON object, not currently used. * @returns \{Promise\} One of the following static ErrorCodes. * * 0 = SUCCESS, 1 = GENERIC_ERROR, 2 = INVALID_ARGUMENT * @remarks Available since 1.1.0 * @example The following provides values for all three parameters to `setShareUrl()`. * ```javascript * const app = new webex.Application(); * await app.onReady(); * app.setShareUrl( * "https://www.example.com/app_internal/", * "https://www.example.com/app_external/", * "Application name" * ) * ``` * @example The following demonstrates how to call `setShareUrl()` for a messaging space when you don't want users to open your app outside of Webex or Meeting Center. * ```javascript * const app = new webex.Application(); * await app.onReady(); * app.setShareUrl( * "https://www.example.com/app_internal/", * "", * "Application name" * ) * ``` */ setShareUrl(internalUrl: string, externalUrl: string, title: string, optional?: object): Promise; /** * Clears the URL previously set using {@link Application.setShareUrl | setShareUrl()} and removes the **Open Together** or **Add to Tab** button. * * @remarks Available since 1.1.0 * @example * ```javascript * const app = new webex.Application(); * await app.onReady(); * app.clearShareUrl() * ``` */ clearShareUrl(): Promise; /** * Helper function that returns `true` if the client (Webex or Meeting Center app) supports a given version * of the embedded apps SDK. The framework supports `major.minor` and `major.minor.patch` versioning. * For example, "1.4" and "1.4.1" are valid version string formats, but "1" or "1.4.5.1" are not. * * Also note that "1.4" is identical to "1.4.0". * * @param version - SDK version required by the API. * @returns \{boolean\} * @remarks Available since 1.5.0 * @example The following checks if the Webex or Meeting Center app supports the "1.5.0" SDK version to determine if it can call the {@link Application.initiateSystemBrowserOAuth | app.initiateSystemBrowserOAuth()} method. * ```javascript * if(app.isSdkSupported("1.5.0")) { * // Client supports initiateSystemBrowserOAuth() method, initiate SSO flow: * app.initiateSystemBrowserOAuth("https://...") * } * ``` */ isSdkSupported(version: string): boolean; /** * Initiates a single sign-on (SSO) authentication flow with a third-party identity provider * in the system web browser at the specified URL. Returns a promise containing an OAuth authorization * code from the ID provider, or a error code number. * * > **WARNING** `initiateSystemBrowserOAuth` is not supported in Webex for Government (FedRAMP). * * In addition to any OAuth parameters required by the ID provider, the specified URL's **redirect_uri** query parameter must be set to **https://oauth-helper-prod.wbx2.com/helperservice/v1/callback**. * * This callback correlates the authorization code returned by the identity provider with the embedded app that initiated the OAuth flow, and communicates that information back to your embedded app. * * Notes: * * The **Valid domains** {@link https://developer.webex.com/docs/embedded-apps-guide#embedded-app-configuration-options | configuration option} for your embedded app must include the domain for the SSO page URL you pass to `initiateSystemBrowserOAuth()` (**accounts.example.com**, for example). * * * @param authenticateUrl - Parameterized URL that's opened in the system web browser to initiate the SSO process. The URL's `redirect_uri` parameter must be set to `https://oauth-helper-prod.wbx2.com/helperservice/v1/callback`. (Max length: 2083 characters). * @returns \{Promise.\\} - Authorization code that the embedded app can exchange for an ID or access token from the SSO provider. * @example * ```javascript * // Variable to save authorization code * let authCode; * // Initiate SSO flow * app.initiateSystemBrowserOAuth("https://accounts.example.com/auth?client_id=...&redirect_uri=https://oauth-helper-prod.wbx2.com/helperservice/v1/callback") * .then(function (response) { * // Get authorization code from JSON response * console.log("initiateSystemBrowserOAuth() succeeded") * authCode = response; * // Exchange authorization code for a token with the SSO provider. This part of the OAuth flow * // is the responsibility of the embedded app, e.g. * exchangeCodeForToken(authCode); * }) * .catch(function (reason) { * console.error("initiateSystemBrowserOAuth() failed with reason=", * window.webex.Application.ErrorCodes[errorcode] * ); * } * ``` * @remarks Available since 1.5.0 */ initiateSystemBrowserOAuth(authenticateUrl: string): Promise; /** * Registers a listener function to be called when the specified [event](/docs/embedded-apps-api-reference#events) is raised. Your app must first call {@link Application.listen | app.listen()} before registering listeners for specific events. * * @param eventName - One of the {@link https://developer.webex.com/docs/embedded-apps-api-reference#events | supported events}. * @param callback - Function called when a given event is raised. Callback function will be passed the an event object containing details about the event. * @remarks Available since 1.1.0 * @example The following registers a listener for the `space:infoChanged` event that logs the Space object it receives as an event object to the console. * ```javascript * var app = new window.webex.Application(); * app.onReady().then(() => { * log('onReady()', { message: 'host app is ready' }) * app.listen().then(() => { * app.on('space:infoChanged', (payload) => log('Space info:', payload)); * }) * }); * ``` */ on(eventName: string, callback: (eventObj: object) => void): number; /** * Stops listening for the specified {@link https://developer.webex.com/docs/embedded-apps-api-reference#events | event}. * * @param eventName - Name of the {@link https://developer.webex.com/docs/embedded-apps-api-reference#events | event} to stop listening to. * @param callback - * @remarks Available since 1.1.0 */ off(eventName: string, callback: () => void): number; /** * Used to register an event listener for a specified [event](/docs/embedded-apps-api-reference#events). Either returns a successful Promise indicating that your app is ready to listen for events, or a failed promise indicating an error occurred. The listener must be registered after the `app.onReady()` promise has successfully completed. * * @example * ```javascript * app.onReady().then(() => { * log('onReady()', { message: 'host app is ready' }) * app.listen().then(() => { * app.on('space:infoChanged', (payload) => log('space:infoChanged', payload)); * }) * }); * ``` * @returns \{Promise.\\} * @remarks Available since 1.1.0 */ listen(): Promise; /** * Removes all event listeners registered by your application. * * @remarks Available since 1.1.0 */ stopListening(): void; /** * Called when the `webex.Application` object has been initialized and the SDK is ready for use by your app. * * @returns \{Promise.\\} * @remarks Available since 1.1.0 * @example The following example waits for `onReady()` before logging the main webex.Application object to the JavaScript console. * ```javascript * var app = new window.webex.Application(); * * app.onReady().then(function () { * console.log('App is ready. App info:', app); * }); * ``` */ onReady(): Promise; /** * Opens an HTTPS or custom protocol URL in the default system browser. * The specified URL must use `https:` or a custom protocol, such as `webexteams:` * (to open the Webex app) or `mailto:` (to open the default mail app). * * HTTPS URLs are validated against the list of allowed domains specified by the * {@link https://developer.webex.com/docs/embedded-apps-guide#embedded-app-configuration-options | embedded app's configuration options}. * If a URL's domain doesn't match one of the app's allowed domains, or if it uses the `http:` protocol, * then the call fails and an `ACCESS_DENIED` error is returned. * * For URLs that specify custom protocols, the user is presented with a dialog asking them to * allow or deny the request to open the app associated with the specified protocol. If the * user clicks **Open external link** then Webex opens the associated app. Users can optionally * save their preference to always open the associated app. User preferences are * stored in local storage. If the user clicks **Cancel** then the call fails * and an `ACCESS_DENIED` error is returned. * * @param url - The URL to open in the system's default browser. * @returns \{Promise.\\} * @remarks Available since 1.4.0 * @example The following custom function passes a Webex teams space URL ("webexteams:") to `openUrlInSystemBrowser()`. If an error occurs the error message is displayed in the JavaScript console. * ```javascript * function openTeamSpace() { * app.openUrlInSystemBrowser("webexteams://im?space=87a7b58d-bad1-4e2f-83c9-91aeb21c65f6").catch((errorcode) => { * console.log("Error: ", window.webex.Application.ErrorCodes[errorcode]); * }) * } * ``` * @example The following custom function opens an `https` URL. The URL's domain must match one of the embedded app's allowed domains. If an error occurs the error message is displayed in the JavaScript console. * ```javascript * function openSignInPage() { * app.openUrlInSystemBrowser("https://www.example.com/signin").catch((errorcode) => { * console.log("Error: ", window.webex.Application.ErrorCodes[errorcode]); * }) * } * ``` */ openUrlInSystemBrowser(url: string): Promise; /** * * @internal */ getApplicationDiagnostics: () => import("./helpers/types/log.interfaces").IDoc[]; isReady(): boolean; isSDKConstructed(): boolean; isSDKInitialized(): boolean; /** * Fired when an Open Together session is started or ended by the user. The event object is a boolean that's set to `true` if an Open Together session has just started, or `false` if a session has just ended. * * @event * @remarks Available since 1.1.0 * @example * ```javascript * const app = new webex.Application(); * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:shareStateChanged", (event) => { * console.log("Share state changed. Sharing state is:", event); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:shareStateChanged': boolean; /** * Fired when the rendering context of the application changes, for example, when a user pops out the app from the sidebar to a new window. Event object contains the app's new display context. * * Possible values for meeting-based apps are one of, * * - MEETING_SIDEBAR * * - MEETING_STANDALONE_WINDOW * * - MEETING_MAINVIEW (for meeting-based apps) * * Possible values for meeting-based apps are one of, * * - "SPACE_TAB" (for messaging-based apps). * * > **Note** - This event is currently not emitted by messaging-based apps * * @event * @remarks Available since 1.1.0 * @example * ```javascript * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:displayContextChanged", (event) => { * console.log("Display context changed. New display context:", event); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:displayContextChanged': string; /** * Fired when the user selects a new application theme. The event object is a string indicating the newly selected theme. * * Possible values are `LIGHT` and `DARK`. * * @event * @remarks Available since 1.1.0 * @example * ```javascript * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:themeChanged", (event) => { * console.log("Theme changed. New theme:", event); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:themeChanged': string; /** * This event is fired when the application view changes. * * Possible values are IN_FOCUS and OUT_OF_FOCUS. * * @remarks Available since 2.0.0 * @event * @example * ```javascript * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:viewStateChanged", (viewState) => { * console.log("View State Changed. Current state:", viewState); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:viewStateChanged': string; /** * Fired when the user updates their speaker or microphone setting during a Meeting. * * @event * @example * ```javascript * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:selectedAudioDevicesChanged", (event) => { * console.log("Selected Device: ", event); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:selectedAudioDevicesChanged': string; /** * Fired when the application token is refreshed by the host application. * The event callback receives the new JWT token string. * * @event * @remarks Available since 2.1.0 * @example * ```javascript * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("application:tokenRefreshed", (token) => { * console.log("New token:", token); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'application:tokenRefreshed': string; } export { IContext, IWebexAppsApplicationState, IWebexAppsUserState, IWebexAppsMeetingState, IWebexAppsSpaceState, IBadge, IWebexAppsSidebar, ICalls, ICall, IParticipant, ShareOptimizationMode, }; export { WebexAppsApplication, WebexAppsMeeting, WebexAppsSpace, Application, }; //# sourceMappingURL=api.d.ts.map