@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
51 lines • 2.57 kB
TypeScript
import { InjectionToken, Injector } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { GenericHookOptions, GenericHookType, ExtensionPointForPlugins } from '../common/extension-hooks';
import { BetaFeature } from './beta-preview.model';
import { PluginsResolveService } from '../plugins/plugins-resolve.service';
import * as i0 from "@angular/core";
export declare const HOOK_PREVIEW: InjectionToken<BetaFeature[]>;
export declare function hookPreview(preview: GenericHookType<BetaFeature>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider;
export declare class PreviewService extends ExtensionPointForPlugins<BetaFeature> {
items$: Observable<BetaFeature[]>;
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<BetaFeature>;
/**
* Get the state of a specific feature.
* @param key The unique key for the feature.
* @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<BetaFeature[]>;
/**
*
* @returns An array of feature names that have been seen by the user. This is retrieved from local storage.
*/
private getSeenFeatures;
protected setupItemsObservable(): Observable<BetaFeature[]>;
static ɵfac: i0.ɵɵFactoryDeclaration<PreviewService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PreviewService>;
}
//# sourceMappingURL=beta-preview.service.d.ts.map