flowgrid-sdk 1.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/dist/browser.d.ts +119 -0
  3. package/dist/flowgrid.min.js +2 -0
  4. package/dist/flowgrid.min.js.map +1 -0
  5. package/dist/index.d.ts +44 -0
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lib/client/enterprise-ftrpc.d.ts +51 -0
  9. package/dist/lib/client/ftrpc.d.ts +43 -0
  10. package/dist/lib/client/modules.d.ts +104 -0
  11. package/dist/lib/features/analytics/attribution.d.ts +257 -0
  12. package/dist/lib/features/analytics/events.d.ts +304 -0
  13. package/dist/lib/features/analytics/funnels.d.ts +291 -0
  14. package/dist/lib/features/analytics/heatmaps.d.ts +247 -0
  15. package/dist/lib/features/analytics/identify.d.ts +273 -0
  16. package/dist/lib/features/analytics/index.d.ts +22 -0
  17. package/dist/lib/features/analytics/page-views.d.ts +250 -0
  18. package/dist/lib/features/analytics/performance.d.ts +281 -0
  19. package/dist/lib/features/analytics/retention.d.ts +294 -0
  20. package/dist/lib/features/analytics/sessions.d.ts +277 -0
  21. package/dist/lib/features/core/activation.d.ts +239 -0
  22. package/dist/lib/features/core/experiment.d.ts +286 -0
  23. package/dist/lib/features/core/feature-flag.d.ts +264 -0
  24. package/dist/lib/features/core/index.d.ts +14 -0
  25. package/dist/lib/features/core/track-feature.d.ts +220 -0
  26. package/dist/lib/features/core/track-prompt.d.ts +247 -0
  27. package/dist/lib/features/ecommerce/cart.d.ts +298 -0
  28. package/dist/lib/features/ecommerce/checkout.d.ts +324 -0
  29. package/dist/lib/features/ecommerce/index.d.ts +26 -0
  30. package/dist/lib/features/ecommerce/inventory.d.ts +221 -0
  31. package/dist/lib/features/ecommerce/ltv.d.ts +258 -0
  32. package/dist/lib/features/ecommerce/products.d.ts +268 -0
  33. package/dist/lib/features/ecommerce/promotions.d.ts +266 -0
  34. package/dist/lib/features/ecommerce/purchases.d.ts +287 -0
  35. package/dist/lib/features/ecommerce/refunds.d.ts +232 -0
  36. package/dist/lib/features/ecommerce/search.d.ts +225 -0
  37. package/dist/lib/features/ecommerce/subscriptions.d.ts +281 -0
  38. package/dist/lib/features/ecommerce/wishlist.d.ts +236 -0
  39. package/dist/lib/features/enterprise/acquisition.d.ts +373 -0
  40. package/dist/lib/features/enterprise/alerts.d.ts +348 -0
  41. package/dist/lib/features/enterprise/churn.d.ts +288 -0
  42. package/dist/lib/features/enterprise/cohorts.d.ts +270 -0
  43. package/dist/lib/features/enterprise/engagement.d.ts +233 -0
  44. package/dist/lib/features/enterprise/forecasting.d.ts +351 -0
  45. package/dist/lib/features/enterprise/index.d.ts +20 -0
  46. package/dist/lib/features/enterprise/monetization.d.ts +356 -0
  47. package/dist/lib/features/enterprise/multi-path-funnels.d.ts +327 -0
  48. package/dist/lib/features/enterprise/paths.d.ts +332 -0
  49. package/dist/lib/features/enterprise/security.d.ts +387 -0
  50. package/dist/lib/features/enterprise/support.d.ts +329 -0
  51. package/dist/lib/frameworks/index.d.ts +9 -0
  52. package/dist/lib/frameworks/nextjs/client.d.ts +208 -0
  53. package/dist/lib/frameworks/nextjs/index.d.ts +29 -0
  54. package/dist/lib/frameworks/nextjs/server.d.ts +201 -0
  55. package/dist/lib/frameworks/node/index.d.ts +265 -0
  56. package/dist/lib/frameworks/nuxt/index.d.ts +190 -0
  57. package/dist/lib/frameworks/react/index.d.ts +245 -0
  58. package/dist/lib/frameworks/vue/index.d.ts +275 -0
  59. package/dist/lib/types/analytics.d.ts +365 -0
  60. package/dist/lib/types/common.d.ts +230 -0
  61. package/dist/lib/types/ecommerce.d.ts +309 -0
  62. package/dist/lib/types/index.d.ts +7 -0
  63. package/dist/lib/utils/functions.d.ts +1 -0
  64. package/package.json +139 -0
@@ -0,0 +1,332 @@
1
+ /**
2
+ * @fileoverview Enterprise - Behavioral Analytics & Path Analysis
3
+ * @module features/enterprise/paths
4
+ *
5
+ * @description
6
+ * Track full user navigation and feature usage sequences.
7
+ * Identify common paths, dead-ends, and UX friction points.
8
+ *
9
+ * @useCases
10
+ * - Sequence analysis of feature usage
11
+ * - Dead-end screen detection
12
+ * - Most common path identification
13
+ * - User journey mapping
14
+ * - UX friction detection
15
+ *
16
+ * @metrics
17
+ * - Path frequency
18
+ * - Path completion rate
19
+ * - Dead-end rate
20
+ * - Average path length
21
+ * - Time per path
22
+ *
23
+ * @chartData
24
+ * - Sankey diagram: User flow
25
+ * - Tree map: Path distribution
26
+ * - Heatmap: Screen transitions
27
+ * - Timeline: User journeys
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const paths = new PathAnalytics(webId, endpoint, apiKey);
32
+ *
33
+ * // Track screen/page transition
34
+ * await paths.trackTransition({
35
+ * userId: 'user_123',
36
+ * fromScreen: 'dashboard',
37
+ * toScreen: 'settings'
38
+ * });
39
+ * ```
40
+ */
41
+ import { EnterpriseFTRPC } from "../../client/enterprise-ftrpc";
42
+ import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
43
+ /**
44
+ * Screen/page transition configuration.
45
+ */
46
+ export interface TransitionConfig {
47
+ /** User ID */
48
+ userId: string;
49
+ /** Session ID */
50
+ sessionId?: string;
51
+ /** Source screen/page */
52
+ fromScreen: string;
53
+ /** Destination screen/page */
54
+ toScreen: string;
55
+ /** Time spent on source screen (ms) */
56
+ timeSpentMs?: number;
57
+ /** Trigger action */
58
+ trigger?: string;
59
+ /** Custom properties */
60
+ properties?: Record<string, unknown>;
61
+ }
62
+ /**
63
+ * Feature sequence configuration.
64
+ */
65
+ export interface FeatureSequenceConfig {
66
+ /** User ID */
67
+ userId: string;
68
+ /** Session ID */
69
+ sessionId?: string;
70
+ /** Feature/action name */
71
+ feature: string;
72
+ /** Sequence order in session */
73
+ order: number;
74
+ /** Time spent (ms) */
75
+ timeSpentMs?: number;
76
+ /** Whether action was successful */
77
+ successful?: boolean;
78
+ }
79
+ /**
80
+ * Path definition.
81
+ */
82
+ export interface PathDefinition {
83
+ /** Path identifier */
84
+ pathId?: string;
85
+ /** Path name */
86
+ name: string;
87
+ /** Description */
88
+ description?: string;
89
+ /** Ordered list of screens/steps */
90
+ screens: string[];
91
+ /** Goal screen (optional) */
92
+ goal?: string;
93
+ /** Tags */
94
+ tags?: string[];
95
+ }
96
+ /**
97
+ * Path analysis configuration.
98
+ */
99
+ export interface PathAnalysisConfig {
100
+ /** Date range */
101
+ filter?: DateRangeFilter;
102
+ /** Starting screen */
103
+ startScreen?: string;
104
+ /** Ending screen */
105
+ endScreen?: string;
106
+ /** Minimum path occurrences */
107
+ minOccurrences?: number;
108
+ /** Maximum path length */
109
+ maxLength?: number;
110
+ }
111
+ /**
112
+ * Path analytics result.
113
+ */
114
+ export interface PathResult {
115
+ /** Path screens */
116
+ path: string[];
117
+ /** Number of users who took this path */
118
+ userCount: number;
119
+ /** Percentage of total users */
120
+ percentage: number;
121
+ /** Average time to complete path (ms) */
122
+ avgTimeMs: number;
123
+ /** Completion rate (if goal defined) */
124
+ completionRate?: number;
125
+ /** Drop-off at each step */
126
+ dropOffByStep?: Array<{
127
+ step: string;
128
+ dropOffRate: number;
129
+ }>;
130
+ }
131
+ /**
132
+ * Dead-end screen.
133
+ */
134
+ export interface DeadEndScreen {
135
+ /** Screen name */
136
+ screen: string;
137
+ /** Exit rate (users who leave from this screen) */
138
+ exitRate: number;
139
+ /** User count */
140
+ userCount: number;
141
+ /** Average time before exit (ms) */
142
+ avgTimeBeforeExitMs: number;
143
+ /** Previous screens (where users came from) */
144
+ previousScreens: Array<{
145
+ screen: string;
146
+ count: number;
147
+ }>;
148
+ /** Is this a dead-end (high exit, not intended end point) */
149
+ isDeadEnd: boolean;
150
+ }
151
+ /**
152
+ * Screen transition matrix.
153
+ */
154
+ export interface TransitionMatrix {
155
+ /** All screens */
156
+ screens: string[];
157
+ /** Transition probabilities (screens.length x screens.length) */
158
+ matrix: number[][];
159
+ /** Total transitions */
160
+ totalTransitions: number;
161
+ }
162
+ /**
163
+ * User journey configuration.
164
+ */
165
+ export interface UserJourneyConfig {
166
+ /** User ID */
167
+ userId: string;
168
+ /** Session ID (optional, get all sessions if not provided) */
169
+ sessionId?: string;
170
+ /** Date range */
171
+ filter?: DateRangeFilter;
172
+ }
173
+ /**
174
+ * User journey result.
175
+ */
176
+ export interface UserJourney {
177
+ userId: string;
178
+ sessions: Array<{
179
+ sessionId: string;
180
+ startTime: string;
181
+ endTime: string;
182
+ path: Array<{
183
+ screen: string;
184
+ timestamp: string;
185
+ timeSpentMs: number;
186
+ actions?: string[];
187
+ }>;
188
+ totalDurationMs: number;
189
+ screenCount: number;
190
+ }>;
191
+ }
192
+ /**
193
+ * Friction point.
194
+ */
195
+ export interface FrictionPoint {
196
+ /** Screen or step */
197
+ location: string;
198
+ /** Friction type */
199
+ type: 'high_exit' | 'long_dwell' | 'rage_clicks' | 'back_navigation' | 'error';
200
+ /** Severity score (0-100) */
201
+ severity: number;
202
+ /** Affected users */
203
+ affectedUsers: number;
204
+ /** Suggested improvement */
205
+ suggestion?: string;
206
+ }
207
+ /**
208
+ * Path comparison.
209
+ */
210
+ export interface PathComparison {
211
+ /** Paths being compared */
212
+ paths: PathResult[];
213
+ /** Statistical significance */
214
+ significant: boolean;
215
+ /** Winner (if significant) */
216
+ winner?: string;
217
+ /** Metrics comparison */
218
+ comparison: {
219
+ metric: string;
220
+ values: Record<string, number>;
221
+ difference: number;
222
+ }[];
223
+ }
224
+ /**
225
+ * Convert path array to string identifier.
226
+ */
227
+ export declare function pathToString(path: string[]): string;
228
+ /**
229
+ * Convert string identifier to path array.
230
+ */
231
+ export declare function stringToPath(pathString: string): string[];
232
+ /**
233
+ * Calculate exit rate.
234
+ */
235
+ export declare function calculateExitRate(exits: number, entries: number): number;
236
+ /**
237
+ * Identify if a screen is a dead-end.
238
+ */
239
+ export declare function isDeadEnd(exitRate: number, isIntendedEndPoint: boolean, threshold?: number): boolean;
240
+ /**
241
+ * Calculate path similarity (Jaccard index).
242
+ */
243
+ export declare function calculatePathSimilarity(path1: string[], path2: string[]): number;
244
+ /**
245
+ * Find common sub-paths.
246
+ */
247
+ export declare function findCommonSubPaths(paths: string[][], minLength?: number): Array<{
248
+ subPath: string[];
249
+ count: number;
250
+ }>;
251
+ /**
252
+ * Behavioral analytics and path analysis class.
253
+ */
254
+ export declare class PathAnalytics extends EnterpriseFTRPC {
255
+ /**
256
+ * Track screen/page transition.
257
+ */
258
+ trackTransition(config: TransitionConfig): Promise<{
259
+ tracked: boolean;
260
+ }>;
261
+ /**
262
+ * Track feature sequence.
263
+ */
264
+ trackFeatureSequence(config: FeatureSequenceConfig): Promise<{
265
+ tracked: boolean;
266
+ }>;
267
+ /**
268
+ * Define a path for tracking.
269
+ */
270
+ definePath(definition: PathDefinition): Promise<{
271
+ pathId: string;
272
+ }>;
273
+ /**
274
+ * Get top paths.
275
+ */
276
+ getTopPaths(config?: PathAnalysisConfig): Promise<PathResult[]>;
277
+ /**
278
+ * Get paths between screens.
279
+ */
280
+ getPathsBetween(startScreen: string, endScreen: string, filter?: DateRangeFilter, limit?: number): Promise<PathResult[]>;
281
+ /**
282
+ * Get dead-end screens.
283
+ */
284
+ getDeadEnds(filter?: DateRangeFilter, intendedEndPoints?: string[]): Promise<DeadEndScreen[]>;
285
+ /**
286
+ * Get transition matrix.
287
+ */
288
+ getTransitionMatrix(filter?: DateRangeFilter): Promise<TransitionMatrix>;
289
+ /**
290
+ * Get user journey.
291
+ */
292
+ getUserJourney(config: UserJourneyConfig): Promise<UserJourney>;
293
+ /**
294
+ * Get friction points.
295
+ */
296
+ getFrictionPoints(filter?: DateRangeFilter): Promise<FrictionPoint[]>;
297
+ /**
298
+ * Compare paths.
299
+ */
300
+ comparePaths(paths: string[][], filter?: DateRangeFilter): Promise<PathComparison>;
301
+ /**
302
+ * Get screen analytics.
303
+ */
304
+ getScreenAnalytics(screen: string, filter?: DateRangeFilter): Promise<{
305
+ screen: string;
306
+ visits: number;
307
+ uniqueUsers: number;
308
+ avgTimeSpentMs: number;
309
+ exitRate: number;
310
+ entryRate: number;
311
+ topNextScreens: Array<{
312
+ screen: string;
313
+ count: number;
314
+ }>;
315
+ topPreviousScreens: Array<{
316
+ screen: string;
317
+ count: number;
318
+ }>;
319
+ }>;
320
+ /**
321
+ * Get path trend.
322
+ */
323
+ getPathTrend(path: string[], filter?: DateRangeFilter, granularity?: TimeGranularity): Promise<TimeSeriesData>;
324
+ /**
325
+ * Get feature usage sequences.
326
+ */
327
+ getFeatureSequences(filter?: DateRangeFilter, limit?: number): Promise<Array<{
328
+ sequence: string[];
329
+ userCount: number;
330
+ avgTimeMs: number;
331
+ }>>;
332
+ }
@@ -0,0 +1,387 @@
1
+ /**
2
+ * @fileoverview Enterprise - Security & Compliance Analytics
3
+ * @module features/enterprise/security
4
+ *
5
+ * @description
6
+ * Track activity for security, privacy, and regulatory compliance.
7
+ * Monitor login attempts, role changes, and compliance events.
8
+ *
9
+ * @useCases
10
+ * - Track failed login attempts
11
+ * - Monitor role/permission changes
12
+ * - GDPR/CCPA compliance events
13
+ * - Audit logging
14
+ * - Security anomaly detection
15
+ *
16
+ * @metrics
17
+ * - Failed login rate
18
+ * - Suspicious activity count
19
+ * - Role change frequency
20
+ * - Data access patterns
21
+ * - Compliance event count
22
+ *
23
+ * @chartData
24
+ * - Line chart: Security events over time
25
+ * - Bar chart: Events by type
26
+ * - Table: Audit log
27
+ * - Heatmap: Access patterns
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const security = new SecurityAnalytics(webId, endpoint, apiKey);
32
+ *
33
+ * // Track login attempt
34
+ * await security.trackLoginAttempt({
35
+ * userId: 'user_123',
36
+ * success: false,
37
+ * reason: 'invalid_password'
38
+ * });
39
+ * ```
40
+ */
41
+ import { EnterpriseFTRPC } from "../../client/enterprise-ftrpc";
42
+ import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
43
+ /**
44
+ * Security event types.
45
+ */
46
+ export type SecurityEventType = 'login_attempt' | 'login_success' | 'login_failure' | 'logout' | 'password_change' | 'password_reset' | 'mfa_enabled' | 'mfa_disabled' | 'role_change' | 'permission_change' | 'data_access' | 'data_export' | 'data_deletion' | 'api_key_created' | 'api_key_revoked' | 'suspicious_activity';
47
+ /**
48
+ * Compliance event types.
49
+ */
50
+ export type ComplianceEventType = 'consent_given' | 'consent_withdrawn' | 'data_access_request' | 'data_deletion_request' | 'data_portability_request' | 'privacy_policy_update' | 'opt_out' | 'opt_in';
51
+ /**
52
+ * Login attempt configuration.
53
+ */
54
+ export interface LoginAttemptConfig {
55
+ /** User ID or email */
56
+ userId: string;
57
+ /** Whether login was successful */
58
+ success: boolean;
59
+ /** Failure reason (if failed) */
60
+ reason?: string;
61
+ /** IP address */
62
+ ipAddress?: string;
63
+ /** User agent */
64
+ userAgent?: string;
65
+ /** Device info */
66
+ device?: string;
67
+ /** Location */
68
+ location?: {
69
+ country?: string;
70
+ city?: string;
71
+ };
72
+ /** MFA used */
73
+ mfaUsed?: boolean;
74
+ }
75
+ /**
76
+ * Role change configuration.
77
+ */
78
+ export interface RoleChangeConfig {
79
+ /** User ID being changed */
80
+ userId: string;
81
+ /** Who made the change */
82
+ changedBy: string;
83
+ /** Previous role */
84
+ previousRole: string;
85
+ /** New role */
86
+ newRole: string;
87
+ /** Reason for change */
88
+ reason?: string;
89
+ }
90
+ /**
91
+ * Permission change configuration.
92
+ */
93
+ export interface PermissionChangeConfig {
94
+ /** User ID being changed */
95
+ userId: string;
96
+ /** Who made the change */
97
+ changedBy: string;
98
+ /** Permission being changed */
99
+ permission: string;
100
+ /** Action */
101
+ action: 'granted' | 'revoked';
102
+ /** Resource scope */
103
+ resourceScope?: string;
104
+ }
105
+ /**
106
+ * Data access configuration.
107
+ */
108
+ export interface DataAccessConfig {
109
+ /** User ID accessing data */
110
+ userId: string;
111
+ /** Resource type */
112
+ resourceType: string;
113
+ /** Resource ID */
114
+ resourceId?: string;
115
+ /** Access type */
116
+ accessType: 'read' | 'write' | 'delete' | 'export';
117
+ /** IP address */
118
+ ipAddress?: string;
119
+ /** Query/filter used */
120
+ query?: Record<string, unknown>;
121
+ }
122
+ /**
123
+ * Compliance event configuration.
124
+ */
125
+ export interface ComplianceEventConfig {
126
+ /** User ID */
127
+ userId: string;
128
+ /** Event type */
129
+ eventType: ComplianceEventType;
130
+ /** Regulation */
131
+ regulation?: 'GDPR' | 'CCPA' | 'HIPAA' | 'SOC2' | 'other';
132
+ /** Details */
133
+ details?: Record<string, unknown>;
134
+ /** Consent scope (for consent events) */
135
+ consentScope?: string[];
136
+ /** Request ID (for data requests) */
137
+ requestId?: string;
138
+ }
139
+ /**
140
+ * Audit log entry.
141
+ */
142
+ export interface AuditLogEntry {
143
+ /** Entry ID */
144
+ entryId: string;
145
+ /** Timestamp */
146
+ timestamp: string;
147
+ /** Event type */
148
+ eventType: SecurityEventType | ComplianceEventType;
149
+ /** Actor (who performed the action) */
150
+ actor: {
151
+ userId: string;
152
+ userEmail?: string;
153
+ ipAddress?: string;
154
+ };
155
+ /** Target (what was affected) */
156
+ target?: {
157
+ type: string;
158
+ id: string;
159
+ name?: string;
160
+ };
161
+ /** Action details */
162
+ details: Record<string, unknown>;
163
+ /** Severity */
164
+ severity: 'low' | 'medium' | 'high' | 'critical';
165
+ /** Was action successful */
166
+ success: boolean;
167
+ }
168
+ /**
169
+ * Security analytics filter.
170
+ */
171
+ export interface SecurityAnalyticsFilter extends DateRangeFilter {
172
+ /** Event type filter */
173
+ eventType?: SecurityEventType | SecurityEventType[];
174
+ /** User ID filter */
175
+ userId?: string;
176
+ /** Severity filter */
177
+ severity?: 'low' | 'medium' | 'high' | 'critical';
178
+ /** Success filter */
179
+ success?: boolean;
180
+ }
181
+ /**
182
+ * Security risk assessment.
183
+ */
184
+ export interface SecurityRiskAssessment {
185
+ /** User ID */
186
+ userId: string;
187
+ /** Risk score (0-100) */
188
+ riskScore: number;
189
+ /** Risk level */
190
+ riskLevel: 'low' | 'medium' | 'high' | 'critical';
191
+ /** Risk factors */
192
+ factors: Array<{
193
+ factor: string;
194
+ contribution: number;
195
+ details: string;
196
+ }>;
197
+ /** Last assessment date */
198
+ assessedAt: string;
199
+ /** Recommended actions */
200
+ recommendations: string[];
201
+ }
202
+ /**
203
+ * Security analytics result.
204
+ */
205
+ export interface SecurityAnalytics {
206
+ /** Total security events */
207
+ totalEvents: number;
208
+ /** Failed login count */
209
+ failedLogins: number;
210
+ /** Failed login rate */
211
+ failedLoginRate: number;
212
+ /** Suspicious activity count */
213
+ suspiciousActivityCount: number;
214
+ /** Role changes */
215
+ roleChanges: number;
216
+ /** Data access events */
217
+ dataAccessEvents: number;
218
+ /** By event type */
219
+ byEventType: Array<{
220
+ type: string;
221
+ count: number;
222
+ }>;
223
+ /** High risk users */
224
+ highRiskUsers: number;
225
+ /** Trend */
226
+ trend: TimeSeriesData;
227
+ }
228
+ /**
229
+ * Compliance report.
230
+ */
231
+ export interface ComplianceReport {
232
+ /** Report period */
233
+ period: DateRangeFilter;
234
+ /** Regulation */
235
+ regulation: string;
236
+ /** Consent stats */
237
+ consentStats: {
238
+ totalConsents: number;
239
+ activeConsents: number;
240
+ withdrawals: number;
241
+ };
242
+ /** Data requests */
243
+ dataRequests: {
244
+ accessRequests: number;
245
+ deletionRequests: number;
246
+ portabilityRequests: number;
247
+ avgResponseTimeHours: number;
248
+ };
249
+ /** Compliance score */
250
+ complianceScore: number;
251
+ /** Issues */
252
+ issues: Array<{
253
+ type: string;
254
+ severity: string;
255
+ description: string;
256
+ }>;
257
+ }
258
+ /**
259
+ * Classify risk level from score.
260
+ */
261
+ export declare function classifyRiskLevel(score: number): 'low' | 'medium' | 'high' | 'critical';
262
+ /**
263
+ * Calculate failed login rate.
264
+ */
265
+ export declare function calculateFailedLoginRate(failed: number, total: number): number;
266
+ /**
267
+ * Check if login pattern is suspicious.
268
+ */
269
+ export declare function isSuspiciousLoginPattern(failedAttempts: number, timeWindowMinutes: number, threshold?: number): boolean;
270
+ /**
271
+ * Determine event severity.
272
+ */
273
+ export declare function determineEventSeverity(eventType: SecurityEventType, success: boolean): 'low' | 'medium' | 'high' | 'critical';
274
+ /**
275
+ * Security and compliance analytics class.
276
+ */
277
+ export declare class SecurityAnalytics extends EnterpriseFTRPC {
278
+ /**
279
+ * Track login attempt.
280
+ */
281
+ trackLoginAttempt(config: LoginAttemptConfig): Promise<{
282
+ tracked: boolean;
283
+ }>;
284
+ /**
285
+ * Track logout.
286
+ */
287
+ trackLogout(userId: string, sessionId?: string): Promise<{
288
+ tracked: boolean;
289
+ }>;
290
+ /**
291
+ * Track password change.
292
+ */
293
+ trackPasswordChange(userId: string, forced?: boolean): Promise<{
294
+ tracked: boolean;
295
+ }>;
296
+ /**
297
+ * Track role change.
298
+ */
299
+ trackRoleChange(config: RoleChangeConfig): Promise<{
300
+ tracked: boolean;
301
+ }>;
302
+ /**
303
+ * Track permission change.
304
+ */
305
+ trackPermissionChange(config: PermissionChangeConfig): Promise<{
306
+ tracked: boolean;
307
+ }>;
308
+ /**
309
+ * Track data access.
310
+ */
311
+ trackDataAccess(config: DataAccessConfig): Promise<{
312
+ tracked: boolean;
313
+ }>;
314
+ /**
315
+ * Track data export.
316
+ */
317
+ trackDataExport(userId: string, resourceType: string, recordCount: number): Promise<{
318
+ tracked: boolean;
319
+ }>;
320
+ /**
321
+ * Track suspicious activity.
322
+ */
323
+ trackSuspiciousActivity(userId: string, activityType: string, details: Record<string, unknown>): Promise<{
324
+ tracked: boolean;
325
+ }>;
326
+ /**
327
+ * Track compliance event.
328
+ */
329
+ trackComplianceEvent(config: ComplianceEventConfig): Promise<{
330
+ tracked: boolean;
331
+ }>;
332
+ /**
333
+ * Get audit log.
334
+ */
335
+ getAuditLog(filter?: SecurityAnalyticsFilter, limit?: number): Promise<{
336
+ entries: AuditLogEntry[];
337
+ total: number;
338
+ }>;
339
+ /**
340
+ * Get user risk assessment.
341
+ */
342
+ getUserRiskAssessment(userId: string): Promise<SecurityRiskAssessment>;
343
+ /**
344
+ * Get high risk users.
345
+ */
346
+ getHighRiskUsers(minScore?: number, limit?: number): Promise<SecurityRiskAssessment[]>;
347
+ /**
348
+ * Get security analytics.
349
+ */
350
+ getAnalytics(filter?: SecurityAnalyticsFilter): Promise<SecurityAnalytics>;
351
+ /**
352
+ * Get compliance report.
353
+ */
354
+ getComplianceReport(regulation: 'GDPR' | 'CCPA' | 'HIPAA' | 'SOC2', filter?: DateRangeFilter): Promise<ComplianceReport>;
355
+ /**
356
+ * Get login analytics.
357
+ */
358
+ getLoginAnalytics(filter?: DateRangeFilter): Promise<{
359
+ totalAttempts: number;
360
+ successful: number;
361
+ failed: number;
362
+ failedRate: number;
363
+ uniqueUsers: number;
364
+ byLocation: Array<{
365
+ location: string;
366
+ count: number;
367
+ }>;
368
+ byDevice: Array<{
369
+ device: string;
370
+ count: number;
371
+ }>;
372
+ trend: TimeSeriesData;
373
+ }>;
374
+ /**
375
+ * Get security trend.
376
+ */
377
+ getSecurityTrend(filter?: SecurityAnalyticsFilter, granularity?: TimeGranularity): Promise<TimeSeriesData>;
378
+ /**
379
+ * Get data access patterns.
380
+ */
381
+ getDataAccessPatterns(userId?: string, filter?: DateRangeFilter): Promise<Array<{
382
+ resourceType: string;
383
+ accessCount: number;
384
+ uniqueUsers: number;
385
+ lastAccess: string;
386
+ }>>;
387
+ }