@o3r/application
Version:
This module provides development help to monitor your Otter Application
163 lines (154 loc) • 6.75 kB
TypeScript
import { DevtoolsCommonOptions, OtterMessageContent, MessageDataTypes, ConnectContentMessage, RequestMessagesContentMessage, DevtoolsServiceInterface } from '@o3r/core';
import * as i0 from '@angular/core';
import { ModuleWithProviders, InjectionToken } from '@angular/core';
/**
* Method that returns the setting of the user regarding animations.
* This setting is generally set in the Operating System settings, and it is used by browsers.
* Refer to: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
*/
declare function prefersReducedMotion(): boolean;
interface ApplicationDevtoolsServiceOptions extends DevtoolsCommonOptions {
/**
* Application name
*/
appName?: string;
/**
* CSS classname applied to an HTML tag to hide it, ignore it, in the e2e visual testing process
*/
e2eIgnoreClass?: string;
}
/**
* Session information used to track all the calls done by one or several APIs of the SDK.
*/
interface SessionInformation {
/**
* The session ID
*/
id: string;
/**
* The generated time
*/
generatedTime: Date;
}
/** Information relative loaded application */
interface ApplicationInformation {
/**
* Application name
*/
appName: string;
/** Application Version */
appVersion: string;
/**
* Session Information
* @note This is a session ID will be provided only with the Amadeus Otter implementation of the application package.
*/
session?: SessionInformation;
/**
* Log Link
* @note This a link to Alf logs, it will be provided only with the Amadeus Otter implementation of the application package.
*/
logLink?: string;
/** Is Production Environment */
isProduction: boolean;
}
/** Toggle Visual Testing */
interface ToggleVisualTestingMessage extends OtterMessageContent<'toggleVisualTesting'> {
/** Toggle the visual testing mode */
toggle?: boolean;
}
/** Application Information Message Content */
interface ApplicationInformationContentMessage extends ApplicationInformation, OtterMessageContent<'applicationInformation'> {
}
/** State selection message */
interface StateSelectionContentMessage extends OtterMessageContent<'stateSelection'> {
/** Name of the state */
stateName: string;
/** Color of the state */
stateColor: string;
/** Contrast color of the state */
stateColorContrast: string;
}
/** Unselect state message */
interface UnselectStateContentMessage extends OtterMessageContent<'unselectState'> {
}
type ApplicationMessageContents = ApplicationInformationContentMessage | StateSelectionContentMessage | UnselectStateContentMessage | ToggleVisualTestingMessage;
/** List of possible DataTypes for Application messages */
type ApplicationMessageDataTypes = MessageDataTypes<ApplicationMessageContents>;
/** List of all messages for application purpose */
type AvailableApplicationMessageContents = ApplicationMessageContents | ConnectContentMessage | RequestMessagesContentMessage<ApplicationMessageDataTypes>;
/**
* Determine if the given message is a Application message
* @param message message to check
*/
declare const isApplicationMessage: (message: any) => message is AvailableApplicationMessageContents;
declare class ApplicationDevtoolsConsoleService implements DevtoolsServiceInterface {
/** Name of the Window property to access to the devtools */
static readonly windowModuleName = "application";
private readonly applicationDevtools;
private readonly options;
constructor();
/** @inheritDoc */
activate(): void;
/** Display the information relative to the running application */
displayApplicationInfo(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationDevtoolsConsoleService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationDevtoolsConsoleService>;
}
declare class ApplicationDevtoolsMessageService implements DevtoolsServiceInterface {
private readonly document;
private readonly options;
private readonly sendMessage;
private readonly destroyRef;
private readonly logger;
private readonly applicationDevtools;
constructor();
private sendApplicationInformation;
/**
* Function to connect the plugin to the Otter DevTools extension
*/
private connectPlugin;
/**
* Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension
* @param only restricted list of messages to re-send
*/
private handleReEmitRequest;
/**
* Function to handle the incoming messages from Otter Chrome DevTools extension
* @param message
*/
private handleEvents;
private unselectState;
private onStateSelection;
/**
* Toggle visual testing rendering
* @param enabled activate or deactivate the visual testing mode
*/
private toggleVisualTestingRender;
/** @inheritDoc */
activate(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationDevtoolsMessageService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationDevtoolsMessageService>;
}
declare class ApplicationDevtoolsModule {
/**
* Initialize Otter Devtools
* @param options
*/
static instrument(options: Partial<ApplicationDevtoolsServiceOptions>): ModuleWithProviders<ApplicationDevtoolsModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationDevtoolsModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ApplicationDevtoolsModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<ApplicationDevtoolsModule>;
}
declare class OtterApplicationDevtools {
private readonly options;
private readonly document;
private readonly env;
getApplicationInformation(): ApplicationInformation;
static ɵfac: i0.ɵɵFactoryDeclaration<OtterApplicationDevtools, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<OtterApplicationDevtools>;
}
declare const OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS: Readonly<ApplicationDevtoolsServiceOptions>;
declare const OTTER_APPLICATION_DEVTOOLS_OPTIONS: InjectionToken<ApplicationDevtoolsServiceOptions>;
export { ApplicationDevtoolsConsoleService, ApplicationDevtoolsMessageService, ApplicationDevtoolsModule, OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS, OTTER_APPLICATION_DEVTOOLS_OPTIONS, OtterApplicationDevtools, isApplicationMessage, prefersReducedMotion };
export type { ApplicationDevtoolsServiceOptions, ApplicationInformation, ApplicationInformationContentMessage, ApplicationMessageDataTypes, AvailableApplicationMessageContents, SessionInformation, StateSelectionContentMessage, ToggleVisualTestingMessage, UnselectStateContentMessage };
//# sourceMappingURL=index.d.ts.map