flowgrid-sdk 1.1.0 → 1.2.1

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 (65) hide show
  1. package/README.md +320 -8
  2. package/dist/browser.d.ts +6 -7
  3. package/dist/flowgrid.min.js +1 -1
  4. package/dist/flowgrid.min.js.map +1 -1
  5. package/dist/index.d.ts +11 -4
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/client/transport.d.ts +175 -0
  9. package/dist/lib/consent/index.d.ts +37 -0
  10. package/dist/lib/consent/manager.d.ts +197 -0
  11. package/dist/lib/consent/types.d.ts +162 -0
  12. package/dist/lib/features/analytics/attribution.d.ts +3 -3
  13. package/dist/lib/features/analytics/events.d.ts +3 -3
  14. package/dist/lib/features/analytics/funnels.d.ts +3 -3
  15. package/dist/lib/features/analytics/heatmaps.d.ts +9 -3
  16. package/dist/lib/features/analytics/identify.d.ts +3 -3
  17. package/dist/lib/features/analytics/page-views.d.ts +3 -3
  18. package/dist/lib/features/analytics/performance.d.ts +3 -3
  19. package/dist/lib/features/analytics/retention.d.ts +3 -3
  20. package/dist/lib/features/analytics/sessions.d.ts +3 -3
  21. package/dist/lib/features/core/activation.d.ts +3 -3
  22. package/dist/lib/features/core/experiment.d.ts +86 -70
  23. package/dist/lib/features/core/index.d.ts +1 -3
  24. package/dist/lib/features/core/track-feature.d.ts +3 -3
  25. package/dist/lib/features/core/track-prompt.d.ts +3 -3
  26. package/dist/lib/features/ecommerce/cart.d.ts +3 -3
  27. package/dist/lib/features/ecommerce/checkout.d.ts +3 -3
  28. package/dist/lib/features/ecommerce/inventory.d.ts +3 -3
  29. package/dist/lib/features/ecommerce/ltv.d.ts +3 -3
  30. package/dist/lib/features/ecommerce/products.d.ts +3 -3
  31. package/dist/lib/features/ecommerce/promotions.d.ts +3 -3
  32. package/dist/lib/features/ecommerce/purchases.d.ts +3 -3
  33. package/dist/lib/features/ecommerce/refunds.d.ts +3 -3
  34. package/dist/lib/features/ecommerce/search.d.ts +3 -3
  35. package/dist/lib/features/ecommerce/subscriptions.d.ts +3 -3
  36. package/dist/lib/features/ecommerce/wishlist.d.ts +3 -3
  37. package/dist/lib/features/enterprise/acquisition.d.ts +2 -2
  38. package/dist/lib/features/enterprise/alerts.d.ts +2 -2
  39. package/dist/lib/features/enterprise/churn.d.ts +2 -2
  40. package/dist/lib/features/enterprise/cohorts.d.ts +2 -2
  41. package/dist/lib/features/enterprise/engagement.d.ts +24 -3
  42. package/dist/lib/features/enterprise/forecasting.d.ts +2 -2
  43. package/dist/lib/features/enterprise/monetization.d.ts +2 -2
  44. package/dist/lib/features/enterprise/multi-path-funnels.d.ts +2 -2
  45. package/dist/lib/features/enterprise/paths.d.ts +2 -2
  46. package/dist/lib/features/enterprise/security.d.ts +2 -2
  47. package/dist/lib/features/enterprise/support.d.ts +2 -2
  48. package/dist/lib/frameworks/nextjs/client.d.ts +7 -13
  49. package/dist/lib/frameworks/nextjs/server.d.ts +5 -15
  50. package/dist/lib/frameworks/node/index.d.ts +2 -6
  51. package/dist/lib/frameworks/nuxt/index.d.ts +7 -3
  52. package/dist/lib/frameworks/react/CookieBanner.d.ts +91 -0
  53. package/dist/lib/frameworks/react/index.d.ts +98 -136
  54. package/dist/lib/frameworks/vue/CookieBanner.d.ts +82 -0
  55. package/dist/lib/frameworks/vue/index.d.ts +30 -27
  56. package/dist/lib/types/analytics.d.ts +62 -0
  57. package/dist/lib/types/common.d.ts +2 -0
  58. package/dist/lib/utils/identity.d.ts +93 -0
  59. package/dist/lib/utils/storage.d.ts +69 -0
  60. package/package.json +13 -2
  61. package/dist/lib/client/enterprise-ftrpc.d.ts +0 -51
  62. package/dist/lib/client/ftrpc.d.ts +0 -132
  63. package/dist/lib/client/modules.d.ts +0 -104
  64. package/dist/lib/features/core/feature-flag.d.ts +0 -249
  65. package/dist/lib/utils/functions.d.ts +0 -1
@@ -1,249 +0,0 @@
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 { 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
- export default FeatureFlag;
@@ -1 +0,0 @@
1
- export declare function _0x7777(): string;