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,233 @@
1
+ /**
2
+ * @fileoverview Enterprise - Engagement Analytics
3
+ * @module features/enterprise/engagement
4
+ *
5
+ * @description
6
+ * Track deep user engagement beyond activation including
7
+ * feature dwell time, session depth, and content consumption.
8
+ *
9
+ * @useCases
10
+ * - Measure feature dwell time
11
+ * - Track session depth and engagement
12
+ * - Monitor content consumption patterns
13
+ * - Distinguish active vs passive users
14
+ * - Correlate engagement with retention
15
+ *
16
+ * @metrics
17
+ * - Average engagement time
18
+ * - Feature dwell time
19
+ * - Session depth score
20
+ * - Content consumption rate
21
+ * - Active user ratio
22
+ *
23
+ * @chartData
24
+ * - Line chart: Engagement over time
25
+ * - Bar chart: Engagement by feature
26
+ * - Heatmap: Engagement by time of day
27
+ * - Distribution: User engagement scores
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const engagement = new Engagement(webId, endpoint, apiKey);
32
+ *
33
+ * // Track feature dwell time
34
+ * await engagement.trackDwellTime({
35
+ * featureId: 'dashboard',
36
+ * userId: 'user_123',
37
+ * dwellTimeMs: 45000
38
+ * });
39
+ * ```
40
+ */
41
+ import { EnterpriseFTRPC } from "../../client/enterprise-ftrpc";
42
+ import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
43
+ /**
44
+ * Configuration for tracking feature dwell time.
45
+ */
46
+ export interface DwellTimeConfig {
47
+ /** Feature identifier */
48
+ featureId: string;
49
+ /** User ID */
50
+ userId?: string;
51
+ /** Session ID */
52
+ sessionId?: string;
53
+ /** Time spent on feature (ms) */
54
+ dwellTimeMs: number;
55
+ /** Whether user was actively interacting */
56
+ wasActive?: boolean;
57
+ /** Custom properties */
58
+ properties?: Record<string, unknown>;
59
+ }
60
+ /**
61
+ * Configuration for tracking session depth.
62
+ */
63
+ export interface SessionDepthConfig {
64
+ /** Session ID */
65
+ sessionId: string;
66
+ /** User ID */
67
+ userId?: string;
68
+ /** Number of pages/screens visited */
69
+ pagesVisited: number;
70
+ /** Number of features used */
71
+ featuresUsed: number;
72
+ /** Number of actions taken */
73
+ actionsTaken: number;
74
+ /** Total session duration (ms) */
75
+ durationMs: number;
76
+ }
77
+ /**
78
+ * Configuration for tracking content consumption.
79
+ */
80
+ export interface ContentConsumptionConfig {
81
+ /** Content identifier */
82
+ contentId: string;
83
+ /** Content type */
84
+ contentType: 'article' | 'video' | 'audio' | 'document' | 'course' | 'other';
85
+ /** User ID */
86
+ userId?: string;
87
+ /** Percentage consumed (0-100) */
88
+ percentageConsumed: number;
89
+ /** Time spent consuming (ms) */
90
+ timeSpentMs: number;
91
+ /** Whether content was completed */
92
+ completed?: boolean;
93
+ /** Custom properties */
94
+ properties?: Record<string, unknown>;
95
+ }
96
+ /**
97
+ * User activity classification.
98
+ */
99
+ export interface UserActivityConfig {
100
+ /** User ID */
101
+ userId: string;
102
+ /** Activity type */
103
+ activityType: 'active' | 'passive' | 'idle';
104
+ /** Duration in this state (ms) */
105
+ durationMs: number;
106
+ /** Session ID */
107
+ sessionId?: string;
108
+ }
109
+ /**
110
+ * Engagement score configuration.
111
+ */
112
+ export interface EngagementScoreConfig {
113
+ /** User ID */
114
+ userId: string;
115
+ /** Time period for score calculation */
116
+ period?: 'day' | 'week' | 'month';
117
+ }
118
+ /**
119
+ * Engagement analytics filter.
120
+ */
121
+ export interface EngagementAnalyticsFilter extends DateRangeFilter {
122
+ /** Filter by feature */
123
+ featureId?: string;
124
+ /** Filter by user segment */
125
+ segment?: string;
126
+ /** Minimum engagement score */
127
+ minScore?: number;
128
+ }
129
+ /**
130
+ * Engagement response from API.
131
+ */
132
+ export interface EngagementResponse {
133
+ eventName: string;
134
+ properties: Record<string, unknown>;
135
+ response: {
136
+ tracked: boolean;
137
+ engagementId: string;
138
+ timestamp: string;
139
+ };
140
+ }
141
+ /**
142
+ * Engagement score result.
143
+ */
144
+ export interface EngagementScore {
145
+ userId: string;
146
+ score: number;
147
+ percentile: number;
148
+ breakdown: {
149
+ dwellTime: number;
150
+ sessionDepth: number;
151
+ contentConsumption: number;
152
+ activityLevel: number;
153
+ };
154
+ trend: 'increasing' | 'stable' | 'decreasing';
155
+ period: string;
156
+ }
157
+ /**
158
+ * Engagement analytics result.
159
+ */
160
+ export interface EngagementAnalytics {
161
+ averageEngagementScore: number;
162
+ averageDwellTimeMs: number;
163
+ averageSessionDepth: number;
164
+ activeUserRatio: number;
165
+ contentCompletionRate: number;
166
+ topEngagedFeatures: Array<{
167
+ featureId: string;
168
+ averageDwellTime: number;
169
+ userCount: number;
170
+ }>;
171
+ engagementTrend: TimeSeriesData;
172
+ }
173
+ /**
174
+ * Calculate engagement score from multiple factors.
175
+ */
176
+ export declare function calculateEngagementScore(dwellTime: number, sessionDepth: number, activityRatio: number, contentCompletion: number): number;
177
+ /**
178
+ * Classify user engagement level.
179
+ */
180
+ export declare function classifyEngagementLevel(score: number): 'low' | 'medium' | 'high' | 'power';
181
+ /**
182
+ * Calculate session depth score.
183
+ */
184
+ export declare function calculateSessionDepthScore(pagesVisited: number, featuresUsed: number, actionsTaken: number): number;
185
+ /**
186
+ * Engagement analytics tracking class.
187
+ */
188
+ export declare class Engagement extends EnterpriseFTRPC {
189
+ /**
190
+ * Track feature dwell time.
191
+ */
192
+ trackDwellTime(config: DwellTimeConfig): Promise<EngagementResponse>;
193
+ /**
194
+ * Track session depth.
195
+ */
196
+ trackSessionDepth(config: SessionDepthConfig): Promise<EngagementResponse>;
197
+ /**
198
+ * Track content consumption.
199
+ */
200
+ trackContentConsumption(config: ContentConsumptionConfig): Promise<EngagementResponse>;
201
+ /**
202
+ * Track user activity state.
203
+ */
204
+ trackUserActivity(config: UserActivityConfig): Promise<EngagementResponse>;
205
+ /**
206
+ * Get engagement score for a user.
207
+ */
208
+ getEngagementScore(config: EngagementScoreConfig): Promise<EngagementScore>;
209
+ /**
210
+ * Get engagement analytics.
211
+ */
212
+ getAnalytics(filter?: EngagementAnalyticsFilter): Promise<EngagementAnalytics>;
213
+ /**
214
+ * Get engagement trend over time.
215
+ */
216
+ getEngagementTrend(filter?: DateRangeFilter, granularity?: TimeGranularity): Promise<TimeSeriesData>;
217
+ /**
218
+ * Get top engaged users.
219
+ */
220
+ getTopEngagedUsers(filter?: DateRangeFilter, limit?: number): Promise<Array<{
221
+ userId: string;
222
+ score: number;
223
+ level: string;
224
+ }>>;
225
+ /**
226
+ * Get engagement by feature.
227
+ */
228
+ getEngagementByFeature(filter?: DateRangeFilter): Promise<Array<{
229
+ featureId: string;
230
+ avgDwellTime: number;
231
+ uniqueUsers: number;
232
+ }>>;
233
+ }
@@ -0,0 +1,351 @@
1
+ /**
2
+ * @fileoverview Enterprise - Product Usage Forecasting
3
+ * @module features/enterprise/forecasting
4
+ *
5
+ * @description
6
+ * Predict usage, adoption, and revenue trends using historical data
7
+ * and machine learning models.
8
+ *
9
+ * @useCases
10
+ * - Project active user growth
11
+ * - Forecast feature adoption
12
+ * - Predict churn and revenue
13
+ * - Capacity planning
14
+ * - Trend analysis
15
+ *
16
+ * @metrics
17
+ * - Predicted DAU/MAU
18
+ * - Feature adoption forecast
19
+ * - Revenue projection
20
+ * - Churn prediction
21
+ * - Forecast accuracy
22
+ *
23
+ * @chartData
24
+ * - Line chart: Forecast with confidence
25
+ * - Area chart: Prediction range
26
+ * - Comparison: Predicted vs actual
27
+ * - Table: Forecast metrics
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const forecasting = new Forecasting(webId, endpoint, apiKey);
32
+ *
33
+ * // Get user growth forecast
34
+ * const forecast = await forecasting.forecastActiveUsers({
35
+ * metric: 'dau',
36
+ * periods: 30,
37
+ * granularity: 'day'
38
+ * });
39
+ * ```
40
+ */
41
+ import { EnterpriseFTRPC } from "../../client/enterprise-ftrpc";
42
+ import { DateRangeFilter, TimeGranularity, MoneyValue, CurrencyCode } from "../../types";
43
+ /**
44
+ * Forecast model types.
45
+ */
46
+ export type ForecastModel = 'linear' | 'exponential' | 'arima' | 'prophet' | 'ensemble';
47
+ /**
48
+ * Metric types for forecasting.
49
+ */
50
+ export type ForecastMetric = 'dau' | 'wau' | 'mau' | 'signups' | 'revenue' | 'mrr' | 'churn_rate' | 'feature_usage' | 'sessions' | 'events' | 'custom';
51
+ /**
52
+ * Base forecast configuration.
53
+ */
54
+ export interface ForecastConfig {
55
+ /** Metric to forecast */
56
+ metric: ForecastMetric;
57
+ /** Number of periods to forecast */
58
+ periods: number;
59
+ /** Time granularity */
60
+ granularity: TimeGranularity;
61
+ /** Historical data range to use */
62
+ historicalRange?: DateRangeFilter;
63
+ /** Forecast model to use */
64
+ model?: ForecastModel;
65
+ /** Include confidence intervals */
66
+ includeConfidence?: boolean;
67
+ /** Confidence level (0-1, default 0.95) */
68
+ confidenceLevel?: number;
69
+ /** Custom metric name (if metric is 'custom') */
70
+ customMetricName?: string;
71
+ }
72
+ /**
73
+ * Forecast data point.
74
+ */
75
+ export interface ForecastDataPoint {
76
+ /** Period/date */
77
+ period: string;
78
+ /** Predicted value */
79
+ predicted: number;
80
+ /** Lower bound (if confidence included) */
81
+ lower?: number;
82
+ /** Upper bound (if confidence included) */
83
+ upper?: number;
84
+ /** Actual value (if historical/backtested) */
85
+ actual?: number;
86
+ }
87
+ /**
88
+ * Forecast result.
89
+ */
90
+ export interface ForecastResult {
91
+ /** Metric being forecasted */
92
+ metric: ForecastMetric;
93
+ /** Model used */
94
+ model: ForecastModel;
95
+ /** Granularity */
96
+ granularity: TimeGranularity;
97
+ /** Forecast data points */
98
+ forecast: ForecastDataPoint[];
99
+ /** Summary statistics */
100
+ summary: {
101
+ startValue: number;
102
+ endValue: number;
103
+ totalChange: number;
104
+ changePercent: number;
105
+ trend: 'growing' | 'stable' | 'declining';
106
+ avgGrowthRate: number;
107
+ };
108
+ /** Model accuracy (based on backtesting) */
109
+ accuracy: {
110
+ mape: number;
111
+ rmse: number;
112
+ r2: number;
113
+ };
114
+ /** Generated at */
115
+ generatedAt: string;
116
+ }
117
+ /**
118
+ * Revenue forecast configuration.
119
+ */
120
+ export interface RevenueForecastConfig extends Omit<ForecastConfig, 'metric'> {
121
+ /** Currency */
122
+ currency?: CurrencyCode;
123
+ /** Include MRR components */
124
+ includeMRRComponents?: boolean;
125
+ }
126
+ /**
127
+ * Revenue forecast result.
128
+ */
129
+ export interface RevenueForecastResult extends ForecastResult {
130
+ /** Currency */
131
+ currency: CurrencyCode;
132
+ /** MRR components (if included) */
133
+ mrrComponents?: {
134
+ newBusiness: ForecastDataPoint[];
135
+ expansion: ForecastDataPoint[];
136
+ contraction: ForecastDataPoint[];
137
+ churn: ForecastDataPoint[];
138
+ };
139
+ }
140
+ /**
141
+ * Feature adoption forecast configuration.
142
+ */
143
+ export interface FeatureAdoptionForecastConfig extends Omit<ForecastConfig, 'metric'> {
144
+ /** Feature ID */
145
+ featureId: string;
146
+ /** Adoption metric */
147
+ adoptionMetric?: 'users' | 'usage_count' | 'adoption_rate';
148
+ }
149
+ /**
150
+ * Churn forecast configuration.
151
+ */
152
+ export interface ChurnForecastConfig extends Omit<ForecastConfig, 'metric'> {
153
+ /** User segment */
154
+ segment?: string;
155
+ /** Include user-level predictions */
156
+ includeUserPredictions?: boolean;
157
+ /** Top N at-risk users to include */
158
+ topAtRiskUsers?: number;
159
+ }
160
+ /**
161
+ * Churn forecast result.
162
+ */
163
+ export interface ChurnForecastResult extends ForecastResult {
164
+ /** Predicted churned user count */
165
+ predictedChurnedUsers: number;
166
+ /** Predicted revenue at risk */
167
+ revenueAtRisk?: MoneyValue;
168
+ /** Top at-risk users (if requested) */
169
+ atRiskUsers?: Array<{
170
+ userId: string;
171
+ churnProbability: number;
172
+ predictedChurnDate: string;
173
+ estimatedValue: MoneyValue;
174
+ }>;
175
+ }
176
+ /**
177
+ * Capacity planning configuration.
178
+ */
179
+ export interface CapacityPlanningConfig {
180
+ /** Metrics to include */
181
+ metrics: Array<'users' | 'sessions' | 'events' | 'api_calls' | 'storage'>;
182
+ /** Periods to forecast */
183
+ periods: number;
184
+ /** Granularity */
185
+ granularity: 'week' | 'month' | 'quarter';
186
+ /** Current capacity limits */
187
+ currentLimits?: Record<string, number>;
188
+ }
189
+ /**
190
+ * Capacity planning result.
191
+ */
192
+ export interface CapacityPlanningResult {
193
+ /** Forecasts by metric */
194
+ forecasts: Record<string, ForecastResult>;
195
+ /** Capacity alerts */
196
+ alerts: Array<{
197
+ metric: string;
198
+ currentUsage: number;
199
+ limit: number;
200
+ predictedExceedDate?: string;
201
+ recommendation: string;
202
+ }>;
203
+ /** Overall growth rate */
204
+ overallGrowthRate: number;
205
+ }
206
+ /**
207
+ * Scenario configuration.
208
+ */
209
+ export interface ScenarioConfig {
210
+ /** Base forecast configuration */
211
+ baseConfig: ForecastConfig;
212
+ /** Scenario adjustments */
213
+ scenarios: Array<{
214
+ name: string;
215
+ adjustments: {
216
+ growthMultiplier?: number;
217
+ seasonalAdjustment?: number;
218
+ oneTimeImpact?: {
219
+ period: string;
220
+ value: number;
221
+ };
222
+ };
223
+ }>;
224
+ }
225
+ /**
226
+ * Scenario comparison result.
227
+ */
228
+ export interface ScenarioComparison {
229
+ /** Base forecast */
230
+ baseline: ForecastResult;
231
+ /** Scenario forecasts */
232
+ scenarios: Array<{
233
+ name: string;
234
+ forecast: ForecastResult;
235
+ differenceFromBaseline: number;
236
+ }>;
237
+ }
238
+ /**
239
+ * Calculate MAPE (Mean Absolute Percentage Error).
240
+ */
241
+ export declare function calculateMAPE(actual: number[], predicted: number[]): number;
242
+ /**
243
+ * Calculate RMSE (Root Mean Square Error).
244
+ */
245
+ export declare function calculateRMSE(actual: number[], predicted: number[]): number;
246
+ /**
247
+ * Calculate R-squared.
248
+ */
249
+ export declare function calculateR2(actual: number[], predicted: number[]): number;
250
+ /**
251
+ * Classify trend direction.
252
+ */
253
+ export declare function classifyTrend(startValue: number, endValue: number, threshold?: number): 'growing' | 'stable' | 'declining';
254
+ /**
255
+ * Calculate average growth rate.
256
+ */
257
+ export declare function calculateAvgGrowthRate(values: number[]): number;
258
+ /**
259
+ * Apply confidence interval.
260
+ */
261
+ export declare function applyConfidenceInterval(predicted: number, stdError: number, confidenceLevel?: number): {
262
+ lower: number;
263
+ upper: number;
264
+ };
265
+ /**
266
+ * Product usage forecasting class.
267
+ */
268
+ export declare class Forecasting extends EnterpriseFTRPC {
269
+ /**
270
+ * Forecast active users.
271
+ */
272
+ forecastActiveUsers(config: ForecastConfig): Promise<ForecastResult>;
273
+ /**
274
+ * Forecast revenue.
275
+ */
276
+ forecastRevenue(config: RevenueForecastConfig): Promise<RevenueForecastResult>;
277
+ /**
278
+ * Forecast MRR.
279
+ */
280
+ forecastMRR(config: RevenueForecastConfig): Promise<RevenueForecastResult>;
281
+ /**
282
+ * Forecast feature adoption.
283
+ */
284
+ forecastFeatureAdoption(config: FeatureAdoptionForecastConfig): Promise<ForecastResult>;
285
+ /**
286
+ * Forecast churn.
287
+ */
288
+ forecastChurn(config: ChurnForecastConfig): Promise<ChurnForecastResult>;
289
+ /**
290
+ * Forecast signups.
291
+ */
292
+ forecastSignups(config: ForecastConfig): Promise<ForecastResult>;
293
+ /**
294
+ * Get capacity planning forecast.
295
+ */
296
+ getCapacityPlanning(config: CapacityPlanningConfig): Promise<CapacityPlanningResult>;
297
+ /**
298
+ * Compare forecast scenarios.
299
+ */
300
+ compareScenarios(config: ScenarioConfig): Promise<ScenarioComparison>;
301
+ /**
302
+ * Forecast custom metric.
303
+ */
304
+ forecastCustomMetric(metricName: string, config: Omit<ForecastConfig, 'metric' | 'customMetricName'>): Promise<ForecastResult>;
305
+ /**
306
+ * Get forecast accuracy report.
307
+ */
308
+ getForecastAccuracy(metric: ForecastMetric, lookbackPeriods: number): Promise<{
309
+ metric: ForecastMetric;
310
+ periods: Array<{
311
+ period: string;
312
+ predicted: number;
313
+ actual: number;
314
+ error: number;
315
+ errorPercent: number;
316
+ }>;
317
+ overallAccuracy: {
318
+ mape: number;
319
+ rmse: number;
320
+ r2: number;
321
+ };
322
+ }>;
323
+ /**
324
+ * Get growth projections.
325
+ */
326
+ getGrowthProjections(periods: number, granularity: TimeGranularity): Promise<{
327
+ users: ForecastResult;
328
+ revenue: ForecastResult;
329
+ engagement: ForecastResult;
330
+ summary: {
331
+ projectedUsersEnd: number;
332
+ projectedRevenueEnd: MoneyValue;
333
+ avgMonthlyGrowth: number;
334
+ };
335
+ }>;
336
+ /**
337
+ * Get what-if analysis.
338
+ */
339
+ getWhatIfAnalysis(baseMetric: ForecastMetric, adjustments: Array<{
340
+ factor: string;
341
+ change: number;
342
+ }>, periods: number): Promise<{
343
+ baseline: ForecastResult;
344
+ adjusted: ForecastResult;
345
+ impact: {
346
+ absoluteDiff: number;
347
+ percentDiff: number;
348
+ sensitivityScore: number;
349
+ };
350
+ }>;
351
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Enterprise Features Module
3
+ * @module features/enterprise
4
+ *
5
+ * @description
6
+ * Advanced analytics features for enterprise-tier users.
7
+ * Includes engagement, cohorts, churn, monetization, funnels,
8
+ * support, acquisition, path analysis, alerts, security, and forecasting.
9
+ */
10
+ export { Engagement, type DwellTimeConfig, type SessionDepthConfig, type ContentConsumptionConfig, type UserActivityConfig, type EngagementScoreConfig, type EngagementAnalyticsFilter, type EngagementResponse, type EngagementScore, type EngagementAnalytics, calculateEngagementScore, classifyEngagementLevel, calculateSessionDepthScore } from './engagement';
11
+ export { Cohorts, type CohortOperator, type CohortRule, type CohortType, type CohortDefinition, type SegmentDefinition, type CohortAssignment, type CohortComparisonConfig, type CohortAnalyticsFilter, type CohortResponse, type CohortMember, type CohortAnalytics, type CohortComparison, evaluateCohortRules, generateCohortId } from './cohorts';
12
+ export { ChurnAnalytics, type ChurnRiskFactors, type ChurnRiskScore, type UsageDecayConfig, type UsageDecay, type NPSConfig, type ChurnEventConfig, type PreventionActionConfig, type AtRiskUsersFilter, type ChurnAnalyticsResult, calculateChurnRiskScore, classifyRiskLevel, generateRecommendations } from './churn';
13
+ export { Monetization, type RevenueType, type RevenueTrackConfig, type ARPUConfig, type ARPUResult, type CohortRevenueConfig, type CohortRevenueResult, type PlanAnalysisConfig, type PlanAnalysis, type RevenueBreakdownConfig, type RevenueBreakdown, type NRRConfig, type NRRResult, type RevenueForecastConfig, type RevenueForecast, type MonetizationAnalytics, calculateARPU, calculateNRR, calculateGRR, monthlyToAnnual, calculateLTV } from './monetization';
14
+ export { MultiPathFunnels, type FunnelPath, type MultiPathFunnelDefinition, type MicroConversionDefinition, type MultiPathStepConfig, type MicroConversionConfig, type FunnelAnalysisConfig, type PathAnalysis, type MicroConversionAnalysis, type MultiPathFunnelAnalysis, type SegmentDropOffAnalysis, type UserJourneyConfig, type UserJourney, calculateConversionRate, calculateDropOffRate, findBestPath, calculateMicroConversionScore, generatePathId } from './multi-path-funnels';
15
+ export { SupportAnalytics, type TicketPriority, type TicketStatus, type SupportChannel, type TicketConfig, type TicketUpdateConfig, type CSATConfig, type FeatureComplaintConfig, type SupportAnalyticsFilter, type TicketAnalytics, type SupportImpactAnalysis, type FeatureComplaintSummary, type AgentPerformance, calculateFCRRate, calculateAvgResponseTime, classifyCSAT, formatDuration } from './support';
16
+ export { AcquisitionAnalytics, type AcquisitionSource, type LifecycleStage, type AcquisitionConfig, type CampaignDefinition, type CampaignSpendConfig, type LifecycleTransitionConfig, type CACConfig, type CACResult, type TrialFunnelConfig, type TrialFunnelResult, type CampaignPerformance, type AttributionModel, type AttributionAnalysisConfig, type AttributionResult, type AcquisitionAnalytics as AcquisitionAnalyticsType, calculateCAC, calculateROAS, calculateLTVCACRatio, parseUTMParams, classifySource } from './acquisition';
17
+ export { PathAnalytics, type TransitionConfig, type FeatureSequenceConfig, type PathDefinition, type PathAnalysisConfig, type PathResult, type DeadEndScreen, type TransitionMatrix, type UserJourneyConfig as PathUserJourneyConfig, type UserJourney as PathUserJourney, type FrictionPoint, type PathComparison, pathToString, stringToPath, calculateExitRate, isDeadEnd, calculatePathSimilarity, findCommonSubPaths } from './paths';
18
+ export { AlertsAnalytics, type AlertCondition, type AlertSeverity, type AlertStatus, type NotificationChannel, type AlertRuleDefinition, type AlertInstance, type AnomalyDetectionConfig, type Anomaly, type NotificationConfig, type AlertAnalyticsFilter, type AlertAnalytics, calculateStdDev, calculateZScore, isAnomaly, calculateAnomalyScore, classifySeverity, checkAlertCondition } from './alerts';
19
+ export { SecurityAnalytics, type SecurityEventType, type ComplianceEventType, type LoginAttemptConfig, type RoleChangeConfig, type PermissionChangeConfig, type DataAccessConfig, type ComplianceEventConfig, type AuditLogEntry, type SecurityAnalyticsFilter, type SecurityRiskAssessment, type SecurityAnalytics as SecurityAnalyticsType, type ComplianceReport, classifyRiskLevel as classifySecurityRiskLevel, calculateFailedLoginRate, isSuspiciousLoginPattern, determineEventSeverity } from './security';
20
+ export { Forecasting, type ForecastModel, type ForecastMetric, type ForecastConfig, type ForecastDataPoint, type ForecastResult, type RevenueForecastConfig as ForecastingRevenueForecastConfig, type RevenueForecastResult, type FeatureAdoptionForecastConfig, type ChurnForecastConfig, type ChurnForecastResult, type CapacityPlanningConfig, type CapacityPlanningResult, type ScenarioConfig, type ScenarioComparison, calculateMAPE, calculateRMSE, calculateR2, classifyTrend, calculateAvgGrowthRate, applyConfidenceInterval } from './forecasting';