UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

52 lines 2.72 kB
import { InjectionToken, Injector } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { GenericHookOptions, GenericHookType, ExtensionPointForPlugins } from '../common/extension-hooks'; import { PreviewFeature } from './preview-feature.model'; import { PluginsResolveService } from '../plugins/plugins-resolve.service'; import * as i0 from "@angular/core"; export declare const HOOK_PREVIEW: InjectionToken<PreviewFeature[]>; export declare function hookPreview(preview: GenericHookType<PreviewFeature>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider; export declare class PreviewService extends ExtensionPointForPlugins<PreviewFeature> { items$: Observable<PreviewFeature[]>; reload$: BehaviorSubject<boolean>; private readonly LOCAL_STORAGE_KEY; private seenFeatures$; hasUnseenFeatures$: Observable<boolean>; private readonly featureService; private readonly featureCacheService; private readonly optionsService; private toggledFeaturesWithReload; constructor(rootInjector: Injector, pluginService: PluginsResolveService); get state(): Set<PreviewFeature>; /** * Get the state of a specific feature. * @param key The unique key or label for the feature. Label is used to find the custom features. * @returns Observable<boolean> representing the state of the feature. */ getState$(key: string): Observable<boolean>; /** * Toggle the state of a specific feature. * @param key The unique key or label for the feature. Label is used to find the custom features. * @returns Promise<void> after toggling the state. */ setFeatureActiveState(key: string, toggleValue: boolean): Promise<void>; /** * Marks all unseen features as seen by the user and updates the local storage. * This assumes all features are provided via the `items$` observable. */ markAllFeaturesAsSeen(): Promise<void>; /** * Filters the features to only include those that are available by checking the feature toggle API. */ getAvailableFeatures$(): Observable<PreviewFeature[]>; checkIfReloadNeeded(feature: PreviewFeature, key: string): void; /** * * @returns An array of feature names that have been seen by the user. This is retrieved from local storage. */ private getSeenFeatures; protected setupItemsObservable(): Observable<PreviewFeature[]>; static ɵfac: i0.ɵɵFactoryDeclaration<PreviewService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PreviewService>; } //# sourceMappingURL=preview-feature.service.d.ts.map