saltfish
Version:
An interactive video-guided tour system for web applications
85 lines • 2.91 kB
TypeScript
import type { PlaylistPathInfo } from '../types';
/**
* Manages autoStart playlist triggers
* Evaluates trigger conditions and launches playlists automatically
*/
export declare class TriggerManager {
private autoStartPlaylists;
private triggeredPlaylists;
private isMonitoring;
constructor();
/**
* Registers autoStart playlists and their trigger configurations
* @param playlists - List of all playlists from backend
*/
registerTriggers(playlists: PlaylistPathInfo[]): void;
/**
* Starts monitoring for trigger conditions
*/
startMonitoring(): void;
/**
* Stops monitoring for trigger conditions
*/
stopMonitoring(): void;
/**
* Evaluates all registered triggers against current conditions
* Called by TransitionManager when URL changes occur
*/
evaluateAllTriggers(): void;
/**
* Evaluates triggers for a specific playlist
* @param playlist - The playlist to evaluate triggers for
*/
private evaluatePlaylistTrigger;
/**
* Evaluates the 'once' condition for a playlist
* @param once - Whether playlist should only trigger once per user
* @param playlistId - The playlist ID to check
* @param watchedPlaylists - User's watched playlists data
*/
private evaluateOnceCondition;
/**
* Evaluates the URL condition for a playlist
* @param pattern - URL pattern to match against (null = no URL condition)
*/
private evaluateURLCondition;
/**
* Evaluates the playlistSeen condition
* User must have seen ALL specified playlists
* @param requiredPlaylists - Array of playlist IDs that user must have seen
* @param watchedPlaylists - User's watched playlists data
*/
private evaluatePlaylistSeenCondition;
/**
* Evaluates the playlistNotSeen condition
* User must NOT have seen ANY of the specified playlists
* @param forbiddenPlaylists - Array of playlist IDs that user must not have seen
* @param watchedPlaylists - User's watched playlists data
*/
private evaluatePlaylistNotSeenCondition;
/**
* Applies logical operators to combine multiple conditions
* @param conditions - Array of boolean conditions to combine
* @param operators - Array of operators ("AND" or "OR")
*/
private applyOperators;
/**
* Triggers a playlist to start
* @param playlistId - ID of the playlist to trigger
*/
private triggerPlaylist;
/**
* Resets the triggered playlists tracking
* Useful for testing or when user context changes
*/
resetTriggeredPlaylists(): void;
/**
* Gets list of playlists that have been triggered this session
*/
getTriggeredPlaylists(): string[];
/**
* Cleanup method to be called on destroy
*/
destroy(): void;
}
//# sourceMappingURL=TriggerManager.d.ts.map