@memberjunction/ng-shared
Version:
MemberJunction: MJ Explorer Angular Shared Package - utility functions and other reusable elements used across other MJ Angular packages within the MJ Explorer App - do not use outside of MJ Explorer.
145 lines • 6.61 kB
TypeScript
import { ElementRef, Injector } from '@angular/core';
import { CompositeKey } from '@memberjunction/core';
import { ResourceTypeEntity, UserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';
import { Observable } from 'rxjs';
import { NotificationService } from "@progress/kendo-angular-notification";
import { MJNotificationService } from '@memberjunction/ng-notifications';
import * as i0 from "@angular/core";
export declare class SharedService {
private notificationService;
private mjNotificationsService;
private injector;
private static _instance;
private static _loaded;
private static _resourceTypes;
private static isLoading$;
private tabChange;
tabChange$: Observable<unknown>;
private _navigationService;
constructor(notificationService: NotificationService, mjNotificationsService: MJNotificationService, injector: Injector);
static get Instance(): SharedService;
/**
* Pre-warms commonly used engines in the background after login.
* This reduces perceived latency when users navigate to features like
* Conversations, Dashboards, or Artifacts. Fire-and-forget pattern -
* errors are logged but don't block the UI.
*/
private static preWarmEngines;
/**
* Get the NavigationService singleton instance
* Lazy-loaded to avoid circular dependency issues
*/
private get navigationService();
/**
* Get the neutral color used for system-wide resources
*/
get ExplorerAppColor(): string;
/**
* Returns the current session ID, which is automatically created when the service is instantiated.
*/
get SessionId(): string;
get ResourceTypes(): ResourceTypeEntity[];
get ViewResourceType(): ResourceTypeEntity;
get RecordResourceType(): ResourceTypeEntity;
get DashboardResourceType(): ResourceTypeEntity;
get ReportResourceType(): ResourceTypeEntity;
get SearchResultsResourceType(): ResourceTypeEntity;
get ListResourceType(): ResourceTypeEntity;
ResourceTypeByID(id: string): ResourceTypeEntity | undefined;
ResourceTypeByName(name: string): ResourceTypeEntity | undefined;
/**
* Refreshes the data for the service. If OnlyIfNeeded is true, then the data is only refreshed if it hasn't been loaded yet.
*/
static RefreshData(OnlyIfNeeded?: boolean): Promise<void>;
private static handleDataLoading;
FormatColumnValue(col: ViewColumnInfo, value: any, maxLength?: number, trailingChars?: string): any;
ConvertMarkdownStringToHtmlList(listType: HtmlListType, text: string): string;
InvokeManualResize(delay?: number): void;
PushStatusUpdates(): Observable<string>;
private _currentUserImage;
get CurrentUserImage(): string | Blob;
set CurrentUserImage(value: string | Blob);
/**
* @deprecated Use MJNotificationService.UserNotifications instead
*/
static get UserNotifications(): UserNotificationEntity[];
/**
* @deprecated Use MJNotificationService.UnreadUserNotifications instead
*/
static get UnreadUserNotifications(): UserNotificationEntity[];
/**
* @deprecated Use MJNotificationService.UnreadUserNotificationCount instead
*/
static get UnreadUserNotificationCount(): number;
/**
* Utility method that returns true if child is a descendant of parent, false otherwise.
*/
static IsDescendant(parent: ElementRef, child: ElementRef): boolean;
/**
* Creates a notification in the database and refreshes the UI. Returns the notification object.
* @param title
* @param message
* @param resourceTypeId
* @param resourceRecordId
* @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database
* @returns
* @deprecated Use MJNotificationService.CreateNotification instead
*/
CreateNotification(title: string, message: string, resourceTypeId: string | null, resourceRecordId: string | null, resourceConfiguration: any | null, displayToUser?: boolean): Promise<UserNotificationEntity>;
/**
* @deprecated Use MJNotificationService.RefreshUserNotifications instead
*/
static RefreshUserNotifications(): Promise<void>;
/**
* Creates a message that is not saved to the User Notifications table, but is displayed to the user.
* @param message - text to display
* @param style - display styling
* @param hideAfter - option to auto hide after the specified delay in milliseconds
* @deprecated Use MJNotificationService.CreateSimpleNotification instead
*/
CreateSimpleNotification(message: string, style?: "none" | "success" | "error" | "warning" | "info", hideAfter?: number): void;
private _resourceTypeMap;
/**
* Maps a Resource Type record Name column to the corresponding route segment
* @param resourceTypeName
* @returns
*/
mapResourceTypeNameToRouteSegment(resourceTypeName: string): string | null;
/**
* Maps a route segment to the corresponding Resource Type record Name column
* @param resourceRouteSegment
* @returns
*/
mapResourceTypeRouteSegmentToName(resourceRouteSegment: string): string | null;
/**
* Opens an entity record in a new or existing tab
* Uses the modern NavigationService for tab-based navigation
*/
OpenEntityRecord(entityName: string, recordPkey: CompositeKey): void;
static ɵfac: i0.ɵɵFactoryDeclaration<SharedService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SharedService>;
}
export declare const HtmlListType: {
readonly Unordered: "Unordered";
readonly Ordered: "Ordered";
};
export type HtmlListType = typeof HtmlListType[keyof typeof HtmlListType];
export declare const EventCodes: {
readonly ViewClicked: "ViewClicked";
readonly EntityRecordClicked: "EntityRecordClicked";
readonly AddDashboard: "AddDashboard";
readonly AddReport: "AddReport";
readonly AddQuery: "AddQuery";
readonly ViewCreated: "ViewCreated";
readonly ViewUpdated: "ViewUpdated";
readonly RunSearch: "RunSearch";
readonly ViewNotifications: "ViewNotifications";
readonly PushStatusUpdates: "PushStatusUpdates";
readonly UserNotificationsUpdated: "UserNotificationsUpdated";
readonly CloseCurrentTab: "CloseCurrentTab";
readonly ListCreated: "ListCreated";
readonly ListClicked: "ListClicked";
readonly AvatarUpdated: "AvatarUpdated";
};
export type EventCodes = typeof EventCodes[keyof typeof EventCodes];
//# sourceMappingURL=shared.service.d.ts.map