@optifye/dashboard-core 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,13 +2,14 @@ import * as _supabase_supabase_js from '@supabase/supabase-js';
2
2
  import { SupabaseClient as SupabaseClient$1, Session, User, AuthError } from '@supabase/supabase-js';
3
3
  import { LucideProps, Share2, Download } from 'lucide-react';
4
4
  import * as React$1 from 'react';
5
- import React__default, { ReactNode } from 'react';
5
+ import React__default, { ReactNode, HTMLAttributes } from 'react';
6
6
  import * as querystring from 'querystring';
7
- import { ClassValue } from 'clsx';
8
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
- import * as SelectPrimitive from '@radix-ui/react-select';
10
8
  import { Modifiers } from 'react-day-picker';
11
9
  import html2canvas from 'html2canvas';
10
+ import * as SelectPrimitive from '@radix-ui/react-select';
11
+ import { NextApiRequest, NextApiResponse } from 'next';
12
+ import { ClassValue } from 'clsx';
12
13
 
13
14
  interface LineInfo {
14
15
  line_id: string;
@@ -84,6 +85,7 @@ interface WorkspaceDetailedMetrics {
84
85
  total_workspaces: number;
85
86
  ideal_output_until_now: number;
86
87
  output_difference: number;
88
+ idle_time?: number;
87
89
  compliance_efficiency?: number;
88
90
  sop_check?: Record<string, number>;
89
91
  }
@@ -153,6 +155,7 @@ interface DashboardConfig {
153
155
  workspaceConfig?: WorkspaceConfig;
154
156
  endpoints?: EndpointsConfig;
155
157
  edgeFunctionBaseUrl?: string;
158
+ s3Config?: S3Config;
156
159
  /** Feature flags or other arbitrary app-specific config */
157
160
  featureFlags?: Record<string, boolean>;
158
161
  /** Generic object to allow any other custom config values needed by the app or overrides */
@@ -214,6 +217,16 @@ interface DateTimeConfig {
214
217
  timeFormatOptions?: Intl.DateTimeFormatOptions;
215
218
  dateTimeFormatOptions?: Intl.DateTimeFormatOptions;
216
219
  }
220
+ interface S3Config {
221
+ bucketName: string;
222
+ region?: string;
223
+ cloudFrontDomain: string;
224
+ credentials?: {
225
+ accessKeyId: string;
226
+ secretAccessKey: string;
227
+ };
228
+ signedUrlExpiresIn?: number;
229
+ }
217
230
 
218
231
  interface BasePerformanceMetric {
219
232
  id: string;
@@ -872,35 +885,43 @@ interface FactoryViewProps {
872
885
  productIds?: Record<string, string>;
873
886
  }
874
887
 
875
- declare const DEFAULT_DATABASE_CONFIG: DatabaseConfig;
876
- declare const DEFAULT_ENTITY_CONFIG: EntityConfig;
877
- declare const DEFAULT_SHIFT_CONFIG: ShiftConfig;
878
- declare const DEFAULT_WORKSPACE_CONFIG: WorkspaceConfig;
879
- declare const DEFAULT_DATE_TIME_CONFIG: DateTimeConfig;
880
- declare const DEFAULT_ENDPOINTS_CONFIG: EndpointsConfig;
881
- declare const DEFAULT_THEME_CONFIG: ThemeConfig;
882
- declare const DEFAULT_ANALYTICS_CONFIG: AnalyticsConfig;
883
- declare const DEFAULT_AUTH_CONFIG: AuthConfig;
884
- declare const LINE_1_UUID = "910a224b-0abc-459a-babb-4c899824cfe7";
885
- declare const DEFAULT_CONFIG: Omit<DashboardConfig, 'supabaseUrl' | 'supabaseKey'>;
886
-
887
- /**
888
- * Standard action names used across the dashboard.
889
- * These represent common operations or activities tracked in the system.
890
- */
891
- declare const ACTION_NAMES: {
892
- /** Assembly operations */
893
- readonly ASSEMBLY: "Assembly";
894
- /** Packaging operations */
895
- readonly PACKAGING: "Packaging";
896
- /** Inspection operations */
897
- readonly INSPECTION: "Inspection";
898
- /** Testing operations */
899
- readonly TESTING: "Testing";
900
- /** Quality control operations */
901
- readonly QUALITY_CONTROL: "Quality Control";
902
- };
903
- type ActionName = typeof ACTION_NAMES[keyof typeof ACTION_NAMES];
888
+ interface BottleneckVideoData {
889
+ id: string;
890
+ src: string;
891
+ timestamp: string;
892
+ severity: 'low' | 'medium' | 'high';
893
+ description: string;
894
+ type: 'bottleneck' | 'low_value' | 'best_cycle_time' | 'worst_cycle_time' | 'missing_quality_check';
895
+ originalUri: string;
896
+ cycle_time_seconds?: number;
897
+ }
898
+ interface VideoSummary {
899
+ counts: Record<string, number>;
900
+ samples: Record<string, BottleneckVideoData | null>;
901
+ }
902
+ interface S3ClipsAPIParams {
903
+ workspaceId: string;
904
+ date?: string;
905
+ shift?: string;
906
+ category?: string;
907
+ limit?: number;
908
+ mode?: 'summary' | 'full';
909
+ includeCycleTime?: boolean;
910
+ }
911
+ interface S3ListObjectsParams {
912
+ workspaceId: string;
913
+ date: string;
914
+ shiftId: number;
915
+ maxKeys?: number;
916
+ }
917
+ interface VideoMetadata {
918
+ original_task_metadata?: {
919
+ cycle_time?: number;
920
+ };
921
+ [key: string]: any;
922
+ }
923
+ type VideoType = 'bottleneck' | 'low_value' | 'best_cycle_time' | 'worst_cycle_time' | 'missing_quality_check';
924
+ type VideoSeverity = 'low' | 'medium' | 'high';
904
925
 
905
926
  interface DashboardProviderProps {
906
927
  config: Partial<DashboardConfig>;
@@ -1706,6 +1727,90 @@ declare const useFactoryOverviewMetrics: (options?: UseFactoryOverviewOptions) =
1706
1727
  refetch: () => Promise<void>;
1707
1728
  };
1708
1729
 
1730
+ /**
1731
+ * @typedef UseWorkspaceDisplayNamesReturn
1732
+ * @description Return type of the `useWorkspaceDisplayNames` hook.
1733
+ * @property {Record<string, string>} displayNames - Map of workspace_id -> display_name
1734
+ * @property {boolean} loading - Whether the hook is currently fetching data
1735
+ * @property {Error | null} error - Any error that occurred during fetching
1736
+ * @property {() => void} refetch - Function to manually refetch data
1737
+ */
1738
+ interface UseWorkspaceDisplayNamesReturn {
1739
+ displayNames: Record<string, string>;
1740
+ loading: boolean;
1741
+ error: Error | null;
1742
+ refetch: () => void;
1743
+ }
1744
+ /**
1745
+ * @hook useWorkspaceDisplayNames
1746
+ * @summary Hook for fetching and managing workspace display names from Supabase
1747
+ * @description This hook provides workspace display names from the Supabase database with proper
1748
+ * loading states, error handling, and caching. It automatically fetches workspace display names
1749
+ * on mount and provides utility methods for accessing individual workspace names.
1750
+ *
1751
+ * @param {string} [companyId] - Optional company ID to filter workspaces
1752
+ * @param {string} [lineId] - Optional line ID to filter workspaces
1753
+ * @returns {UseWorkspaceDisplayNamesReturn} An object containing display names, loading state, error, and utility functions
1754
+ *
1755
+ * @example
1756
+ * const { displayNames, loading, error, getDisplayName } = useWorkspaceDisplayNames();
1757
+ *
1758
+ * if (loading) return <div>Loading...</div>;
1759
+ * if (error) return <div>Error: {error.message}</div>;
1760
+ *
1761
+ * const workspaceName = getDisplayName('WS01'); // Returns display name or fallback
1762
+ */
1763
+ declare const useWorkspaceDisplayNames: (companyId?: string, lineId?: string) => UseWorkspaceDisplayNamesReturn;
1764
+ /**
1765
+ * @hook useWorkspaceDisplayName
1766
+ * @summary Hook for fetching a single workspace display name
1767
+ * @description This hook fetches a single workspace display name from Supabase with proper
1768
+ * loading state and error handling. It's useful when you only need one workspace name.
1769
+ *
1770
+ * @param {string} workspaceId - The workspace ID to fetch the display name for
1771
+ * @param {string} [companyId] - Optional company ID to filter workspaces
1772
+ * @param {string} [lineId] - Optional line ID to filter workspaces
1773
+ * @returns {object} An object containing displayName, loading state, error, and refetch function
1774
+ *
1775
+ * @example
1776
+ * const { displayName, loading, error } = useWorkspaceDisplayName('WS01');
1777
+ *
1778
+ * if (loading) return <span>Loading...</span>;
1779
+ * return <span>{displayName}</span>;
1780
+ */
1781
+ declare const useWorkspaceDisplayName: (workspaceId: string, companyId?: string, lineId?: string) => {
1782
+ displayName: string;
1783
+ loading: boolean;
1784
+ error: Error | null;
1785
+ refetch: () => Promise<void>;
1786
+ };
1787
+ /**
1788
+ * @hook useWorkspaceDisplayNamesMap
1789
+ * @summary Hook for fetching multiple workspace display names as a map
1790
+ * @description This hook fetches display names for multiple workspaces and returns them
1791
+ * as a Record<string, string> for easy lookup. Useful when you need names for a specific set of workspaces.
1792
+ *
1793
+ * @param {string[]} workspaceIds - Array of workspace IDs to fetch display names for
1794
+ * @param {string} [companyId] - Optional company ID to filter workspaces
1795
+ * @param {string} [lineId] - Optional line ID to filter workspaces
1796
+ * @returns {object} An object containing displayNamesMap, loading state, error, and refetch function
1797
+ *
1798
+ * @example
1799
+ * const { displayNamesMap, loading } = useWorkspaceDisplayNamesMap(['WS01', 'WS02', 'WS03']);
1800
+ *
1801
+ * if (!loading) {
1802
+ * workspaceIds.forEach(id => {
1803
+ * console.log(`${id}: ${displayNamesMap[id]}`);
1804
+ * });
1805
+ * }
1806
+ */
1807
+ declare const useWorkspaceDisplayNamesMap: (workspaceIds: string[], companyId?: string, lineId?: string) => {
1808
+ displayNames: Record<string, string>;
1809
+ loading: boolean;
1810
+ error: Error | null;
1811
+ refetch: () => Promise<void>;
1812
+ };
1813
+
1709
1814
  /**
1710
1815
  * Interface for navigation method used across packages
1711
1816
  * Abstracts navigation implementation details from components
@@ -1767,6 +1872,7 @@ interface LineNavigationParams {
1767
1872
  * @property {() => void} goToShifts - Navigates to the '/shifts' page.
1768
1873
  * @property {() => void} goToLeaderboard - Navigates to the '/leaderboard' page.
1769
1874
  * @property {() => void} goToFactoryView - Navigates to the '/factory-view' page.
1875
+ * @property {() => void} goToProfile - Navigates to the '/profile' page.
1770
1876
  * @property {(path: string, options?: NavigationOptions) => Promise<void>} navigate - Navigates to an arbitrary path with retry logic and optional tracking.
1771
1877
  */
1772
1878
  /**
@@ -1803,6 +1909,7 @@ declare function useNavigation(customNavigate?: NavigationMethod): {
1803
1909
  goToShifts: () => void;
1804
1910
  goToLeaderboard: () => void;
1805
1911
  goToFactoryView: () => void;
1912
+ goToProfile: () => void;
1806
1913
  navigate: NavigationMethod;
1807
1914
  };
1808
1915
 
@@ -1906,6 +2013,25 @@ interface UseFormatNumberResult {
1906
2013
  */
1907
2014
  declare const useFormatNumber: () => UseFormatNumberResult;
1908
2015
 
2016
+ interface UseHlsStreamOptions {
2017
+ src: string;
2018
+ shouldPlay: boolean;
2019
+ onFatalError?: () => void;
2020
+ }
2021
+ /**
2022
+ * Enterprise-grade HLS streaming hook with auto-recovery
2023
+ *
2024
+ * Recovery timing configuration:
2025
+ * - Buffer underrun (waiting): 10 seconds grace period
2026
+ * - Stall detection: checks every 7 seconds, 8 seconds grace period
2027
+ * - Soft restart escalation: after 5 failed attempts
2028
+ * - Total time before recovery: 10-15 seconds typically
2029
+ */
2030
+ declare function useHlsStream(videoRef: React.RefObject<HTMLVideoElement | null>, { src, shouldPlay, onFatalError }: UseHlsStreamOptions): {
2031
+ restartKey: number;
2032
+ isNativeHls: boolean;
2033
+ };
2034
+
1909
2035
  declare const actionService: {
1910
2036
  getActionsByName(actionNames: string[], companyIdInput?: string): Promise<Action[]>;
1911
2037
  };
@@ -1957,7 +2083,27 @@ declare const qualityService: {
1957
2083
  type QualityService = typeof qualityService;
1958
2084
 
1959
2085
  declare const workspaceService: {
2086
+ _workspaceDisplayNamesCache: Map<string, string>;
2087
+ _cacheTimestamp: number;
2088
+ _cacheExpiryMs: number;
1960
2089
  getWorkspaces(lineId: string): Promise<Workspace[]>;
2090
+ /**
2091
+ * Fetches workspace display names from the database
2092
+ * Returns a map of workspace_id -> display_name
2093
+ */
2094
+ getWorkspaceDisplayNames(companyId?: string, lineId?: string): Promise<Map<string, string>>;
2095
+ /**
2096
+ * Gets cached workspace display names (with cache expiry)
2097
+ */
2098
+ getCachedWorkspaceDisplayNames(companyId?: string, lineId?: string): Promise<Map<string, string>>;
2099
+ /**
2100
+ * Gets a single workspace display name by workspace_id
2101
+ */
2102
+ getWorkspaceDisplayName(workspaceId: string, companyId?: string, lineId?: string): Promise<string>;
2103
+ /**
2104
+ * Clears the workspace display names cache
2105
+ */
2106
+ clearWorkspaceDisplayNamesCache(): void;
1961
2107
  updateWorkspaceAction(updates: WorkspaceActionUpdate[]): Promise<void>;
1962
2108
  updateActionThresholds(thresholds: ActionThreshold[]): Promise<void>;
1963
2109
  getActionThresholds(lineId: string, date: string, shiftId?: number): Promise<ActionThreshold[]>;
@@ -1990,6 +2136,57 @@ declare const authCoreService: {
1990
2136
  fetchCoreUserProfile(supabase: SupabaseClient$1, user: User, profileTable: string, roleColumn?: string): Promise<Partial<AuthUser>>;
1991
2137
  };
1992
2138
 
2139
+ declare const authOTPService: {
2140
+ /**
2141
+ * Send OTP to user's email
2142
+ */
2143
+ sendOTP(supabase: SupabaseClient$1, email: string): Promise<{
2144
+ error: AuthError | null;
2145
+ }>;
2146
+ /**
2147
+ * Verify OTP and sign in user
2148
+ */
2149
+ verifyOTP(supabase: SupabaseClient$1, email: string, token: string): Promise<{
2150
+ error: AuthError | null;
2151
+ }>;
2152
+ /**
2153
+ * Resend OTP
2154
+ */
2155
+ resendOTP(supabase: SupabaseClient$1, email: string): Promise<{
2156
+ error: AuthError | null;
2157
+ }>;
2158
+ };
2159
+
2160
+ /**
2161
+ * Auth Rate Limiting Service
2162
+ * Provides rate limiting functionality for authentication operations
2163
+ */
2164
+ interface RateLimitResult$1 {
2165
+ allowed: boolean;
2166
+ retryAfter?: number;
2167
+ error?: string;
2168
+ }
2169
+ /**
2170
+ * Check if a given identifier (email) is rate limited
2171
+ * @param identifier - The identifier to check (typically an email)
2172
+ * @returns Object indicating if the request is allowed and retry time if not
2173
+ */
2174
+ declare function checkRateLimit$1(identifier: string): RateLimitResult$1;
2175
+ /**
2176
+ * Clear rate limit for a specific identifier
2177
+ * @param identifier - The identifier to clear
2178
+ */
2179
+ declare function clearRateLimit$1(identifier: string): void;
2180
+ /**
2181
+ * Clear all rate limits
2182
+ */
2183
+ declare function clearAllRateLimits$1(): void;
2184
+ declare const authRateLimitService: {
2185
+ checkRateLimit: typeof checkRateLimit$1;
2186
+ clearRateLimit: typeof clearRateLimit$1;
2187
+ clearAllRateLimits: typeof clearAllRateLimits$1;
2188
+ };
2189
+
1993
2190
  /**
1994
2191
  * Initializes Mixpanel with the provided token.
1995
2192
  * Should be called once from the application setup (e.g., within DashboardProvider)
@@ -2004,65 +2201,6 @@ declare const trackCoreEvent: (eventName: string, properties?: Record<string, an
2004
2201
  declare const identifyCoreUser: (userId: string, userProperties?: Record<string, any>) => void;
2005
2202
  declare const resetCoreMixpanel: () => void;
2006
2203
 
2007
- interface BottleneckVideo {
2008
- id: string;
2009
- src: string;
2010
- timestamp: string;
2011
- severity: 'low' | 'medium' | 'high';
2012
- description: string;
2013
- type: 'bottleneck' | 'low_value';
2014
- originalUri: string;
2015
- }
2016
- interface S3ServiceConfig {
2017
- region?: string;
2018
- bucketName: string;
2019
- signedUrlExpiresIn?: number;
2020
- accessKeyId?: string;
2021
- secretAccessKey?: string;
2022
- sessionToken?: string;
2023
- endpoint?: string;
2024
- useAccelerateEndpoint?: boolean;
2025
- customUserAgent?: string;
2026
- useSimulatedMode?: boolean;
2027
- publicBaseUrl?: string;
2028
- }
2029
- declare class S3Service {
2030
- private s3Client;
2031
- private bucketName;
2032
- private signedUrlExpiresIn;
2033
- private useSimulatedMode;
2034
- private publicBaseUrl;
2035
- constructor(config: S3ServiceConfig);
2036
- /**
2037
- * Check if service is in simulated mode
2038
- */
2039
- isSimulated(): boolean;
2040
- /**
2041
- * List S3 clips for a specific workspace and date
2042
- */
2043
- listS3Clips(workspaceId: string, date?: string): Promise<string[]>;
2044
- /**
2045
- * Generate mock S3 URIs for simulated mode
2046
- */
2047
- private generateMockS3Uris;
2048
- /**
2049
- * Generate a signed URL for an S3 URI
2050
- */
2051
- generateSignedS3Url(s3Uri: string): Promise<string | null>;
2052
- /**
2053
- * Parse simulated URI for demo mode
2054
- */
2055
- private parseSimulatedUri;
2056
- /**
2057
- * Parse S3 URI to extract information about the video
2058
- */
2059
- parseS3Uri(s3Uri: string): Omit<BottleneckVideo, 'id' | 'src'> | null;
2060
- /**
2061
- * Get all clips for a workspace on a specific date
2062
- */
2063
- getWorkspaceClips(workspaceId: string, date?: string): Promise<BottleneckVideo[]>;
2064
- }
2065
-
2066
2204
  /**
2067
2205
  * Helper object for making authenticated API requests using Supabase auth token.
2068
2206
  * Assumes endpoints are relative to the apiBaseUrl configured in DashboardConfig.
@@ -2258,9 +2396,47 @@ declare const storeWorkspaceMapping: (mapping: WorkspaceUrlMapping) => void;
2258
2396
  declare const getWorkspaceFromUrl: (urlName: string) => WorkspaceUrlMapping | null;
2259
2397
  declare const getStoredWorkspaceMappings: () => Record<string, WorkspaceUrlMapping>;
2260
2398
 
2261
- declare const workspaceDisplayNames: Record<string, string>;
2262
- declare const getWorkspaceDisplayName: (workspaceId: string) => string;
2263
- declare const getShortWorkspaceDisplayName: (workspaceId: string) => string;
2399
+ /**
2400
+ * Gets workspace display name synchronously
2401
+ * If not initialized, triggers lazy initialization and returns workspace ID
2402
+ */
2403
+ declare const getWorkspaceDisplayName: (workspaceId: string, lineId?: string) => string;
2404
+ /**
2405
+ * Short version of workspace display name (synchronous version for backward compatibility)
2406
+ */
2407
+ declare const getShortWorkspaceDisplayName: (workspaceId: string, lineId?: string) => string;
2408
+ /**
2409
+ * Async version that ensures data is loaded from Supabase
2410
+ */
2411
+ declare const getWorkspaceDisplayNameAsync: (workspaceId: string, companyId?: string, lineId?: string) => Promise<string>;
2412
+ /**
2413
+ * Gets all workspace display names
2414
+ */
2415
+ declare const getAllWorkspaceDisplayNamesAsync: (companyId?: string, lineId?: string) => Promise<Record<string, string>>;
2416
+ /**
2417
+ * Gets workspace display names for specific workspace IDs
2418
+ */
2419
+ declare const getWorkspaceDisplayNamesMap: (workspaceIds: string[], companyId?: string, lineId?: string) => Promise<Map<string, string>>;
2420
+ /**
2421
+ * Short version of workspace display name (for space-constrained UI)
2422
+ */
2423
+ declare const getShortWorkspaceDisplayNameAsync: (workspaceId: string, companyId?: string, lineId?: string) => Promise<string>;
2424
+ /**
2425
+ * Returns true if workspace display names have been loaded from Supabase
2426
+ */
2427
+ declare const isWorkspaceDisplayNamesLoaded: () => boolean;
2428
+ /**
2429
+ * Returns true if workspace display names are currently being loaded
2430
+ */
2431
+ declare const isWorkspaceDisplayNamesLoading: () => boolean;
2432
+ /**
2433
+ * Manually refresh workspace display names from Supabase
2434
+ */
2435
+ declare const refreshWorkspaceDisplayNames: (companyId?: string) => Promise<void>;
2436
+ /**
2437
+ * Clear all workspace display names cache
2438
+ */
2439
+ declare const clearWorkspaceDisplayNamesCache: () => void;
2264
2440
 
2265
2441
  /**
2266
2442
  * Centralized workspace preferences manager
@@ -2307,158 +2483,124 @@ declare const videoPreloader: VideoPreloader;
2307
2483
  declare const preloadVideoUrl: (url: string | null | undefined) => void;
2308
2484
  declare const preloadVideosUrl: (urls: (string | null | undefined)[]) => void;
2309
2485
 
2486
+ interface RateLimitOptions {
2487
+ windowMs?: number;
2488
+ maxRequests?: number;
2489
+ }
2490
+ interface RateLimitResult {
2491
+ allowed: boolean;
2492
+ retryAfter?: number;
2493
+ }
2494
+ /**
2495
+ * Check if a request is allowed based on rate limiting
2496
+ * @param identifier - Unique identifier for the user (e.g., email, IP)
2497
+ * @param options - Rate limiting options
2498
+ * @returns Whether the request is allowed and retry time if not
2499
+ */
2500
+ declare function checkRateLimit(identifier: string, options?: RateLimitOptions): RateLimitResult;
2501
+ /**
2502
+ * Clear rate limit for a specific identifier
2503
+ * @param identifier - Unique identifier to clear
2504
+ */
2505
+ declare function clearRateLimit(identifier: string): void;
2506
+ /**
2507
+ * Clear all rate limits
2508
+ */
2509
+ declare function clearAllRateLimits(): void;
2510
+
2511
+ /**
2512
+ * S3 Video preloader utility for caching and efficiently loading videos from S3 with CloudFront integration
2513
+ */
2514
+
2515
+ declare class S3VideoPreloader {
2516
+ private readonly cache;
2517
+ private readonly queue;
2518
+ private active;
2519
+ private config?;
2520
+ constructor(config?: DashboardConfig);
2521
+ setConfig(config: DashboardConfig): void;
2522
+ preloadVideo: (url: string) => void;
2523
+ preloadVideos: (urls: string[]) => void;
2524
+ clear: () => void;
2525
+ private processQueue;
2526
+ }
2527
+ declare const s3VideoPreloader: S3VideoPreloader;
2528
+ /**
2529
+ * Fetches the URL for an S3 URI using CloudFront
2530
+ * @param s3Uri - The S3 URI in format s3://bucket-name/key
2531
+ * @param config - Dashboard configuration with S3 settings
2532
+ * @returns A Promise resolving to the CloudFront URL
2533
+ */
2534
+ declare const getS3SignedUrl: (s3Uri: string, config: DashboardConfig) => Promise<string>;
2535
+ /**
2536
+ * Preloads a video from CloudFront and caches it
2537
+ * @param s3Uri - The S3 URI in format s3://bucket-name/key
2538
+ * @param config - Dashboard configuration with S3 settings
2539
+ * @returns A Promise resolving to the blob URL for the cached video
2540
+ */
2541
+ declare const preloadS3Video: (s3Uri: string, config: DashboardConfig) => Promise<string>;
2542
+ /**
2543
+ * Gets a video source URL - either from cache or by loading from CloudFront
2544
+ * @param s3Uri - The S3 URI in format s3://bucket-name/key
2545
+ * @param config - Dashboard configuration with S3 settings
2546
+ * @param useCache - Whether to use the cache (default: true)
2547
+ * @returns A Promise resolving to the video source URL
2548
+ */
2549
+ declare const getS3VideoSrc: (s3Uri: string, config: DashboardConfig, useCache?: boolean) => Promise<string>;
2550
+ /**
2551
+ * Clears a specific video from cache
2552
+ * @param s3Uri - The S3 URI to clear from cache
2553
+ */
2554
+ declare const clearS3VideoFromCache: (s3Uri: string) => void;
2555
+ /**
2556
+ * Clears all videos from cache
2557
+ */
2558
+ declare const clearS3VideoCache: () => void;
2559
+ declare const preloadS3VideoUrl: (url: string) => void;
2560
+ declare const preloadS3VideosUrl: (urls: string[]) => void;
2561
+
2562
+ /**
2563
+ * Throttled dashboard reload utility
2564
+ * Ensures max 1 reload per interval to prevent reload storms
2565
+ */
2566
+ declare const createThrottledReload: (interval?: number) => () => void;
2567
+ declare const throttledReloadDashboard: () => void;
2568
+
2569
+ /**
2570
+ * Format idle time from seconds to a human-readable format
2571
+ * @param idleTimeInSeconds - Idle time in seconds
2572
+ * @returns Formatted string (e.g., "1h 30m 45s", "30m 45s", "45s")
2573
+ */
2574
+ declare const formatIdleTime: (idleTimeInSeconds: number | null | undefined) => string;
2575
+
2576
+ declare function useSupabaseClient(): _supabase_supabase_js.SupabaseClient<any, "public", any>;
2577
+
2310
2578
  declare const createSupabaseClient: (url: string, key: string) => _supabase_supabase_js.SupabaseClient<any, "public", any>;
2311
2579
  declare const getAnonClient: () => _supabase_supabase_js.SupabaseClient<any, "public", any>;
2312
2580
 
2313
- interface LoadingSpinnerProps {
2314
- size?: 'sm' | 'md' | 'lg';
2315
- message?: string;
2316
- className?: string;
2581
+ declare const withAuth: <P extends object>(WrappedComponent: React$1.ComponentType<P>, options?: {
2582
+ redirectTo?: string;
2583
+ requireAuth?: boolean;
2584
+ }) => (props: P) => react_jsx_runtime.JSX.Element | null;
2585
+
2586
+ interface LoginPageProps {
2587
+ onRateLimitCheck?: (email: string) => Promise<{
2588
+ allowed: boolean;
2589
+ error?: string;
2590
+ }>;
2591
+ logoSrc?: string;
2592
+ logoAlt?: string;
2593
+ brandName?: string;
2317
2594
  }
2318
- declare const LoadingSpinner: React__default.FC<LoadingSpinnerProps>;
2595
+ declare const LoginPage: React__default.FC<LoginPageProps>;
2319
2596
 
2320
- declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
2597
+ interface AuthCallbackProps {
2598
+ redirectTo?: string;
2599
+ errorRedirect?: string;
2600
+ }
2601
+ declare const AuthCallback: React.FC<AuthCallbackProps>;
2321
2602
 
2322
- declare const Select: React$1.FC<SelectPrimitive.SelectProps>;
2323
- declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
2324
- declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
2325
- declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
2326
- declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2327
- declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2328
- declare const SelectContent: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2329
- declare const SelectLabel: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2330
- declare const SelectItem: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2331
- declare const SelectSeparator: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
2332
-
2333
- declare const Card: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
2334
- declare const CardHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
2335
- declare const CardTitle: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLHeadingElement> & React$1.RefAttributes<HTMLParagraphElement>>;
2336
- declare const CardDescription: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLParagraphElement> & React$1.RefAttributes<HTMLParagraphElement>>;
2337
- declare const CardContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
2338
- declare const CardFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
2339
-
2340
- interface LoadingOverlayProps {
2341
- isVisible: boolean;
2342
- message?: string;
2343
- className?: string;
2344
- }
2345
- declare const LoadingOverlay: React__default.FC<LoadingOverlayProps>;
2346
-
2347
- interface LoadingPageProps {
2348
- message?: string;
2349
- subMessage?: string;
2350
- className?: string;
2351
- }
2352
- declare const LoadingPage: React__default.FC<LoadingPageProps>;
2353
-
2354
- interface TimeDisplayProps {
2355
- className?: string;
2356
- variant?: 'default' | 'minimal';
2357
- }
2358
- declare const TimeDisplay: React__default.FC<TimeDisplayProps>;
2359
-
2360
- interface DateDisplayProps {
2361
- className?: string;
2362
- variant?: 'default' | 'minimal';
2363
- }
2364
- declare const DateDisplay: React__default.FC<DateDisplayProps>;
2365
-
2366
- interface MetricCardProps {
2367
- title: string;
2368
- value: number | string;
2369
- unit?: string;
2370
- trend?: number | null;
2371
- }
2372
- declare const MetricCard: React__default.FC<MetricCardProps>;
2373
-
2374
- interface DateTimeDisplayProps {
2375
- className?: string;
2376
- showDate?: boolean;
2377
- showTime?: boolean;
2378
- }
2379
- declare const DateTimeDisplay: React__default.FC<DateTimeDisplayProps>;
2380
-
2381
- declare const IconMap: {
2382
- readonly info: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
2383
- readonly warning: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
2384
- readonly success: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
2385
- readonly search: React__default.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
2386
- };
2387
- type IconKey = keyof typeof IconMap;
2388
- interface EmptyStateMessageProps {
2389
- iconType?: IconKey | React__default.ComponentType<LucideProps> | React__default.ReactNode;
2390
- title: string;
2391
- message?: string;
2392
- actionButton?: {
2393
- text: string;
2394
- onClick: () => void;
2395
- className?: string;
2396
- };
2397
- className?: string;
2398
- titleClassName?: string;
2399
- messageClassName?: string;
2400
- iconClassName?: string;
2401
- }
2402
- declare const EmptyStateMessage: React__default.FC<EmptyStateMessageProps>;
2403
-
2404
- interface WhatsAppShareButtonProps {
2405
- /** The message text to pre-fill. It will be URL-encoded. */
2406
- message: string;
2407
- /** Optional phone number to pre-fill. Should include country code without '+' or spaces. */
2408
- phoneNumber?: string;
2409
- /** Text for the button. Defaults to "Share on WhatsApp". */
2410
- buttonText?: string;
2411
- /** Additional classes for the button. */
2412
- className?: string;
2413
- /** Props for the icon, if you want to customize it or pass a custom icon node. */
2414
- iconProps?: React__default.ComponentProps<typeof Share2>;
2415
- /** Custom icon node to replace the default. */
2416
- customIcon?: React__default.ReactNode;
2417
- /** Aria-label for the button for accessibility. */
2418
- ariaLabel?: string;
2419
- }
2420
- declare const WhatsAppShareButton: React__default.FC<WhatsAppShareButtonProps>;
2421
-
2422
- interface BaseHistoryCalendarProps {
2423
- dailyData: Record<string, DaySummaryData>;
2424
- displayMonth: Date;
2425
- onMonthChange: (newMonth: Date) => void;
2426
- onDateSelect?: (date: string, shiftId?: string | number) => void;
2427
- renderDayCellContent: (params: {
2428
- date: Date;
2429
- daySummary?: DaySummaryData;
2430
- selectedShiftSummary?: ShiftSummaryData;
2431
- isToday: boolean;
2432
- isFuture: boolean;
2433
- isOutside: boolean;
2434
- modifiers: Modifiers;
2435
- }) => React__default.ReactElement | null;
2436
- getPerformanceColor?: (params: {
2437
- daySummary?: DaySummaryData;
2438
- selectedShiftSummary?: ShiftSummaryData;
2439
- date: Date;
2440
- isFuture: boolean;
2441
- isToday: boolean;
2442
- isOutside: boolean;
2443
- }) => string;
2444
- selectedShiftId?: string | number;
2445
- disableFutureDates?: boolean;
2446
- highlightToday?: boolean;
2447
- className?: string;
2448
- dayCellClassName?: string | ((date: Date, modifiers: Modifiers) => string);
2449
- }
2450
- declare const BaseHistoryCalendar: React__default.FC<BaseHistoryCalendarProps>;
2451
-
2452
- interface ShiftDisplayProps {
2453
- className?: string;
2454
- }
2455
- declare const ShiftDisplay: React__default.FC<ShiftDisplayProps>;
2456
-
2457
- /**
2458
- * ISTTimer composes TimeDisplay and ShiftDisplay from within @optifye/dashboard-core.
2459
- * Assumes DashboardProvider is configured with necessary dateTimeConfig and shiftConfig.
2460
- */
2461
- declare const ISTTimer: React__default.FC;
2603
+ declare const DebugAuth: React__default.FC;
2462
2604
 
2463
2605
  interface BarChartDataItem {
2464
2606
  name: string;
@@ -2479,7 +2621,7 @@ interface BarChartProps {
2479
2621
  xAxisLabel?: string;
2480
2622
  yAxisLabel?: string;
2481
2623
  yAxisUnit?: string;
2482
- tooltipFormatter?: (value: any, name: any, props: any) => React__default.ReactNode;
2624
+ tooltipFormatter?: (value: any, name: any, props: any) => any;
2483
2625
  legendPayload?: any[];
2484
2626
  layout?: 'horizontal' | 'vertical';
2485
2627
  className?: string;
@@ -2522,7 +2664,7 @@ interface LineChartProps {
2522
2664
  yAxisLabel?: string;
2523
2665
  yAxisUnit?: string;
2524
2666
  yAxisDomain?: [number | string, number | string];
2525
- tooltipFormatter?: (value: any, name: any, props: any) => React__default.ReactNode;
2667
+ tooltipFormatter?: (value: any, name: any, props: any) => any;
2526
2668
  legendPayload?: any[];
2527
2669
  className?: string;
2528
2670
  showGrid?: boolean;
@@ -2576,7 +2718,8 @@ interface HourlyOutputChartProps {
2576
2718
  shiftStart: string;
2577
2719
  className?: string;
2578
2720
  }
2579
- declare const HourlyOutputChart: React__default.FC<HourlyOutputChartProps>;
2721
+
2722
+ declare const HourlyOutputChart: (props: HourlyOutputChartProps) => react_jsx_runtime.JSX.Element;
2580
2723
 
2581
2724
  interface SOPComplianceChartProps {
2582
2725
  data?: number[];
@@ -2586,6 +2729,108 @@ interface SOPComplianceChartProps {
2586
2729
  }
2587
2730
  declare const SOPComplianceChart: React__default.FC<SOPComplianceChartProps>;
2588
2731
 
2732
+ type TrendDirection = 'up' | 'down' | 'neutral';
2733
+ interface MetricCardProps$1 {
2734
+ title: string;
2735
+ value: string | number;
2736
+ unit?: string;
2737
+ trend?: TrendDirection;
2738
+ trendText?: string;
2739
+ isLoading?: boolean;
2740
+ className?: string;
2741
+ onCardClick?: () => void;
2742
+ ariaLabel?: string;
2743
+ }
2744
+
2745
+ interface DateTimeDisplayProps {
2746
+ className?: string;
2747
+ showDate?: boolean;
2748
+ showTime?: boolean;
2749
+ }
2750
+ declare const DateTimeDisplay: React__default.FC<DateTimeDisplayProps>;
2751
+
2752
+ declare const IconMap: {
2753
+ readonly info: React$1.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
2754
+ readonly warning: React$1.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
2755
+ readonly success: React$1.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
2756
+ readonly search: React$1.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
2757
+ };
2758
+ type IconKey = keyof typeof IconMap;
2759
+ interface EmptyStateMessageProps {
2760
+ iconType?: IconKey | React__default.ComponentType<LucideProps> | React__default.ReactNode;
2761
+ title: string;
2762
+ message?: string;
2763
+ actionButton?: {
2764
+ text: string;
2765
+ onClick: () => void;
2766
+ className?: string;
2767
+ };
2768
+ className?: string;
2769
+ titleClassName?: string;
2770
+ messageClassName?: string;
2771
+ iconClassName?: string;
2772
+ }
2773
+ declare const EmptyStateMessage: React__default.FC<EmptyStateMessageProps>;
2774
+
2775
+ interface WhatsAppShareButtonProps {
2776
+ /** The message text to pre-fill. It will be URL-encoded. */
2777
+ message: string;
2778
+ /** Optional phone number to pre-fill. Should include country code without '+' or spaces. */
2779
+ phoneNumber?: string;
2780
+ /** Text for the button. Defaults to "Share on WhatsApp". */
2781
+ buttonText?: string;
2782
+ /** Additional classes for the button. */
2783
+ className?: string;
2784
+ /** Props for the icon, if you want to customize it or pass a custom icon node. */
2785
+ iconProps?: React__default.ComponentProps<typeof Share2>;
2786
+ /** Custom icon node to replace the default. */
2787
+ customIcon?: React__default.ReactNode;
2788
+ /** Aria-label for the button for accessibility. */
2789
+ ariaLabel?: string;
2790
+ }
2791
+ declare const WhatsAppShareButton: React__default.FC<WhatsAppShareButtonProps>;
2792
+
2793
+ interface BaseHistoryCalendarProps {
2794
+ dailyData: Record<string, DaySummaryData>;
2795
+ displayMonth: Date;
2796
+ onMonthChange: (newMonth: Date) => void;
2797
+ onDateSelect?: (date: string, shiftId?: string | number) => void;
2798
+ renderDayCellContent: (params: {
2799
+ date: Date;
2800
+ daySummary?: DaySummaryData;
2801
+ selectedShiftSummary?: ShiftSummaryData;
2802
+ isToday: boolean;
2803
+ isFuture: boolean;
2804
+ isOutside: boolean;
2805
+ modifiers: Modifiers;
2806
+ }) => React__default.ReactElement | null;
2807
+ getPerformanceColor?: (params: {
2808
+ daySummary?: DaySummaryData;
2809
+ selectedShiftSummary?: ShiftSummaryData;
2810
+ date: Date;
2811
+ isFuture: boolean;
2812
+ isToday: boolean;
2813
+ isOutside: boolean;
2814
+ }) => string;
2815
+ selectedShiftId?: string | number;
2816
+ disableFutureDates?: boolean;
2817
+ highlightToday?: boolean;
2818
+ className?: string;
2819
+ dayCellClassName?: string | ((date: Date, modifiers: Modifiers) => string);
2820
+ }
2821
+ declare const BaseHistoryCalendar: React__default.FC<BaseHistoryCalendarProps>;
2822
+
2823
+ interface ShiftDisplayProps {
2824
+ className?: string;
2825
+ }
2826
+ declare const ShiftDisplay: React__default.FC<ShiftDisplayProps>;
2827
+
2828
+ /**
2829
+ * ISTTimer composes TimeDisplay and ShiftDisplay from within @optifye/dashboard-core.
2830
+ * Assumes DashboardProvider is configured with necessary dateTimeConfig and shiftConfig.
2831
+ */
2832
+ declare const ISTTimer: React__default.FC;
2833
+
2589
2834
  interface LinePdfExportButtonProps {
2590
2835
  /** The DOM element or a selector string for the element to capture. */
2591
2836
  targetElement: HTMLElement | string;
@@ -2621,13 +2866,13 @@ interface ShiftData$1 {
2621
2866
  underperforming_workspaces: number;
2622
2867
  total_workspaces: number;
2623
2868
  }
2624
- interface DayData$1 {
2869
+ interface DayData$3 {
2625
2870
  date: Date | string;
2626
2871
  dayShift: ShiftData$1;
2627
2872
  nightShift: ShiftData$1;
2628
2873
  }
2629
2874
  interface LineHistoryCalendarProps {
2630
- data: DayData$1[];
2875
+ data: DayData$3[];
2631
2876
  month: number;
2632
2877
  year: number;
2633
2878
  lineId: string;
@@ -2637,13 +2882,13 @@ interface LineHistoryCalendarProps {
2637
2882
  }
2638
2883
  declare const LineHistoryCalendar: React__default.FC<LineHistoryCalendarProps>;
2639
2884
 
2640
- interface PerformanceData {
2885
+ interface PerformanceData$1 {
2641
2886
  avg_efficiency: number;
2642
2887
  underperforming_workspaces: number;
2643
2888
  total_workspaces: number;
2644
2889
  compliance_percentage?: number;
2645
2890
  }
2646
- interface WorkspacePerformance {
2891
+ interface WorkspacePerformance$1 {
2647
2892
  workspace_name: string;
2648
2893
  workspace_uuid: string;
2649
2894
  avg_efficiency?: number;
@@ -2658,14 +2903,16 @@ interface LineMonthlyHistoryProps {
2658
2903
  year: number;
2659
2904
  monthlyData: {
2660
2905
  date: Date;
2661
- dayShift: PerformanceData;
2662
- nightShift: PerformanceData;
2906
+ dayShift: PerformanceData$1;
2907
+ nightShift: PerformanceData$1;
2663
2908
  }[];
2664
2909
  underperformingWorkspaces: {
2665
- dayShift: WorkspacePerformance[];
2666
- nightShift: WorkspacePerformance[];
2910
+ dayShift: WorkspacePerformance$1[];
2911
+ nightShift: WorkspacePerformance$1[];
2667
2912
  };
2668
2913
  lineId: string;
2914
+ selectedShift?: 'day' | 'night';
2915
+ onShiftChange?: (shift: 'day' | 'night') => void;
2669
2916
  onWorkspaceSelect?: (workspaceId: string, navigationParams?: Partial<WorkspaceNavigationParams> & {
2670
2917
  returnTo?: string;
2671
2918
  }) => void;
@@ -2675,6 +2922,42 @@ interface LineMonthlyHistoryProps {
2675
2922
  }
2676
2923
  declare const LineMonthlyHistory: React__default.FC<LineMonthlyHistoryProps>;
2677
2924
 
2925
+ interface PerformanceData {
2926
+ avg_efficiency: number;
2927
+ underperforming_workspaces: number;
2928
+ total_workspaces: number;
2929
+ compliance_percentage?: number;
2930
+ }
2931
+ interface WorkspacePerformance {
2932
+ workspace_name: string;
2933
+ workspace_uuid: string;
2934
+ avg_efficiency?: number;
2935
+ last_5_days: {
2936
+ date: string;
2937
+ performance_score: 0 | 1 | 2;
2938
+ efficiency?: number;
2939
+ }[];
2940
+ }
2941
+ interface DayData$2 {
2942
+ date: Date;
2943
+ dayShift: PerformanceData;
2944
+ nightShift: PerformanceData;
2945
+ }
2946
+ interface LineMonthlyPdfGeneratorProps {
2947
+ lineId: string;
2948
+ lineName: string;
2949
+ monthlyData: DayData$2[];
2950
+ underperformingWorkspaces: {
2951
+ dayShift: WorkspacePerformance[];
2952
+ nightShift: WorkspacePerformance[];
2953
+ };
2954
+ selectedMonth: number;
2955
+ selectedYear: number;
2956
+ selectedShift: 'day' | 'night';
2957
+ className?: string;
2958
+ }
2959
+ declare const LineMonthlyPdfGenerator: React__default.FC<LineMonthlyPdfGeneratorProps>;
2960
+
2678
2961
  interface LineWhatsAppShareProps {
2679
2962
  lineInfo: LineInfo;
2680
2963
  className?: string;
@@ -2831,13 +3114,13 @@ interface ShiftData {
2831
3114
  idealOutput: number;
2832
3115
  rank: number;
2833
3116
  }
2834
- interface DayData {
3117
+ interface DayData$1 {
2835
3118
  date: Date;
2836
3119
  dayShift: ShiftData;
2837
3120
  nightShift: ShiftData;
2838
3121
  }
2839
3122
  interface WorkspaceHistoryCalendarProps {
2840
- data: DayData[];
3123
+ data: DayData$1[];
2841
3124
  onDateSelect: (date: string) => void;
2842
3125
  month: number;
2843
3126
  year: number;
@@ -2861,9 +3144,41 @@ interface WorkspacePdfGeneratorProps {
2861
3144
  }
2862
3145
  declare const WorkspacePdfGenerator: React__default.FC<WorkspacePdfGeneratorProps>;
2863
3146
 
2864
- interface WorkspaceMetricCardsProps {
2865
- workspace: WorkspaceDetailedMetrics;
2866
- className?: string;
3147
+ interface DayData {
3148
+ date: Date;
3149
+ dayShift: {
3150
+ efficiency: number;
3151
+ output: number;
3152
+ cycleTime: number;
3153
+ pph: number;
3154
+ pphThreshold: number;
3155
+ idealOutput: number;
3156
+ rank: number;
3157
+ };
3158
+ nightShift: {
3159
+ efficiency: number;
3160
+ output: number;
3161
+ cycleTime: number;
3162
+ pph: number;
3163
+ pphThreshold: number;
3164
+ idealOutput: number;
3165
+ rank: number;
3166
+ };
3167
+ }
3168
+ interface WorkspaceMonthlyPdfGeneratorProps {
3169
+ workspaceId: string;
3170
+ workspaceName: string;
3171
+ monthlyData: DayData[];
3172
+ selectedMonth: number;
3173
+ selectedYear: number;
3174
+ selectedShift: 'day' | 'night';
3175
+ className?: string;
3176
+ }
3177
+ declare const WorkspaceMonthlyPdfGenerator: React__default.FC<WorkspaceMonthlyPdfGeneratorProps>;
3178
+
3179
+ interface WorkspaceMetricCardsProps {
3180
+ workspace: WorkspaceDetailedMetrics;
3181
+ className?: string;
2867
3182
  }
2868
3183
  declare const WorkspaceMetricCards: React__default.FC<WorkspaceMetricCardsProps>;
2869
3184
 
@@ -2876,7 +3191,6 @@ declare const LiveTimer: React__default.FC;
2876
3191
  /**
2877
3192
  * Types for BottlenecksContent component
2878
3193
  */
2879
-
2880
3194
  /**
2881
3195
  * Props for the BottlenecksContent component
2882
3196
  */
@@ -2893,25 +3207,17 @@ interface BottlenecksContentProps {
2893
3207
  * Optional date to fetch clips for (defaults to current date)
2894
3208
  */
2895
3209
  date?: string;
2896
- /**
2897
- * Optional S3 service configuration
2898
- */
2899
- s3Config?: S3ServiceConfig;
2900
3210
  /**
2901
3211
  * Optional className for styling
2902
3212
  */
2903
3213
  className?: string;
2904
- /**
2905
- * Optional custom fetch function for clips
2906
- */
2907
- customFetchClips?: (workspaceId: string, date?: string) => Promise<BottleneckVideo[]>;
2908
3214
  }
2909
3215
  /**
2910
- * Filter type for bottleneck clips
3216
+ * Filter type for bottleneck clips - expanded for new video types
2911
3217
  */
2912
- type BottleneckFilterType = 'all' | 'high' | 'medium' | 'low' | 'low_value';
3218
+ type BottleneckFilterType = 'all' | 'high' | 'medium' | 'low' | 'low_value' | 'sop_deviations' | 'best_cycle_time' | 'worst_cycle_time' | 'long_cycle_time';
2913
3219
  /**
2914
- * Clip counts for each type/severity
3220
+ * Clip counts for each type/severity - updated for new video types
2915
3221
  */
2916
3222
  interface ClipCounts {
2917
3223
  bottlenecks: number;
@@ -2919,14 +3225,17 @@ interface ClipCounts {
2919
3225
  highSeverity: number;
2920
3226
  mediumSeverity: number;
2921
3227
  lowSeverity: number;
3228
+ sopDeviations: number;
3229
+ bestCycleTimes: number;
3230
+ worstCycleTimes: number;
2922
3231
  total: number;
2923
3232
  }
2924
3233
 
2925
3234
  /**
2926
3235
  * BottlenecksContent Component
2927
3236
  *
2928
- * Displays video clips of bottlenecks and low-value activities for a workspace.
2929
- * This component directly uses S3 to fetch and display videos without requiring an API endpoint.
3237
+ * Displays HLS video clips of bottlenecks and low-value activities for a workspace.
3238
+ * Uses the S3ClipsService to fetch and display clips with CloudFront delivery.
2930
3239
  */
2931
3240
  declare const BottlenecksContent: React__default.FC<BottlenecksContentProps>;
2932
3241
 
@@ -3001,27 +3310,24 @@ interface VideoGridViewProps {
3001
3310
  videoSources?: {
3002
3311
  defaultHlsUrl?: string;
3003
3312
  workspaceHlsUrls?: Record<string, string>;
3004
- mp4VideoMapping?: Record<string, string>;
3005
- };
3006
- streamConfig?: {
3007
- maxConcurrentInitializations?: number;
3008
- staggerDelay?: number;
3009
- initialPlayDelay?: number;
3010
- maxPlayRetries?: number;
3011
- maxFatalErrorRetries?: number;
3012
- errorRetryBaseDelay?: number;
3013
- maxErrorRetryDelay?: number;
3014
- streamHealthCheckInterval?: number;
3015
- debugCropRegions?: boolean;
3016
3313
  };
3017
- hlsConfig?: Partial<Record<string, any>>;
3018
3314
  }
3019
3315
  /**
3020
- * VideoGridView component for displaying a grid of workspace video streams
3021
- * with efficiency metrics and controls.
3316
+ * VideoGridView component - Simplified version using enterprise-grade HLS streaming
3022
3317
  */
3023
3318
  declare const VideoGridView: React__default.FC<VideoGridViewProps>;
3024
3319
 
3320
+ interface VideoCardProps {
3321
+ workspace: WorkspaceMetrics;
3322
+ hlsUrl: string;
3323
+ shouldPlay: boolean;
3324
+ onClick?: () => void;
3325
+ onFatalError?: () => void;
3326
+ isVeryLowEfficiency?: boolean;
3327
+ className?: string;
3328
+ }
3329
+ declare const VideoCard: React__default.FC<VideoCardProps>;
3330
+
3025
3331
  declare const GridComponentsPlaceholder: {};
3026
3332
 
3027
3333
  interface KPIGridProps {
@@ -3169,12 +3475,32 @@ interface NoWorkspaceDataProps {
3169
3475
  */
3170
3476
  declare const NoWorkspaceData: React__default.MemoExoticComponent<({ className }: NoWorkspaceDataProps) => react_jsx_runtime.JSX.Element>;
3171
3477
 
3478
+ interface WorkspaceMonthlyDataFetcherProps {
3479
+ /**
3480
+ * The ID of the workspace to fetch monthly data for
3481
+ */
3482
+ workspaceId: string;
3483
+ /**
3484
+ * The month to fetch data for (0-based, where 0 = January)
3485
+ */
3486
+ selectedMonth: number;
3487
+ /**
3488
+ * The year to fetch data for
3489
+ */
3490
+ selectedYear: number;
3491
+ /**
3492
+ * Callback function that receives the loaded data
3493
+ */
3494
+ onDataLoaded: (data: any[]) => void;
3495
+ /**
3496
+ * Callback function that receives the loading state
3497
+ */
3498
+ onLoadingChange: (isLoading: boolean) => void;
3499
+ }
3172
3500
  /**
3173
- * SideNavBar is a fixed implementation for the original src version,
3174
- * hardcoded with specific routes and icons.
3175
- * It does not use the navItems prop for backward compatibility.
3501
+ * A non-visual component that fetches monthly workspace data and passes it to its parent via callbacks.
3176
3502
  */
3177
- declare const SideNavBar: React__default.FC<SideNavBarProps>;
3503
+ declare const WorkspaceMonthlyDataFetcher: React__default.FC<WorkspaceMonthlyDataFetcherProps>;
3178
3504
 
3179
3505
  declare const PageHeader: React__default.FC<PageHeaderProps>;
3180
3506
 
@@ -3211,7 +3537,73 @@ interface HeaderProps {
3211
3537
  }
3212
3538
  declare const Header: React__default.FC<HeaderProps>;
3213
3539
 
3214
- declare const withAuth: <P extends object>(WrappedComponent: React$1.ComponentType<P>) => (props: P) => react_jsx_runtime.JSX.Element;
3540
+ /**
3541
+ * SideNavBar is a fixed implementation for the original src version,
3542
+ * hardcoded with specific routes and icons.
3543
+ * It does not use the navItems prop for backward compatibility.
3544
+ */
3545
+ declare const SideNavBar: React__default.FC<SideNavBarProps>;
3546
+
3547
+ interface LoadingSpinnerProps {
3548
+ size?: 'sm' | 'md' | 'lg';
3549
+ message?: string;
3550
+ className?: string;
3551
+ }
3552
+ declare const LoadingSpinner: React__default.FC<LoadingSpinnerProps>;
3553
+
3554
+ declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
3555
+
3556
+ declare const Select: React$1.FC<SelectPrimitive.SelectProps>;
3557
+ declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
3558
+ declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
3559
+ declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<never>>;
3560
+ declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3561
+ declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3562
+ declare const SelectContent: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3563
+ declare const SelectLabel: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3564
+ declare const SelectItem: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3565
+ declare const SelectSeparator: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<never>>;
3566
+
3567
+ declare const Card: (props: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
3568
+ declare const CardHeader: (props: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
3569
+ declare const CardTitle: (props: HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime.JSX.Element;
3570
+ declare const CardDescription: (props: HTMLAttributes<HTMLParagraphElement>) => react_jsx_runtime.JSX.Element;
3571
+ declare const CardContent: (props: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
3572
+ declare const CardFooter: (props: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
3573
+
3574
+ interface LoadingOverlayProps {
3575
+ isVisible: boolean;
3576
+ message?: string;
3577
+ className?: string;
3578
+ }
3579
+ declare const LoadingOverlay: React__default.FC<LoadingOverlayProps>;
3580
+
3581
+ interface LoadingPageProps {
3582
+ message?: string;
3583
+ subMessage?: string;
3584
+ className?: string;
3585
+ }
3586
+ declare const LoadingPage: React__default.FC<LoadingPageProps>;
3587
+
3588
+ interface TimeDisplayProps {
3589
+ className?: string;
3590
+ variant?: 'default' | 'minimal';
3591
+ }
3592
+ declare const TimeDisplay: React__default.FC<TimeDisplayProps>;
3593
+
3594
+ interface DateDisplayProps {
3595
+ className?: string;
3596
+ variant?: 'default' | 'minimal';
3597
+ }
3598
+ declare const DateDisplay: React__default.FC<DateDisplayProps>;
3599
+
3600
+ interface MetricCardProps {
3601
+ title: string;
3602
+ value: number | string;
3603
+ unit?: string;
3604
+ trend?: number | null;
3605
+ }
3606
+ declare const MetricCard: React__default.FC<MetricCardProps>;
3215
3607
 
3216
3608
  declare const DEFAULT_HLS_CONFIG: {
3217
3609
  maxBufferLength: number;
@@ -3277,32 +3669,35 @@ declare const getDefaultCameraStreamUrl: (workspaceName: string, baseUrl: string
3277
3669
  */
3278
3670
  declare const SingleVideoStream: React__default.FC<SingleVideoStreamProps>;
3279
3671
 
3280
- interface WorkspaceMonthlyDataFetcherProps {
3281
- /**
3282
- * The ID of the workspace to fetch monthly data for
3283
- */
3284
- workspaceId: string;
3285
- /**
3286
- * The month to fetch data for (0-based, where 0 = January)
3287
- */
3288
- selectedMonth: number;
3289
- /**
3290
- * The year to fetch data for
3291
- */
3292
- selectedYear: number;
3672
+ declare const AIAgentView: React__default.FC;
3673
+
3674
+ interface AuthCallbackViewProps {
3293
3675
  /**
3294
- * Callback function that receives the loaded data
3676
+ * Where to redirect after successful authentication
3295
3677
  */
3296
- onDataLoaded: (data: any[]) => void;
3678
+ redirectTo?: string;
3297
3679
  /**
3298
- * Callback function that receives the loading state
3680
+ * Where to redirect on error
3299
3681
  */
3300
- onLoadingChange: (isLoading: boolean) => void;
3682
+ errorRedirect?: string;
3301
3683
  }
3302
3684
  /**
3303
- * A non-visual component that fetches monthly workspace data and passes it to its parent via callbacks.
3685
+ * AuthCallbackView component - Handles OAuth callback redirects
3686
+ * This view wraps the AuthCallback component and follows the same pattern as other views
3304
3687
  */
3305
- declare const WorkspaceMonthlyDataFetcher: React__default.FC<WorkspaceMonthlyDataFetcherProps>;
3688
+ declare function AuthCallbackView({ redirectTo, errorRedirect }: AuthCallbackViewProps): React__default.ReactNode;
3689
+
3690
+ /**
3691
+ * DebugAuthView component - Debug page for authentication setup
3692
+ * This view wraps the DebugAuth component and follows the same pattern as other views
3693
+ */
3694
+ declare function DebugAuthView(): React__default.ReactNode;
3695
+
3696
+ /**
3697
+ * FactoryView Component - Displays factory-level overview with metrics for each production line
3698
+ */
3699
+ declare const FactoryView: React__default.FC<FactoryViewProps>;
3700
+ declare const AuthenticatedFactoryView: (props: FactoryViewProps) => react_jsx_runtime.JSX.Element | null;
3306
3701
 
3307
3702
  interface HomeViewProps {
3308
3703
  /**
@@ -3341,58 +3736,7 @@ interface HomeViewProps {
3341
3736
  * HomeView component - Main dashboard landing page showing factory overview with workspace grid
3342
3737
  */
3343
3738
  declare function HomeView({ defaultLineId, factoryViewId, line1Uuid, line2Uuid, lineNames, videoSources, factoryName }: HomeViewProps): React__default.ReactNode;
3344
- declare const AuthenticatedHomeView: (props: HomeViewProps) => react_jsx_runtime.JSX.Element;
3345
-
3346
- /**
3347
- * FactoryView Component - Displays factory-level overview with metrics for each production line
3348
- */
3349
- declare const FactoryView: React__default.FC<FactoryViewProps>;
3350
- declare const AuthenticatedFactoryView: (props: FactoryViewProps) => react_jsx_runtime.JSX.Element;
3351
-
3352
- /**
3353
- * LeaderboardIndexView component for displaying a list of lines that can be selected for the leaderboard
3354
- */
3355
- declare const LeaderboardIndexView: React__default.FC<LeaderboardIndexViewProps>;
3356
-
3357
- /**
3358
- * LeaderboardDetailView component for displaying a detailed leaderboard for a specific line
3359
- */
3360
- declare const LeaderboardDetailView: React__default.FC<LeaderboardDetailViewProps>;
3361
-
3362
- interface TargetsViewProps {
3363
- /** Line UUIDs to display and configure in the view */
3364
- lineIds: string[];
3365
- /** Line display names mapping (lineId to display name) */
3366
- lineNames: Record<string, string>;
3367
- /** Company UUID for fetching actions */
3368
- companyId: string;
3369
- /** Optional router instance for navigation */
3370
- router?: {
3371
- push: (path: string) => void;
3372
- };
3373
- /** Optional user ID for tracking who made changes */
3374
- userId?: string;
3375
- /** Callback when changes are saved */
3376
- onSaveChanges?: (lineId: string) => void;
3377
- }
3378
-
3379
- /**
3380
- * TargetsView component for managing production targets
3381
- *
3382
- * This component allows for configuring:
3383
- * - Production targets (PPH, cycle time, day output)
3384
- * - Action types per workspace
3385
- * - Product codes
3386
- * - Supports both day and night shifts
3387
- */
3388
- declare const TargetsView: React__default.FC<TargetsViewProps>;
3389
-
3390
- declare const AuthenticatedTargetsView: (props: TargetsViewProps) => react_jsx_runtime.JSX.Element;
3391
-
3392
- /**
3393
- * ShiftsView component for managing day and night shift configurations
3394
- */
3395
- declare const ShiftsView: React__default.FC<ShiftsViewProps>;
3739
+ declare const AuthenticatedHomeView: (props: HomeViewProps) => react_jsx_runtime.JSX.Element | null;
3396
3740
 
3397
3741
  interface KPIDetailViewProps {
3398
3742
  /**
@@ -3455,6 +3799,82 @@ interface KPIDetailViewProps {
3455
3799
  */
3456
3800
  declare const KPIDetailView: React__default.FC<KPIDetailViewProps>;
3457
3801
 
3802
+ /**
3803
+ * LeaderboardDetailView component for displaying a detailed leaderboard for a specific line
3804
+ */
3805
+ declare const LeaderboardDetailView: React__default.FC<LeaderboardDetailViewProps>;
3806
+
3807
+ /**
3808
+ * LeaderboardIndexView component for displaying a list of lines that can be selected for the leaderboard
3809
+ */
3810
+ declare const LeaderboardIndexView: React__default.FC<LeaderboardIndexViewProps>;
3811
+
3812
+ interface LoginViewProps {
3813
+ /**
3814
+ * Optional logo source URL
3815
+ */
3816
+ logoSrc?: string;
3817
+ /**
3818
+ * Optional logo alt text
3819
+ */
3820
+ logoAlt?: string;
3821
+ /**
3822
+ * Optional brand name to display
3823
+ */
3824
+ brandName?: string;
3825
+ /**
3826
+ * Optional rate limit handler
3827
+ * @param email - The email to check
3828
+ * @returns Promise with allowed status and optional error message
3829
+ */
3830
+ onRateLimitCheck?: (email: string) => Promise<{
3831
+ allowed: boolean;
3832
+ error?: string;
3833
+ }>;
3834
+ }
3835
+ /**
3836
+ * LoginView component - Authentication page for the dashboard
3837
+ * This view wraps the LoginPage component and follows the same pattern as other views
3838
+ */
3839
+ declare function LoginView({ logoSrc, logoAlt, brandName, onRateLimitCheck }: LoginViewProps): React__default.ReactNode;
3840
+
3841
+ declare const ProfileView: React__default.FC;
3842
+
3843
+ /**
3844
+ * ShiftsView component for managing day and night shift configurations
3845
+ */
3846
+ declare const ShiftsView: React__default.FC<ShiftsViewProps>;
3847
+
3848
+ interface TargetsViewProps {
3849
+ /** Line UUIDs to display and configure in the view */
3850
+ lineIds: string[];
3851
+ /** Line display names mapping (lineId to display name) */
3852
+ lineNames: Record<string, string>;
3853
+ /** Company UUID for fetching actions */
3854
+ companyId: string;
3855
+ /** Optional router instance for navigation */
3856
+ router?: {
3857
+ push: (path: string) => void;
3858
+ };
3859
+ /** Optional user ID for tracking who made changes */
3860
+ userId?: string;
3861
+ /** Callback when changes are saved */
3862
+ onSaveChanges?: (lineId: string) => void;
3863
+ }
3864
+
3865
+ /**
3866
+ * TargetsView component for managing production targets
3867
+ *
3868
+ * This component allows for configuring:
3869
+ * - Production targets (PPH, cycle time, day output)
3870
+ * - Action types per workspace
3871
+ * - Product codes
3872
+ * - Supports both day and night shifts
3873
+ */
3874
+ declare const TargetsView: React__default.FC<TargetsViewProps>;
3875
+
3876
+ declare const AuthenticatedTargetsView: (props: TargetsViewProps) => react_jsx_runtime.JSX.Element | null;
3877
+
3458
3878
  type TabType = 'overview' | 'monthly_history' | 'bottlenecks';
3459
3879
  type NavigationHandler = (url: string) => void;
3460
3880
  interface WorkspaceDetailViewProps {
@@ -3524,6 +3944,196 @@ interface WorkspaceDetailViewProps {
3524
3944
  */
3525
3945
  renderHeaderActions?: (workspace: any) => ReactNode;
3526
3946
  }
3527
- declare const WrappedComponent: (props: WorkspaceDetailViewProps) => react_jsx_runtime.JSX.Element;
3947
+ declare const WrappedComponent: (props: WorkspaceDetailViewProps) => react_jsx_runtime.JSX.Element | null;
3948
+
3949
+ type CoreComponents = {
3950
+ Card: any;
3951
+ CardHeader: any;
3952
+ CardTitle: any;
3953
+ CardDescription: any;
3954
+ CardContent: any;
3955
+ CardFooter: any;
3956
+ Button: any;
3957
+ HourlyOutputChart: any;
3958
+ };
3959
+ declare const useRegistry: () => CoreComponents;
3960
+ interface RegistryProviderProps {
3961
+ children: ReactNode;
3962
+ components?: Partial<CoreComponents>;
3963
+ }
3964
+ declare function RegistryProvider({ children, components }: RegistryProviderProps): react_jsx_runtime.JSX.Element;
3965
+ declare function withRegistry<P extends object>(Component: React__default.ComponentType<P>): {
3966
+ (props: P): react_jsx_runtime.JSX.Element;
3967
+ displayName: string;
3968
+ };
3969
+
3970
+ declare const DEFAULT_DATABASE_CONFIG: DatabaseConfig;
3971
+ declare const DEFAULT_ENTITY_CONFIG: EntityConfig;
3972
+ declare const DEFAULT_SHIFT_CONFIG: ShiftConfig;
3973
+ declare const DEFAULT_WORKSPACE_CONFIG: WorkspaceConfig;
3974
+ declare const DEFAULT_DATE_TIME_CONFIG: DateTimeConfig;
3975
+ declare const DEFAULT_ENDPOINTS_CONFIG: EndpointsConfig;
3976
+ declare const DEFAULT_THEME_CONFIG: ThemeConfig;
3977
+ declare const DEFAULT_ANALYTICS_CONFIG: AnalyticsConfig;
3978
+ declare const DEFAULT_AUTH_CONFIG: AuthConfig;
3979
+ declare const LINE_1_UUID = "910a224b-0abc-459a-babb-4c899824cfe7";
3980
+ declare const DEFAULT_CONFIG: Omit<DashboardConfig, 'supabaseUrl' | 'supabaseKey'>;
3981
+
3982
+ /**
3983
+ * Standard action names used across the dashboard.
3984
+ * These represent common operations or activities tracked in the system.
3985
+ */
3986
+ declare const ACTION_NAMES: {
3987
+ /** Assembly operations */
3988
+ readonly ASSEMBLY: "Assembly";
3989
+ /** Packaging operations */
3990
+ readonly PACKAGING: "Packaging";
3991
+ /** Inspection operations */
3992
+ readonly INSPECTION: "Inspection";
3993
+ /** Testing operations */
3994
+ readonly TESTING: "Testing";
3995
+ /** Quality control operations */
3996
+ readonly QUALITY_CONTROL: "Quality Control";
3997
+ };
3998
+ type ActionName = typeof ACTION_NAMES[keyof typeof ACTION_NAMES];
3999
+
4000
+ interface BottleneckVideo {
4001
+ id: string;
4002
+ src: string;
4003
+ timestamp: string;
4004
+ severity: 'low' | 'medium' | 'high';
4005
+ description: string;
4006
+ type: 'bottleneck' | 'low_value';
4007
+ originalUri: string;
4008
+ }
4009
+ interface S3ServiceConfig {
4010
+ region?: string;
4011
+ bucketName: string;
4012
+ signedUrlExpiresIn?: number;
4013
+ accessKeyId?: string;
4014
+ secretAccessKey?: string;
4015
+ sessionToken?: string;
4016
+ endpoint?: string;
4017
+ useAccelerateEndpoint?: boolean;
4018
+ customUserAgent?: string;
4019
+ useSimulatedMode?: boolean;
4020
+ publicBaseUrl?: string;
4021
+ }
4022
+ declare class S3Service {
4023
+ private s3Client;
4024
+ private bucketName;
4025
+ private signedUrlExpiresIn;
4026
+ private useSimulatedMode;
4027
+ private publicBaseUrl;
4028
+ constructor(config: S3ServiceConfig);
4029
+ /**
4030
+ * Check if service is in simulated mode
4031
+ */
4032
+ isSimulated(): boolean;
4033
+ /**
4034
+ * List S3 clips for a specific workspace and date
4035
+ */
4036
+ listS3Clips(workspaceId: string, date?: string): Promise<string[]>;
4037
+ /**
4038
+ * Generate mock S3 URIs for simulated mode
4039
+ */
4040
+ private generateMockS3Uris;
4041
+ /**
4042
+ * Generate a signed URL for an S3 URI
4043
+ */
4044
+ generateSignedS3Url(s3Uri: string): Promise<string | null>;
4045
+ /**
4046
+ * Parse simulated URI for demo mode
4047
+ */
4048
+ private parseSimulatedUri;
4049
+ /**
4050
+ * Parse S3 URI to extract information about the video
4051
+ */
4052
+ parseS3Uri(s3Uri: string): Omit<BottleneckVideo, 'id' | 'src'> | null;
4053
+ /**
4054
+ * Get all clips for a workspace on a specific date
4055
+ */
4056
+ getWorkspaceClips(workspaceId: string, date?: string): Promise<BottleneckVideo[]>;
4057
+ }
4058
+
4059
+ interface OptifyeAgentContext {
4060
+ timeframe?: string;
4061
+ focus?: string;
4062
+ [key: string]: any;
4063
+ }
4064
+ interface OptifyeAgentRequest {
4065
+ prompt: string;
4066
+ line_id: string;
4067
+ shift_id: number;
4068
+ company_id: string;
4069
+ context?: OptifyeAgentContext;
4070
+ }
4071
+ interface OptifyeAgentResponse {
4072
+ success: boolean;
4073
+ analysis?: string;
4074
+ timestamp?: string;
4075
+ error?: string;
4076
+ }
4077
+ /**
4078
+ * Client for integrating with Optifye Agent API
4079
+ */
4080
+ declare class OptifyeAgentClient {
4081
+ private apiUrl;
4082
+ constructor(apiUrl?: string);
4083
+ /**
4084
+ * Call Optifye Agent for manufacturing analysis
4085
+ */
4086
+ getManufacturingInsights(userQuestion: string, lineId: string, shiftId: number, companyId: string, context?: OptifyeAgentContext): Promise<OptifyeAgentResponse>;
4087
+ /**
4088
+ * Check if Optifye Agent API is healthy
4089
+ */
4090
+ checkHealth(): Promise<boolean>;
4091
+ }
4092
+ declare const optifyeAgentClient: OptifyeAgentClient;
4093
+ /**
4094
+ * Simple function to get manufacturing insights with better error handling
4095
+ */
4096
+ declare function getManufacturingInsights(userQuestion: string, lineId: string, shiftId: number, companyId: string, context?: OptifyeAgentContext): Promise<OptifyeAgentResponse>;
4097
+
4098
+ /**
4099
+ * Streaming proxy configuration
4100
+ */
4101
+ interface StreamProxyConfig {
4102
+ cloudFrontDomain?: string;
4103
+ }
4104
+ /**
4105
+ * Creates a streaming proxy handler for CloudFront HLS videos
4106
+ * This is required for local development to bypass CORS restrictions
4107
+ *
4108
+ * @param config - Optional configuration for the proxy
4109
+ * @returns Next.js API handler function
4110
+ *
4111
+ * @example
4112
+ * // In your Next.js API route (e.g., pages/api/stream/[...path].ts):
4113
+ * import { createStreamProxyHandler } from '@optifye/dashboard-core';
4114
+ *
4115
+ * export default createStreamProxyHandler();
4116
+ *
4117
+ * export const config = {
4118
+ * api: {
4119
+ * bodyParser: false,
4120
+ * responseLimit: false,
4121
+ * },
4122
+ * };
4123
+ */
4124
+ declare function createStreamProxyHandler(config?: StreamProxyConfig): (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
4125
+ /**
4126
+ * Next.js API configuration for streaming endpoints
4127
+ * Export this from your API route file
4128
+ *
4129
+ * @example
4130
+ * export { streamProxyConfig as config } from '@optifye/dashboard-core';
4131
+ */
4132
+ declare const streamProxyConfig: {
4133
+ api: {
4134
+ bodyParser: boolean;
4135
+ responseLimit: boolean;
4136
+ };
4137
+ };
3528
4138
 
3529
- export { ACTION_NAMES, type Action, type ActionName, type ActionService, type ActionThreshold, type AnalyticsConfig, type AuthConfig, AuthProvider, type AuthUser, AuthenticatedFactoryView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, type BarChartDataItem, type BarChartProps, type BarProps, BaseHistoryCalendar, type BaseLineMetric, type BasePerformanceMetric, type BottleneckFilterType, type BottleneckVideo, BottlenecksContent, type BottlenecksContentProps, type BreadcrumbItem, type Break, type BreakRowProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ClipCounts, type ComponentOverride, type CurrentShiftResult, CycleTimeChart, type CycleTimeChartProps, CycleTimeOverTimeChart, type CycleTimeOverTimeChartProps, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, type DashboardConfig, DashboardHeader, type DashboardKPIs, DashboardLayout, type DashboardLayoutProps, DashboardOverridesProvider, DashboardProvider, type DashboardService, type DatabaseConfig, DateDisplay, type DateTimeConfig, DateTimeDisplay, type DayHistoryData, type DaySummaryData, EmptyStateMessage, type EndpointsConfig, type EntityConfig, type FactoryOverviewData, FactoryView, type FactoryViewProps, type FormatNumberOptions, GridComponentsPlaceholder, Header, type HeaderProps, type HistoryCalendarProps, HomeView, type HomeViewProps, type HookOverride, HourlyOutputChart, type HourlyOutputChartProps, type HourlyPerformance, type ISTDateProps, ISTTimer, type ISTTimerProps, KPICard, type KPICardProps, KPIDetailView, KPIGrid, type KPIGridProps, KPIHeader, type KPIHeaderProps, KPISection, type KPITrend, LINE_1_UUID, LargeOutputProgressChart, type LargeOutputProgressChartProps, LeaderboardDetailView, type LeaderboardDetailViewProps, type LeaderboardEntry, LeaderboardIndexView, type LeaderboardIndexViewProps, type LeaderboardLineOption, Legend, LineChart, type LineChartDataItem, type LineChartProps, type LineDetails, type LineDisplayData, LineHistoryCalendar, type LineHistoryCalendarProps, type LineInfo, type LineMetrics, LineMonthlyHistory, type LineMonthlyHistoryProps, type LineMonthlyMetric, type LineNavigationParams, LinePdfExportButton, type LinePdfExportButtonProps, LinePdfGenerator, type LinePdfGeneratorProps, type LineProps, type LineShiftConfig, type LineSnapshot, type LineThreshold, LineWhatsAppShareButton, type LineWhatsAppShareProps, LiveTimer, LoadingOverlay, LoadingPage, LoadingSpinner, MainLayout, type MainLayoutProps, type Metric, MetricCard, type MetricsError, type NavItem, type NavItemTrackingEvent, NoWorkspaceData, type OperatorData, type OperatorInfo, OutputProgressChart, type OutputProgressChartProps, type OverridesMap, type OverviewLineMetric, type OverviewWorkspaceMetric, PageHeader, type PageHeaderProps, type PageOverride, type PoorPerformingWorkspace, type ProfileMenuItem, type QualityMetric, type QualityOverview, type QualityService, type RealtimeService, type RoutePath, S3Service, type S3ServiceConfig, SOPComplianceChart, type SOPComplianceChartProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ShiftConfig, type ShiftConfiguration, type ShiftConfigurationRecord, type ShiftData$2 as ShiftData, ShiftDisplay, type ShiftHistoryData, type ShiftHoursMap, type ShiftPanelProps, type ShiftSummaryData, type ShiftTime, ShiftsView, type ShiftsViewProps, SideNavBar, type SideNavBarProps, type SimpleLine, SingleVideoStream, type SingleVideoStreamProps, Skeleton, type SupabaseClient, SupabaseProvider, type Target, TargetWorkspaceGrid, type TargetWorkspaceGridProps, TargetsView, type ThemeColorValue, type ThemeConfig, TimeDisplay, type TrackingEventProperties, type UnderperformingWorkspace, type UnderperformingWorkspaces, type UseDashboardMetricsProps, type UseFactoryOverviewOptions, type UseFormatNumberResult, type UseRealtimeLineMetricsProps, type UseTargetsOptions, type UseWorkspaceOperatorsOptions, type UserProfileConfig, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, type WhatsAppSendResult, WhatsAppShareButton, type WhatsappService, type Workspace, type WorkspaceActionUpdate, WorkspaceCard, type WorkspaceCardProps, type WorkspaceConfig, WrappedComponent as WorkspaceDetailView, type WorkspaceDetailedMetrics, WorkspaceGrid, WorkspaceGridItem, type WorkspaceGridItemProps, WorkspaceHistoryCalendar, WorkspaceMetricCards, type WorkspaceMetricCardsProps, type WorkspaceMetrics, WorkspaceMonthlyDataFetcher, type WorkspaceMonthlyDataFetcherProps, type WorkspaceMonthlyMetric, type WorkspaceNavigationParams, WorkspacePdfExportButton, type WorkspacePdfExportButtonProps, WorkspacePdfGenerator, type WorkspacePdfGeneratorProps, type WorkspacePosition, type WorkspaceQualityData, type WorkspaceUrlMapping, WorkspaceWhatsAppShareButton, type WorkspaceWhatsAppShareProps, actionService, apiUtils, authCoreService, cn, createSupabaseClient, dashboardService, formatDateInZone, formatDateTimeInZone, formatISTDate, formatTimeInZone, fromUrlFriendlyName, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getMetricsTablePrefix, getOperationalDate, getShortWorkspaceDisplayName, getStoredWorkspaceMappings, getWorkspaceDisplayName, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, mergeWithDefaultConfig, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, resetCoreMixpanel, storeWorkspaceMapping, toUrlFriendlyName, trackCoreEvent, trackCorePageView, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useShiftConfig, useShifts, useSupabase, useTargets, useTheme, useThemeConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, workspaceDisplayNames, workspaceService };
4139
+ export { ACTION_NAMES, AIAgentView, type Action, type ActionName, type ActionService, type ActionThreshold, type AnalyticsConfig, AuthCallback, type AuthCallbackProps, AuthCallbackView, type AuthCallbackViewProps, type AuthConfig, AuthProvider, type AuthUser, AuthenticatedFactoryView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, type BarChartDataItem, type BarChartProps, type BarProps, BaseHistoryCalendar, type BaseHistoryCalendarProps, type BaseLineMetric, type BasePerformanceMetric, type BottleneckFilterType, type BottleneckVideo, type BottleneckVideoData, BottlenecksContent, type BottlenecksContentProps, type BreadcrumbItem, type Break, type BreakRowProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ClipCounts, type ComponentOverride, type CoreComponents, type CurrentShiftResult, CycleTimeChart, type CycleTimeChartProps, CycleTimeOverTimeChart, type CycleTimeOverTimeChartProps, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, type DashboardConfig, DashboardHeader, type DashboardKPIs, DashboardLayout, type DashboardLayoutProps, DashboardOverridesProvider, DashboardProvider, type DashboardService, type DatabaseConfig, DateDisplay, type DateTimeConfig, DateTimeDisplay, type DateTimeDisplayProps, type DayHistoryData, type DaySummaryData, DebugAuth, DebugAuthView, EmptyStateMessage, type EmptyStateMessageProps, type EndpointsConfig, type EntityConfig, type FactoryOverviewData, FactoryView, type FactoryViewProps, type FormatNumberOptions, GridComponentsPlaceholder, Header, type HeaderProps, type HistoryCalendarProps, HomeView, type HookOverride, HourlyOutputChart, type HourlyOutputChartProps, type HourlyPerformance, type ISTDateProps, ISTTimer, type ISTTimerProps, KPICard, type KPICardProps, KPIDetailView, type KPIDetailViewProps, KPIGrid, type KPIGridProps, KPIHeader, type KPIHeaderProps, KPISection, type KPITrend, LINE_1_UUID, LargeOutputProgressChart, type LargeOutputProgressChartProps, LeaderboardDetailView, type LeaderboardDetailViewProps, type LeaderboardEntry, LeaderboardIndexView, type LeaderboardIndexViewProps, type LeaderboardLineOption, Legend, LineChart, type LineChartDataItem, type LineChartProps, type LineDetails, type LineDisplayData, LineHistoryCalendar, type LineHistoryCalendarProps, type LineInfo, type LineMetrics, LineMonthlyHistory, type LineMonthlyHistoryProps, type LineMonthlyMetric, LineMonthlyPdfGenerator, type LineMonthlyPdfGeneratorProps, type LineNavigationParams, LinePdfExportButton, type LinePdfExportButtonProps, LinePdfGenerator, type LinePdfGeneratorProps, type LineProps, type LineShiftConfig, type LineSnapshot, type LineThreshold, LineWhatsAppShareButton, type LineWhatsAppShareProps, LiveTimer, LoadingOverlay, LoadingPage, LoadingSpinner, LoginPage, type LoginPageProps, LoginView, type LoginViewProps, MainLayout, type MainLayoutProps, type Metric, MetricCard, type MetricCardProps$1 as MetricCardProps, type MetricsError, type NavItem, type NavItemTrackingEvent, NoWorkspaceData, type OperatorData, type OperatorInfo, OptifyeAgentClient, type OptifyeAgentContext, type OptifyeAgentRequest, type OptifyeAgentResponse, OutputProgressChart, type OutputProgressChartProps, type OverridesMap, type OverviewLineMetric, type OverviewWorkspaceMetric, PageHeader, type PageHeaderProps, type PageOverride, type PoorPerformingWorkspace, type ProfileMenuItem, ProfileView, type QualityMetric, type QualityOverview, type QualityService, type RateLimitOptions, type RateLimitResult, type RealtimeService, RegistryProvider, type RoutePath, type S3ClipsAPIParams, type S3Config, type S3ListObjectsParams, S3Service, type S3ServiceConfig, SOPComplianceChart, type SOPComplianceChartProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ShiftConfig, type ShiftConfiguration, type ShiftConfigurationRecord, type ShiftData$2 as ShiftData, ShiftDisplay, type ShiftHistoryData, type ShiftHoursMap, type ShiftPanelProps, type ShiftSummaryData, type ShiftTime, ShiftsView, type ShiftsViewProps, SideNavBar, type SideNavBarProps, type SimpleLine, SingleVideoStream, type SingleVideoStreamProps, Skeleton, type StreamProxyConfig, type SupabaseClient, SupabaseProvider, type Target, TargetWorkspaceGrid, type TargetWorkspaceGridProps, TargetsView, type TargetsViewProps, type ThemeColorValue, type ThemeConfig, TimeDisplay, type TrackingEventProperties, type TrendDirection, type UnderperformingWorkspace, type UnderperformingWorkspaces, type UseDashboardMetricsProps, type UseFactoryOverviewOptions, type UseFormatNumberResult, type UseRealtimeLineMetricsProps, type UseTargetsOptions, type UseWorkspaceOperatorsOptions, type UserProfileConfig, VideoCard, VideoGridView, type VideoMetadata, VideoPreloader, type VideoSeverity, type VideoSummary, type VideoType, WORKSPACE_POSITIONS, type WhatsAppSendResult, WhatsAppShareButton, type WhatsAppShareButtonProps, type WhatsappService, type Workspace, type WorkspaceActionUpdate, WorkspaceCard, type WorkspaceCardProps, type WorkspaceConfig, WrappedComponent as WorkspaceDetailView, type WorkspaceDetailedMetrics, WorkspaceGrid, WorkspaceGridItem, type WorkspaceGridItemProps, WorkspaceHistoryCalendar, WorkspaceMetricCards, type WorkspaceMetricCardsProps, type WorkspaceMetrics, WorkspaceMonthlyDataFetcher, type WorkspaceMonthlyDataFetcherProps, type WorkspaceMonthlyMetric, WorkspaceMonthlyPdfGenerator, type WorkspaceMonthlyPdfGeneratorProps, type WorkspaceNavigationParams, WorkspacePdfExportButton, type WorkspacePdfExportButtonProps, WorkspacePdfGenerator, type WorkspacePdfGeneratorProps, type WorkspacePosition, type WorkspaceQualityData, type WorkspaceUrlMapping, WorkspaceWhatsAppShareButton, type WorkspaceWhatsAppShareProps, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit, clearAllRateLimits, clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };