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.
- package/LICENSE +21 -0
- package/dist/browser.d.ts +119 -0
- package/dist/flowgrid.min.js +2 -0
- package/dist/flowgrid.min.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client/enterprise-ftrpc.d.ts +51 -0
- package/dist/lib/client/ftrpc.d.ts +43 -0
- package/dist/lib/client/modules.d.ts +104 -0
- package/dist/lib/features/analytics/attribution.d.ts +257 -0
- package/dist/lib/features/analytics/events.d.ts +304 -0
- package/dist/lib/features/analytics/funnels.d.ts +291 -0
- package/dist/lib/features/analytics/heatmaps.d.ts +247 -0
- package/dist/lib/features/analytics/identify.d.ts +273 -0
- package/dist/lib/features/analytics/index.d.ts +22 -0
- package/dist/lib/features/analytics/page-views.d.ts +250 -0
- package/dist/lib/features/analytics/performance.d.ts +281 -0
- package/dist/lib/features/analytics/retention.d.ts +294 -0
- package/dist/lib/features/analytics/sessions.d.ts +277 -0
- package/dist/lib/features/core/activation.d.ts +239 -0
- package/dist/lib/features/core/experiment.d.ts +286 -0
- package/dist/lib/features/core/feature-flag.d.ts +264 -0
- package/dist/lib/features/core/index.d.ts +14 -0
- package/dist/lib/features/core/track-feature.d.ts +220 -0
- package/dist/lib/features/core/track-prompt.d.ts +247 -0
- package/dist/lib/features/ecommerce/cart.d.ts +298 -0
- package/dist/lib/features/ecommerce/checkout.d.ts +324 -0
- package/dist/lib/features/ecommerce/index.d.ts +26 -0
- package/dist/lib/features/ecommerce/inventory.d.ts +221 -0
- package/dist/lib/features/ecommerce/ltv.d.ts +258 -0
- package/dist/lib/features/ecommerce/products.d.ts +268 -0
- package/dist/lib/features/ecommerce/promotions.d.ts +266 -0
- package/dist/lib/features/ecommerce/purchases.d.ts +287 -0
- package/dist/lib/features/ecommerce/refunds.d.ts +232 -0
- package/dist/lib/features/ecommerce/search.d.ts +225 -0
- package/dist/lib/features/ecommerce/subscriptions.d.ts +281 -0
- package/dist/lib/features/ecommerce/wishlist.d.ts +236 -0
- package/dist/lib/features/enterprise/acquisition.d.ts +373 -0
- package/dist/lib/features/enterprise/alerts.d.ts +348 -0
- package/dist/lib/features/enterprise/churn.d.ts +288 -0
- package/dist/lib/features/enterprise/cohorts.d.ts +270 -0
- package/dist/lib/features/enterprise/engagement.d.ts +233 -0
- package/dist/lib/features/enterprise/forecasting.d.ts +351 -0
- package/dist/lib/features/enterprise/index.d.ts +20 -0
- package/dist/lib/features/enterprise/monetization.d.ts +356 -0
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +327 -0
- package/dist/lib/features/enterprise/paths.d.ts +332 -0
- package/dist/lib/features/enterprise/security.d.ts +387 -0
- package/dist/lib/features/enterprise/support.d.ts +329 -0
- package/dist/lib/frameworks/index.d.ts +9 -0
- package/dist/lib/frameworks/nextjs/client.d.ts +208 -0
- package/dist/lib/frameworks/nextjs/index.d.ts +29 -0
- package/dist/lib/frameworks/nextjs/server.d.ts +201 -0
- package/dist/lib/frameworks/node/index.d.ts +265 -0
- package/dist/lib/frameworks/nuxt/index.d.ts +190 -0
- package/dist/lib/frameworks/react/index.d.ts +245 -0
- package/dist/lib/frameworks/vue/index.d.ts +275 -0
- package/dist/lib/types/analytics.d.ts +365 -0
- package/dist/lib/types/common.d.ts +230 -0
- package/dist/lib/types/ecommerce.d.ts +309 -0
- package/dist/lib/types/index.d.ts +7 -0
- package/dist/lib/utils/functions.d.ts +1 -0
- package/package.json +139 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Core - Feature Flags
|
|
3
|
+
* @module features/core/feature-flag
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track feature flag evaluations and usage to understand
|
|
7
|
+
* rollout progress and flag performance.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track flag evaluations
|
|
11
|
+
* - Monitor rollout progress
|
|
12
|
+
* - Analyze flag impact
|
|
13
|
+
* - Debug flag configurations
|
|
14
|
+
* - Measure gradual rollouts
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Evaluations per flag
|
|
18
|
+
* - Unique users per variant
|
|
19
|
+
* - Rollout percentage
|
|
20
|
+
* - Error rate
|
|
21
|
+
* - Flag age
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Pie chart: Users by variant
|
|
25
|
+
* - Line chart: Evaluations over time
|
|
26
|
+
* - Table: Active flags summary
|
|
27
|
+
* - Bar chart: Top evaluated flags
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const featureFlag = new FeatureFlag(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* await featureFlag.evaluate({
|
|
34
|
+
* eventName: 'new_dashboard',
|
|
35
|
+
* properties: { userId: 'user_123', result: true }
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
40
|
+
import { DateRangeFilter, TimeSeriesData } from "../../types";
|
|
41
|
+
/**
|
|
42
|
+
* Base feature flag configuration.
|
|
43
|
+
*/
|
|
44
|
+
export interface FlagConfig {
|
|
45
|
+
/** Flag name/event */
|
|
46
|
+
eventName: string;
|
|
47
|
+
/** Evaluation properties */
|
|
48
|
+
properties: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Feature flag definition.
|
|
52
|
+
*/
|
|
53
|
+
export interface FlagDefinition {
|
|
54
|
+
/** Flag key */
|
|
55
|
+
flagKey: string;
|
|
56
|
+
/** Flag name */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Description */
|
|
59
|
+
description?: string;
|
|
60
|
+
/** Flag type */
|
|
61
|
+
type: 'boolean' | 'string' | 'number' | 'json';
|
|
62
|
+
/** Default value */
|
|
63
|
+
defaultValue: boolean | string | number | Record<string, unknown>;
|
|
64
|
+
/** Variants (for multivariate flags) */
|
|
65
|
+
variants?: Array<{
|
|
66
|
+
key: string;
|
|
67
|
+
value: boolean | string | number | Record<string, unknown>;
|
|
68
|
+
weight?: number;
|
|
69
|
+
}>;
|
|
70
|
+
/** Targeting rules */
|
|
71
|
+
targeting?: {
|
|
72
|
+
rules: Array<{
|
|
73
|
+
attribute: string;
|
|
74
|
+
operator: 'equals' | 'contains' | 'in' | 'gt' | 'lt';
|
|
75
|
+
value: unknown;
|
|
76
|
+
variant: string;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
/** Rollout percentage (0-100) */
|
|
80
|
+
rolloutPercentage?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Flag evaluation configuration.
|
|
84
|
+
*/
|
|
85
|
+
export interface FlagEvaluationConfig {
|
|
86
|
+
/** Flag key */
|
|
87
|
+
flagKey: string;
|
|
88
|
+
/** User ID */
|
|
89
|
+
userId?: string;
|
|
90
|
+
/** Evaluation context */
|
|
91
|
+
context?: Record<string, unknown>;
|
|
92
|
+
/** Evaluated variant/value */
|
|
93
|
+
result: boolean | string | number | Record<string, unknown>;
|
|
94
|
+
/** Reason for evaluation result */
|
|
95
|
+
reason?: 'default' | 'targeting' | 'rollout' | 'override' | 'error';
|
|
96
|
+
/** Evaluation duration (ms) */
|
|
97
|
+
duration?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Feature flag response.
|
|
101
|
+
*/
|
|
102
|
+
export interface FlagResponse {
|
|
103
|
+
eventName: string;
|
|
104
|
+
properties: Record<string, unknown>;
|
|
105
|
+
response: {
|
|
106
|
+
tracked: boolean;
|
|
107
|
+
flagKey?: string;
|
|
108
|
+
};
|
|
109
|
+
timestamp: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Single flag analytics.
|
|
113
|
+
*/
|
|
114
|
+
export interface FlagAnalyticsData {
|
|
115
|
+
/** Flag info */
|
|
116
|
+
flag: {
|
|
117
|
+
flagKey: string;
|
|
118
|
+
name: string;
|
|
119
|
+
type: string;
|
|
120
|
+
status: 'active' | 'inactive' | 'archived';
|
|
121
|
+
createdAt: string;
|
|
122
|
+
lastModified: string;
|
|
123
|
+
};
|
|
124
|
+
/** Evaluation stats */
|
|
125
|
+
evaluations: {
|
|
126
|
+
total: number;
|
|
127
|
+
uniqueUsers: number;
|
|
128
|
+
avgDuration: number;
|
|
129
|
+
errorRate: number;
|
|
130
|
+
};
|
|
131
|
+
/** Results by variant */
|
|
132
|
+
byVariant: Array<{
|
|
133
|
+
variant: string;
|
|
134
|
+
evaluations: number;
|
|
135
|
+
uniqueUsers: number;
|
|
136
|
+
percentage: number;
|
|
137
|
+
}>;
|
|
138
|
+
/** Results by reason */
|
|
139
|
+
byReason: Record<string, number>;
|
|
140
|
+
/** Trends */
|
|
141
|
+
trends: TimeSeriesData;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* All flags analytics.
|
|
145
|
+
*/
|
|
146
|
+
export interface AllFlagsAnalyticsData {
|
|
147
|
+
/** Summary */
|
|
148
|
+
summary: {
|
|
149
|
+
totalFlags: number;
|
|
150
|
+
activeFlags: number;
|
|
151
|
+
totalEvaluations: number;
|
|
152
|
+
uniqueUsers: number;
|
|
153
|
+
avgEvaluationsPerUser: number;
|
|
154
|
+
};
|
|
155
|
+
/** Top flags by evaluations */
|
|
156
|
+
topFlags: Array<{
|
|
157
|
+
flagKey: string;
|
|
158
|
+
name: string;
|
|
159
|
+
evaluations: number;
|
|
160
|
+
uniqueUsers: number;
|
|
161
|
+
rolloutPercentage: number;
|
|
162
|
+
}>;
|
|
163
|
+
/** Stale flags (not evaluated recently) */
|
|
164
|
+
staleFlags: Array<{
|
|
165
|
+
flagKey: string;
|
|
166
|
+
name: string;
|
|
167
|
+
lastEvaluated: string;
|
|
168
|
+
daysSinceEvaluation: number;
|
|
169
|
+
}>;
|
|
170
|
+
/** Flags by status */
|
|
171
|
+
byStatus: {
|
|
172
|
+
active: number;
|
|
173
|
+
inactive: number;
|
|
174
|
+
archived: number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* FeatureFlag - Track feature flag evaluations.
|
|
179
|
+
*
|
|
180
|
+
* @extends FTRPC
|
|
181
|
+
*
|
|
182
|
+
* @description
|
|
183
|
+
* Provides feature flag tracking including:
|
|
184
|
+
* - Flag evaluations
|
|
185
|
+
* - Rollout monitoring
|
|
186
|
+
* - Flag definitions
|
|
187
|
+
* - Usage analytics
|
|
188
|
+
* - Stale flag detection
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const featureFlag = new FeatureFlag(webId, endpoint, apiKey);
|
|
193
|
+
*
|
|
194
|
+
* // Track evaluation
|
|
195
|
+
* await featureFlag.trackEvaluation({
|
|
196
|
+
* flagKey: 'new_checkout',
|
|
197
|
+
* userId: 'user_123',
|
|
198
|
+
* result: true,
|
|
199
|
+
* reason: 'rollout'
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* // Get flag analytics
|
|
203
|
+
* const analytics = await featureFlag.getFlagAnalytics('new_checkout');
|
|
204
|
+
* console.log(`${analytics.evaluations.total} evaluations`);
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare class FeatureFlag extends FTRPC {
|
|
208
|
+
/**
|
|
209
|
+
* Evaluates and tracks a feature flag.
|
|
210
|
+
*
|
|
211
|
+
* @param config - Flag configuration
|
|
212
|
+
* @returns Promise resolving to flag response
|
|
213
|
+
*/
|
|
214
|
+
evaluate(config: FlagConfig): Promise<FlagResponse>;
|
|
215
|
+
/**
|
|
216
|
+
* Tracks a flag evaluation with details.
|
|
217
|
+
*
|
|
218
|
+
* @param config - Flag evaluation configuration
|
|
219
|
+
* @returns Promise resolving to flag response
|
|
220
|
+
*/
|
|
221
|
+
trackEvaluation(config: FlagEvaluationConfig): Promise<FlagResponse>;
|
|
222
|
+
/**
|
|
223
|
+
* Defines/updates a feature flag.
|
|
224
|
+
*
|
|
225
|
+
* @param definition - Flag definition
|
|
226
|
+
* @returns Promise resolving to flag response
|
|
227
|
+
*/
|
|
228
|
+
define(definition: FlagDefinition): Promise<FlagResponse>;
|
|
229
|
+
/**
|
|
230
|
+
* Tracks flag status change (enable/disable).
|
|
231
|
+
*
|
|
232
|
+
* @param flagKey - Flag key
|
|
233
|
+
* @param enabled - Whether flag is enabled
|
|
234
|
+
* @param changedBy - User who made the change
|
|
235
|
+
* @returns Promise resolving to flag response
|
|
236
|
+
*/
|
|
237
|
+
trackStatusChange(flagKey: string, enabled: boolean, changedBy?: string): Promise<FlagResponse>;
|
|
238
|
+
/**
|
|
239
|
+
* Tracks rollout percentage change.
|
|
240
|
+
*
|
|
241
|
+
* @param flagKey - Flag key
|
|
242
|
+
* @param previousPercentage - Previous rollout %
|
|
243
|
+
* @param newPercentage - New rollout %
|
|
244
|
+
* @param changedBy - User who made the change
|
|
245
|
+
* @returns Promise resolving to flag response
|
|
246
|
+
*/
|
|
247
|
+
trackRolloutChange(flagKey: string, previousPercentage: number, newPercentage: number, changedBy?: string): Promise<FlagResponse>;
|
|
248
|
+
/**
|
|
249
|
+
* Gets analytics for a specific flag.
|
|
250
|
+
*
|
|
251
|
+
* @param flagKey - Flag key
|
|
252
|
+
* @param filter - Date range filter
|
|
253
|
+
* @returns Promise resolving to flag analytics
|
|
254
|
+
*/
|
|
255
|
+
getFlagAnalytics(flagKey: string, filter?: DateRangeFilter): Promise<FlagAnalyticsData>;
|
|
256
|
+
/**
|
|
257
|
+
* Gets analytics for all flags.
|
|
258
|
+
*
|
|
259
|
+
* @param filter - Date range filter
|
|
260
|
+
* @returns Promise resolving to all flags analytics
|
|
261
|
+
*/
|
|
262
|
+
getAnalytics(filter?: DateRangeFilter): Promise<AllFlagsAnalyticsData>;
|
|
263
|
+
}
|
|
264
|
+
export default FeatureFlag;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Core features barrel export
|
|
3
|
+
* @module features/core
|
|
4
|
+
*/
|
|
5
|
+
export { Activation } from './activation';
|
|
6
|
+
export { TrackFeature } from './track-feature';
|
|
7
|
+
export { TrackPrompt } from './track-prompt';
|
|
8
|
+
export { Experiment } from './experiment';
|
|
9
|
+
export { FeatureFlag } from './feature-flag';
|
|
10
|
+
export type { ActivationConfig, OnboardingStepConfig, FirstActionConfig, ActivationResponse, ActivationAnalyticsData } from './activation';
|
|
11
|
+
export type { FeatureConfig, FeatureUsageConfig, FeatureDiscoveryConfig, FeatureResponse, FeatureAnalyticsData } from './track-feature';
|
|
12
|
+
export type { PromptConfig, PromptSubmissionConfig, PromptResponseConfig, PromptFeedbackConfig, PromptResponse, PromptAnalyticsData } from './track-prompt';
|
|
13
|
+
export type { ExperimentConfig, ExperimentDefinition, ExperimentAssignmentConfig, ExperimentConversionConfig, ExperimentResponse, ExperimentResultsData, ExperimentAnalyticsData } from './experiment';
|
|
14
|
+
export type { FlagConfig, FlagDefinition, FlagEvaluationConfig, FlagResponse, FlagAnalyticsData, AllFlagsAnalyticsData } from './feature-flag';
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Core - Feature Usage Tracking
|
|
3
|
+
* @module features/core/track-feature
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track feature usage events to understand how users
|
|
7
|
+
* interact with different parts of your product.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track feature adoption rates
|
|
11
|
+
* - Measure feature engagement
|
|
12
|
+
* - Identify power users
|
|
13
|
+
* - Prioritize feature development
|
|
14
|
+
* - Detect underused features
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Feature adoption rate
|
|
18
|
+
* - Feature usage frequency
|
|
19
|
+
* - Users per feature
|
|
20
|
+
* - Feature stickiness
|
|
21
|
+
* - Time spent per feature
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Most used features
|
|
25
|
+
* - Heatmap: Feature usage by user segment
|
|
26
|
+
* - Line chart: Feature adoption over time
|
|
27
|
+
* - Table: Feature engagement metrics
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const trackFeature = new TrackFeature(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* await trackFeature.create({
|
|
34
|
+
* eventName: 'export_report',
|
|
35
|
+
* properties: { format: 'csv', rowCount: 1000 }
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
40
|
+
import { DateRangeFilter, TimeSeriesData } from "../../types";
|
|
41
|
+
/**
|
|
42
|
+
* Base configuration for feature tracking.
|
|
43
|
+
*/
|
|
44
|
+
export interface FeatureConfig {
|
|
45
|
+
/** Event/feature name */
|
|
46
|
+
eventName: string;
|
|
47
|
+
/** Event properties */
|
|
48
|
+
properties: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Detailed feature usage configuration.
|
|
52
|
+
*/
|
|
53
|
+
export interface FeatureUsageConfig {
|
|
54
|
+
/** Feature identifier */
|
|
55
|
+
featureId: string;
|
|
56
|
+
/** Feature name */
|
|
57
|
+
featureName: string;
|
|
58
|
+
/** User ID */
|
|
59
|
+
userId?: string;
|
|
60
|
+
/** Usage action */
|
|
61
|
+
action: 'viewed' | 'used' | 'completed' | 'abandoned';
|
|
62
|
+
/** Time spent (ms) */
|
|
63
|
+
duration?: number;
|
|
64
|
+
/** Success/failure */
|
|
65
|
+
success?: boolean;
|
|
66
|
+
/** Feature category */
|
|
67
|
+
category?: string;
|
|
68
|
+
/** Custom properties */
|
|
69
|
+
properties?: Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Feature discovery configuration.
|
|
73
|
+
*/
|
|
74
|
+
export interface FeatureDiscoveryConfig {
|
|
75
|
+
/** Feature identifier */
|
|
76
|
+
featureId: string;
|
|
77
|
+
/** User ID */
|
|
78
|
+
userId: string;
|
|
79
|
+
/** How feature was discovered */
|
|
80
|
+
discoveryMethod: 'organic' | 'tooltip' | 'announcement' | 'search' | 'onboarding' | 'recommendation';
|
|
81
|
+
/** Whether user engaged with feature */
|
|
82
|
+
engaged: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Feature tracking response.
|
|
86
|
+
*/
|
|
87
|
+
export interface FeatureResponse {
|
|
88
|
+
eventName: string;
|
|
89
|
+
properties: Record<string, unknown>;
|
|
90
|
+
response: {
|
|
91
|
+
tracked: boolean;
|
|
92
|
+
featureId?: string;
|
|
93
|
+
isFirstUse?: boolean;
|
|
94
|
+
};
|
|
95
|
+
timestamp: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Feature analytics data.
|
|
99
|
+
*/
|
|
100
|
+
export interface FeatureAnalyticsData {
|
|
101
|
+
/** Summary metrics */
|
|
102
|
+
summary: {
|
|
103
|
+
totalFeatures: number;
|
|
104
|
+
totalUsage: number;
|
|
105
|
+
uniqueUsers: number;
|
|
106
|
+
avgUsagePerUser: number;
|
|
107
|
+
mostUsedFeature: string;
|
|
108
|
+
leastUsedFeature: string;
|
|
109
|
+
};
|
|
110
|
+
/** Usage by feature */
|
|
111
|
+
byFeature: Array<{
|
|
112
|
+
featureId: string;
|
|
113
|
+
featureName: string;
|
|
114
|
+
category: string;
|
|
115
|
+
usageCount: number;
|
|
116
|
+
uniqueUsers: number;
|
|
117
|
+
adoptionRate: number;
|
|
118
|
+
avgDuration: number;
|
|
119
|
+
successRate: number;
|
|
120
|
+
}>;
|
|
121
|
+
/** Usage by user segment */
|
|
122
|
+
bySegment: Array<{
|
|
123
|
+
segment: string;
|
|
124
|
+
topFeatures: string[];
|
|
125
|
+
avgFeaturesUsed: number;
|
|
126
|
+
}>;
|
|
127
|
+
/** Feature trends */
|
|
128
|
+
trends: TimeSeriesData;
|
|
129
|
+
/** Feature correlations */
|
|
130
|
+
correlations: Array<{
|
|
131
|
+
featureA: string;
|
|
132
|
+
featureB: string;
|
|
133
|
+
correlation: number;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* TrackFeature - Track feature usage events.
|
|
138
|
+
*
|
|
139
|
+
* @extends FTRPC
|
|
140
|
+
*
|
|
141
|
+
* @description
|
|
142
|
+
* Provides feature tracking including:
|
|
143
|
+
* - Generic feature events
|
|
144
|
+
* - Detailed usage tracking
|
|
145
|
+
* - Feature discovery tracking
|
|
146
|
+
* - Adoption analytics
|
|
147
|
+
* - Engagement metrics
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const trackFeature = new TrackFeature(webId, endpoint, apiKey);
|
|
152
|
+
*
|
|
153
|
+
* // Simple feature tracking
|
|
154
|
+
* await trackFeature.create({
|
|
155
|
+
* eventName: 'dark_mode_enabled',
|
|
156
|
+
* properties: { userId: 'user_123' }
|
|
157
|
+
* });
|
|
158
|
+
*
|
|
159
|
+
* // Detailed feature usage
|
|
160
|
+
* await trackFeature.trackUsage({
|
|
161
|
+
* featureId: 'export',
|
|
162
|
+
* featureName: 'Data Export',
|
|
163
|
+
* userId: 'user_123',
|
|
164
|
+
* action: 'completed',
|
|
165
|
+
* duration: 5000,
|
|
166
|
+
* success: true,
|
|
167
|
+
* properties: { format: 'csv' }
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare class TrackFeature extends FTRPC {
|
|
172
|
+
/**
|
|
173
|
+
* Records a feature usage event.
|
|
174
|
+
*
|
|
175
|
+
* @param config - Feature configuration
|
|
176
|
+
* @returns Promise resolving to feature response
|
|
177
|
+
*/
|
|
178
|
+
create(config: FeatureConfig): Promise<FeatureResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* Tracks detailed feature usage.
|
|
181
|
+
*
|
|
182
|
+
* @param config - Feature usage configuration
|
|
183
|
+
* @returns Promise resolving to feature response
|
|
184
|
+
*/
|
|
185
|
+
trackUsage(config: FeatureUsageConfig): Promise<FeatureResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* Tracks feature discovery.
|
|
188
|
+
*
|
|
189
|
+
* @param config - Feature discovery configuration
|
|
190
|
+
* @returns Promise resolving to feature response
|
|
191
|
+
*/
|
|
192
|
+
trackDiscovery(config: FeatureDiscoveryConfig): Promise<FeatureResponse>;
|
|
193
|
+
/**
|
|
194
|
+
* Tracks feature adoption (first-time use).
|
|
195
|
+
*
|
|
196
|
+
* @param featureId - Feature identifier
|
|
197
|
+
* @param userId - User ID
|
|
198
|
+
* @param source - How user found feature
|
|
199
|
+
* @returns Promise resolving to feature response
|
|
200
|
+
*/
|
|
201
|
+
trackAdoption(featureId: string, userId: string, source?: string): Promise<FeatureResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Tracks feature abandonment.
|
|
204
|
+
*
|
|
205
|
+
* @param featureId - Feature identifier
|
|
206
|
+
* @param userId - User ID
|
|
207
|
+
* @param reason - Abandonment reason
|
|
208
|
+
* @param timeSpent - Time spent before abandoning (ms)
|
|
209
|
+
* @returns Promise resolving to feature response
|
|
210
|
+
*/
|
|
211
|
+
trackAbandonment(featureId: string, userId: string, reason?: string, timeSpent?: number): Promise<FeatureResponse>;
|
|
212
|
+
/**
|
|
213
|
+
* Gets feature analytics for dashboards.
|
|
214
|
+
*
|
|
215
|
+
* @param filter - Date range filter
|
|
216
|
+
* @returns Promise resolving to feature analytics
|
|
217
|
+
*/
|
|
218
|
+
getAnalytics(filter?: DateRangeFilter): Promise<FeatureAnalyticsData>;
|
|
219
|
+
}
|
|
220
|
+
export default TrackFeature;
|