@cauca-911/core
Version:
Run `npm install @cauca-911/core` to add this library to your project
343 lines (311 loc) • 12.8 kB
TypeScript
import * as i0 from '@angular/core';
import { Injector, Provider, EnvironmentProviders, InjectionToken, EventEmitter } from '@angular/core';
import { Observable } from 'rxjs';
import * as i3 from '@ngx-translate/core';
import { TranslateService as TranslateService$1 } from '@ngx-translate/core';
export { TranslatePipe } from '@ngx-translate/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
declare enum LogLevel {
trace = 0,
debug = 1,
information = 2,
warning = 3,
error = 4,
critical = 5,
disconnection = 6
}
declare class RefreshToken {
accessToken: string;
refreshToken: string;
}
type LoginUrlFunction = () => string;
type RefreshUrlFunction = () => string;
type LogErrorFunction = (level: LogLevel, message: string, data: any) => void;
type UpdateTokenFunction = (newToken: RefreshToken) => void;
type HttpErrorFunction = (error: any, method: string, url: string) => void;
declare class CoreModuleOptions {
logLevel: LogLevel;
apiUrl: string;
languages: string[];
autoLoadMaterialLocales: boolean;
refreshLoginURL: string | RefreshUrlFunction;
allowRefreshToken: boolean;
libraries: string[];
i18nPaths: string[];
locale: string;
jsonConfigFile: string;
nbRetryOnNetworkError: number;
contentSecurityPolicyActivated: boolean;
loginURL: string | LoginUrlFunction;
keepReturnUrlWhenRedirectingToLogin: boolean;
useLogoutService: boolean;
logError: LogErrorFunction;
updateToken: UpdateTokenFunction;
onHttpError: HttpErrorFunction;
}
declare class Configuration {
jsonConfigFile: string;
libraries: string[];
i18nPaths: string[];
loginURL: LoginUrlFunction;
logError: LogErrorFunction;
updateToken: UpdateTokenFunction;
onHttpError: HttpErrorFunction;
refreshLoginURL: RefreshUrlFunction;
useLogoutService: boolean;
allowRefreshToken: boolean;
autoLoadMaterialLocales: boolean;
logLevel: LogLevel;
apiUrl: string;
nbRetryOnNetworkError: number;
contentSecurityPolicyActivated: boolean;
keepReturnUrlWhenRedirectingToLogin: boolean;
private useCharset;
private useAuthorizationType;
private useAccessToken;
private useRefreshToken;
private useCSRFToken;
private useLocale;
private useLanguages;
constructor(options: CoreModuleOptions);
get locale(): string;
set locale(value: string);
get languages(): string[];
set languages(value: string[]);
get charset(): string;
set charset(value: string);
get authorizationType(): string;
set authorizationType(value: string);
get refreshToken(): string;
set refreshToken(value: string);
get accessToken(): string;
set accessToken(value: string);
get CSRFToken(): string;
set CSRFToken(value: string);
get CSRFCookie(): string;
set CSRFCookie(value: string);
private setDefaultLocale;
private setLoginUrl;
private setRefreshUrl;
private defaultLogError;
}
declare class CaucaCoreService {
private httpBackend;
private translateService;
private config;
private jsonIsLoaded;
appInitializer(coreOptions: CoreModuleOptions): Promise<void>;
getConfig(): Configuration;
toggleLanguage(): void;
setLanguage(language: string): void;
private setupLocale;
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaCoreService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CaucaCoreService>;
}
declare class CaucaCoreComponent {
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaCoreComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CaucaCoreComponent, "cauca-core", never, {}, {}, never, never, false, never>;
}
declare class TranslateService extends TranslateService$1 {
private coreService;
private http;
private multiLangDictionary;
constructor();
appInitializer(): Promise<void>;
getMultilingualTranslations(languages: string[], wordsToTranslate: string[]): Observable<any>;
private loadOneLanguage;
private getTranslationForSpecificLanguages;
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslateService>;
}
declare class LogService {
private coreService;
private config;
private httpClient;
private errors;
private activeSending;
private timer;
constructor();
get errorCount(): number;
get waitToSendAgain(): boolean;
information(message: string, data?: any): void;
warning(message: string, data?: any): void;
error(message: string, data?: any): void;
disconnection(message: string, data?: any): void;
publishInformation(error: any, data?: any): void;
publishWarning(error: any, data?: any): void;
publishError(error: any, data?: any): void;
private sendErrors;
private stopTimer;
static ɵfac: i0.ɵɵFactoryDeclaration<LogService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<LogService>;
}
declare class CaucaPageNotFoundComponent {
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaPageNotFoundComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CaucaPageNotFoundComponent, "cauca-page-not-found", never, {}, {}, never, never, false, never>;
}
declare const configFactory: (coreService: CaucaCoreService) => string;
declare const translateFactory: (translateService: TranslateService, coreOptions: CoreModuleOptions, coreService: CaucaCoreService, logService: LogService, injector: Injector) => any;
declare class CaucaCoreModule {
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaCoreModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CaucaCoreModule, [typeof CaucaCoreComponent, typeof CaucaPageNotFoundComponent], [typeof i3.TranslateModule], [typeof CaucaCoreComponent, typeof CaucaPageNotFoundComponent, typeof i3.TranslateModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CaucaCoreModule>;
}
declare function importCaucaCoreTranslateProviders(): (Provider | EnvironmentProviders);
declare function provideCaucaCore(options: CoreModuleOptions): (Provider | EnvironmentProviders)[];
declare const configFactoryForLazyLoading: (coreService: CaucaCoreService) => string;
declare class CaucaCoreForChildModule {
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaCoreForChildModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CaucaCoreForChildModule, never, [typeof i3.TranslateModule], [typeof i3.TranslateModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CaucaCoreForChildModule>;
}
declare const createApiLookupServiceSpy: () => any;
declare const createNetworkInformationServiceSpy: () => any;
declare const createTranslateServiceSpy: () => any;
declare class CaucaCoreTestingModule {
static ɵfac: i0.ɵɵFactoryDeclaration<CaucaCoreTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CaucaCoreTestingModule, never, [typeof CaucaCoreModule, typeof i3.TranslateModule], [typeof CaucaCoreModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CaucaCoreTestingModule>;
}
declare const CAUCA_CORE_MODULE_OPTIONS: InjectionToken<CoreModuleOptions>;
declare const Debounce: (ms: number) => any;
declare class RefreshTokenService {
private coreService;
private logService;
private router;
private logoutHandler;
private refreshUrlService;
private http;
private errorPrefix;
constructor();
refreshToken(): Observable<boolean>;
refreshTokenWithRedirect(): Observable<boolean>;
private logout;
private postRefreshToken;
static ɵfac: i0.ɵɵFactoryDeclaration<RefreshTokenService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RefreshTokenService>;
}
declare class Browser {
browserName: string;
browserVersion: string;
engineName: string;
engineVersion: string;
private agent;
private pattern;
constructor();
toString(): string;
private detectVersion;
private detectBrowser;
private detectGeckoBrowser;
private detectTridentBrowser;
private detectWebkitBrowser;
}
declare class OperatingSystem {
name: string;
version: string;
private agent;
constructor();
toString(): string;
private detect;
private detectVersion;
private detectVersionWindows;
private detectVersionWindowsPhone;
private detectVersionMac;
}
declare class ClientInformationService {
visibilityChange: EventEmitter<any>;
private config;
private readonly apiLookup;
constructor();
getCoordinates(): Observable<number[]>;
getLanguage(): Observable<string[]>;
getBrowser(): Observable<Browser>;
getOperatingSystem(): Observable<OperatingSystem>;
private getCoordinatesWithClientIP;
private onVisibilityChange;
static ɵfac: i0.ɵɵFactoryDeclaration<ClientInformationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ClientInformationService>;
}
declare class FullscreenService {
statusChange: EventEmitter<any>;
constructor();
show(element: any): void;
exit(): void;
isActive(): boolean;
private onChange;
static ɵfac: i0.ɵɵFactoryDeclaration<FullscreenService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<FullscreenService>;
}
declare class ImageService {
compress(file: File, maxWidth?: number, maxHeight?: number): Observable<File>;
private findRatio;
static ɵfac: i0.ɵɵFactoryDeclaration<ImageService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ImageService>;
}
declare class NetworkInformationService {
statusChange: EventEmitter<any>;
private estimates;
private readonly apiLookupService;
private readonly logService;
constructor();
getConnectionSpeed(): Observable<string>;
getIpAddress(): Observable<string>;
private estimateDownlink;
private onStatusChange;
static ɵfac: i0.ɵɵFactoryDeclaration<NetworkInformationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NetworkInformationService>;
}
declare class VersionCheckService {
private httpClient;
private activeVersion;
private timeInMinute;
constructor();
initVersionCheck(activeVersion: string, url?: string, frequency?: number): void;
checkVersion(url: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<VersionCheckService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<VersionCheckService>;
}
declare abstract class RefreshUrlService {
abstract getRefreshUrl(): any;
}
interface InterceptorError {
statusCode: number;
message: string;
}
interface InterceptorDelay {
url: string;
startingTime: Date;
endingTime: Date;
totalInMilliseconds: number;
}
declare class InterceptorErrorService {
error: EventEmitter<InterceptorError>;
append(statusCode: number, message: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<InterceptorErrorService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<InterceptorErrorService>;
}
declare class InterceptorDelayService {
delay: EventEmitter<InterceptorDelay>;
private listOfDelay;
append(interceptorDelay: InterceptorDelay): void;
getLongestRequest(): InterceptorDelay;
getLatestRequests(): InterceptorDelay[];
static ɵfac: i0.ɵɵFactoryDeclaration<InterceptorDelayService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<InterceptorDelayService>;
}
declare class HttpDelayInterceptor implements HttpInterceptor {
private logService;
private interceptorDelayService;
private startingTime;
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>;
static ɵfac: i0.ɵɵFactoryDeclaration<HttpDelayInterceptor, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<HttpDelayInterceptor>;
}
declare class Color {
hslToRgb(h: number, s: number, l: number): number[];
getContrast50(hexColor: string): string;
getContrastYIQ(hexColor: string): string;
}
declare function toLowerCaseAndWithoutDiacritics(value: string): string;
export { Browser, CAUCA_CORE_MODULE_OPTIONS, CaucaCoreComponent, CaucaCoreForChildModule, CaucaCoreModule, CaucaCoreService, CaucaCoreTestingModule, CaucaPageNotFoundComponent, ClientInformationService, Color, Configuration, Debounce, FullscreenService, HttpDelayInterceptor, ImageService, InterceptorDelayService, InterceptorErrorService, LogLevel, LogService, NetworkInformationService, OperatingSystem, RefreshTokenService, RefreshUrlService, TranslateService, VersionCheckService, configFactory, configFactoryForLazyLoading, createApiLookupServiceSpy, createNetworkInformationServiceSpy, createTranslateServiceSpy, importCaucaCoreTranslateProviders, provideCaucaCore, toLowerCaseAndWithoutDiacritics, translateFactory };
export type { InterceptorDelay, InterceptorError };