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.
- package/README.md +320 -8
- package/dist/browser.d.ts +6 -7
- package/dist/flowgrid.min.js +1 -1
- package/dist/flowgrid.min.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/client/transport.d.ts +175 -0
- package/dist/lib/consent/index.d.ts +37 -0
- package/dist/lib/consent/manager.d.ts +197 -0
- package/dist/lib/consent/types.d.ts +162 -0
- package/dist/lib/features/analytics/attribution.d.ts +3 -3
- package/dist/lib/features/analytics/events.d.ts +3 -3
- package/dist/lib/features/analytics/funnels.d.ts +3 -3
- package/dist/lib/features/analytics/heatmaps.d.ts +9 -3
- package/dist/lib/features/analytics/identify.d.ts +3 -3
- package/dist/lib/features/analytics/page-views.d.ts +3 -3
- package/dist/lib/features/analytics/performance.d.ts +3 -3
- package/dist/lib/features/analytics/retention.d.ts +3 -3
- package/dist/lib/features/analytics/sessions.d.ts +3 -3
- package/dist/lib/features/core/activation.d.ts +3 -3
- package/dist/lib/features/core/experiment.d.ts +86 -70
- package/dist/lib/features/core/index.d.ts +1 -3
- package/dist/lib/features/core/track-feature.d.ts +3 -3
- package/dist/lib/features/core/track-prompt.d.ts +3 -3
- package/dist/lib/features/ecommerce/cart.d.ts +3 -3
- package/dist/lib/features/ecommerce/checkout.d.ts +3 -3
- package/dist/lib/features/ecommerce/inventory.d.ts +3 -3
- package/dist/lib/features/ecommerce/ltv.d.ts +3 -3
- package/dist/lib/features/ecommerce/products.d.ts +3 -3
- package/dist/lib/features/ecommerce/promotions.d.ts +3 -3
- package/dist/lib/features/ecommerce/purchases.d.ts +3 -3
- package/dist/lib/features/ecommerce/refunds.d.ts +3 -3
- package/dist/lib/features/ecommerce/search.d.ts +3 -3
- package/dist/lib/features/ecommerce/subscriptions.d.ts +3 -3
- package/dist/lib/features/ecommerce/wishlist.d.ts +3 -3
- package/dist/lib/features/enterprise/acquisition.d.ts +2 -2
- package/dist/lib/features/enterprise/alerts.d.ts +2 -2
- package/dist/lib/features/enterprise/churn.d.ts +2 -2
- package/dist/lib/features/enterprise/cohorts.d.ts +2 -2
- package/dist/lib/features/enterprise/engagement.d.ts +24 -3
- package/dist/lib/features/enterprise/forecasting.d.ts +2 -2
- package/dist/lib/features/enterprise/monetization.d.ts +2 -2
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +2 -2
- package/dist/lib/features/enterprise/paths.d.ts +2 -2
- package/dist/lib/features/enterprise/security.d.ts +2 -2
- package/dist/lib/features/enterprise/support.d.ts +2 -2
- package/dist/lib/frameworks/nextjs/client.d.ts +7 -13
- package/dist/lib/frameworks/nextjs/server.d.ts +5 -15
- package/dist/lib/frameworks/node/index.d.ts +2 -6
- package/dist/lib/frameworks/nuxt/index.d.ts +7 -3
- package/dist/lib/frameworks/react/CookieBanner.d.ts +91 -0
- package/dist/lib/frameworks/react/index.d.ts +98 -136
- package/dist/lib/frameworks/vue/CookieBanner.d.ts +82 -0
- package/dist/lib/frameworks/vue/index.d.ts +30 -27
- package/dist/lib/types/analytics.d.ts +62 -0
- package/dist/lib/types/common.d.ts +2 -0
- package/dist/lib/utils/identity.d.ts +93 -0
- package/dist/lib/utils/storage.d.ts +69 -0
- package/package.json +13 -2
- package/dist/lib/client/enterprise-ftrpc.d.ts +0 -51
- package/dist/lib/client/ftrpc.d.ts +0 -132
- package/dist/lib/client/modules.d.ts +0 -104
- package/dist/lib/features/core/feature-flag.d.ts +0 -249
- package/dist/lib/utils/functions.d.ts +0 -1
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
import {
|
|
43
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
44
44
|
import { MoneyValue, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
45
45
|
/**
|
|
46
46
|
* Subscription start configuration.
|
|
@@ -165,7 +165,7 @@ export interface SubscriptionAnalyticsData {
|
|
|
165
165
|
/**
|
|
166
166
|
* Subscriptions - Track subscription lifecycle events.
|
|
167
167
|
*
|
|
168
|
-
* @extends
|
|
168
|
+
* @extends FlowGridTransport
|
|
169
169
|
*
|
|
170
170
|
* @description
|
|
171
171
|
* Provides subscription tracking including:
|
|
@@ -201,7 +201,7 @@ export interface SubscriptionAnalyticsData {
|
|
|
201
201
|
* });
|
|
202
202
|
* ```
|
|
203
203
|
*/
|
|
204
|
-
export declare class Subscriptions extends
|
|
204
|
+
export declare class Subscriptions extends FlowGridTransport {
|
|
205
205
|
/**
|
|
206
206
|
* Tracks subscription start.
|
|
207
207
|
*
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* });
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
import {
|
|
40
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
41
41
|
import { Product, Wishlist, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
42
42
|
/**
|
|
43
43
|
* Configuration for adding to wishlist.
|
|
@@ -112,7 +112,7 @@ export interface WishlistAnalyticsData {
|
|
|
112
112
|
/**
|
|
113
113
|
* WishlistTracking - Track wishlist interactions.
|
|
114
114
|
*
|
|
115
|
-
* @extends
|
|
115
|
+
* @extends FlowGridTransport
|
|
116
116
|
*
|
|
117
117
|
* @description
|
|
118
118
|
* Provides wishlist tracking capabilities including:
|
|
@@ -144,7 +144,7 @@ export interface WishlistAnalyticsData {
|
|
|
144
144
|
* });
|
|
145
145
|
* ```
|
|
146
146
|
*/
|
|
147
|
-
export declare class WishlistTracking extends
|
|
147
|
+
export declare class WishlistTracking extends FlowGridTransport {
|
|
148
148
|
/**
|
|
149
149
|
* Tracks adding product to wishlist.
|
|
150
150
|
*
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
42
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity, MoneyValue, CurrencyCode } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Acquisition source types.
|
|
@@ -290,7 +290,7 @@ export declare function classifySource(utmSource?: string, utmMedium?: string):
|
|
|
290
290
|
/**
|
|
291
291
|
* Marketing and acquisition analytics class.
|
|
292
292
|
*/
|
|
293
|
-
export declare class AcquisitionAnalytics extends
|
|
293
|
+
export declare class AcquisitionAnalytics extends FlowGridTransport {
|
|
294
294
|
/**
|
|
295
295
|
* Track user acquisition.
|
|
296
296
|
*/
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
import {
|
|
43
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
44
44
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
45
45
|
/**
|
|
46
46
|
* Alert condition types.
|
|
@@ -244,7 +244,7 @@ export declare function checkAlertCondition(currentValue: number, condition: Ale
|
|
|
244
244
|
/**
|
|
245
245
|
* Alerts and anomaly detection class.
|
|
246
246
|
*/
|
|
247
|
-
export declare class AlertsAnalytics extends
|
|
247
|
+
export declare class AlertsAnalytics extends FlowGridTransport {
|
|
248
248
|
/**
|
|
249
249
|
* Create an alert rule.
|
|
250
250
|
*/
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* const atRisk = await churn.getAtRiskUsers({ minScore: 70 });
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
import {
|
|
40
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
41
41
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
42
42
|
/**
|
|
43
43
|
* Churn risk factors.
|
|
@@ -214,7 +214,7 @@ export declare function generateRecommendations(riskFactors: Array<{
|
|
|
214
214
|
/**
|
|
215
215
|
* Churn and predictive analytics class.
|
|
216
216
|
*/
|
|
217
|
-
export declare class ChurnAnalytics extends
|
|
217
|
+
export declare class ChurnAnalytics extends FlowGridTransport {
|
|
218
218
|
/**
|
|
219
219
|
* Get user churn risk score.
|
|
220
220
|
*/
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
42
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Cohort rule operators.
|
|
@@ -196,7 +196,7 @@ export declare function generateCohortId(name: string): string;
|
|
|
196
196
|
/**
|
|
197
197
|
* Advanced cohorts and segmentation class.
|
|
198
198
|
*/
|
|
199
|
-
export declare class Cohorts extends
|
|
199
|
+
export declare class Cohorts extends FlowGridTransport {
|
|
200
200
|
/**
|
|
201
201
|
* Create a new cohort.
|
|
202
202
|
*/
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
42
|
-
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
|
+
import { DateRangeFilter, TimeSeriesData, TimeGranularity, ActiveUsersConfig, ActiveUsersResponse, ActiveUserRatios } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Configuration for tracking feature dwell time.
|
|
45
45
|
*/
|
|
@@ -185,7 +185,7 @@ export declare function calculateSessionDepthScore(pagesVisited: number, feature
|
|
|
185
185
|
/**
|
|
186
186
|
* Engagement analytics tracking class.
|
|
187
187
|
*/
|
|
188
|
-
export declare class Engagement extends
|
|
188
|
+
export declare class Engagement extends FlowGridTransport {
|
|
189
189
|
/**
|
|
190
190
|
* Track feature dwell time.
|
|
191
191
|
*/
|
|
@@ -230,4 +230,25 @@ export declare class Engagement extends EnterpriseFTRPC {
|
|
|
230
230
|
avgDwellTime: number;
|
|
231
231
|
uniqueUsers: number;
|
|
232
232
|
}>>;
|
|
233
|
+
/**
|
|
234
|
+
* Get active users at any granularity (day, week, month).
|
|
235
|
+
*/
|
|
236
|
+
getActiveUsers(config: ActiveUsersConfig): Promise<ActiveUsersResponse>;
|
|
237
|
+
/**
|
|
238
|
+
* Get daily active users.
|
|
239
|
+
*/
|
|
240
|
+
getDAU(filter?: DateRangeFilter): Promise<ActiveUsersResponse>;
|
|
241
|
+
/**
|
|
242
|
+
* Get weekly active users.
|
|
243
|
+
*/
|
|
244
|
+
getWAU(filter?: DateRangeFilter): Promise<ActiveUsersResponse>;
|
|
245
|
+
/**
|
|
246
|
+
* Get monthly active users.
|
|
247
|
+
*/
|
|
248
|
+
getMAU(filter?: DateRangeFilter): Promise<ActiveUsersResponse>;
|
|
249
|
+
/**
|
|
250
|
+
* Get DAU/WAU/MAU stickiness ratios.
|
|
251
|
+
* Fetches all three in parallel and computes ratios (guards division by zero).
|
|
252
|
+
*/
|
|
253
|
+
getActiveUserRatios(filter?: DateRangeFilter): Promise<ActiveUserRatios>;
|
|
233
254
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
42
|
import { DateRangeFilter, TimeGranularity, MoneyValue, CurrencyCode } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Forecast model types.
|
|
@@ -265,7 +265,7 @@ export declare function applyConfidenceInterval(predicted: number, stdError: num
|
|
|
265
265
|
/**
|
|
266
266
|
* Product usage forecasting class.
|
|
267
267
|
*/
|
|
268
|
-
export declare class Forecasting extends
|
|
268
|
+
export declare class Forecasting extends FlowGridTransport {
|
|
269
269
|
/**
|
|
270
270
|
* Forecast active users.
|
|
271
271
|
*/
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* });
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
import {
|
|
46
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
47
47
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity, MoneyValue, CurrencyCode } from "../../types";
|
|
48
48
|
/**
|
|
49
49
|
* Revenue event types.
|
|
@@ -274,7 +274,7 @@ export declare function calculateLTV(arpu: number, monthlyChurnRate: number, cur
|
|
|
274
274
|
/**
|
|
275
275
|
* Revenue and monetization analytics class.
|
|
276
276
|
*/
|
|
277
|
-
export declare class Monetization extends
|
|
277
|
+
export declare class Monetization extends FlowGridTransport {
|
|
278
278
|
/**
|
|
279
279
|
* Track revenue event.
|
|
280
280
|
*/
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
import {
|
|
43
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
44
44
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
45
45
|
/**
|
|
46
46
|
* Funnel path definition.
|
|
@@ -254,7 +254,7 @@ export declare function generatePathId(steps: string[]): string;
|
|
|
254
254
|
/**
|
|
255
255
|
* Multi-path funnels and micro-conversions class.
|
|
256
256
|
*/
|
|
257
|
-
export declare class MultiPathFunnels extends
|
|
257
|
+
export declare class MultiPathFunnels extends FlowGridTransport {
|
|
258
258
|
/**
|
|
259
259
|
* Define a multi-path funnel.
|
|
260
260
|
*/
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
42
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Screen/page transition configuration.
|
|
@@ -251,7 +251,7 @@ export declare function findCommonSubPaths(paths: string[][], minLength?: number
|
|
|
251
251
|
/**
|
|
252
252
|
* Behavioral analytics and path analysis class.
|
|
253
253
|
*/
|
|
254
|
-
export declare class PathAnalytics extends
|
|
254
|
+
export declare class PathAnalytics extends FlowGridTransport {
|
|
255
255
|
/**
|
|
256
256
|
* Track screen/page transition.
|
|
257
257
|
*/
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* });
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
import {
|
|
41
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
42
42
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
43
43
|
/**
|
|
44
44
|
* Security event types.
|
|
@@ -274,7 +274,7 @@ export declare function determineEventSeverity(eventType: SecurityEventType, suc
|
|
|
274
274
|
/**
|
|
275
275
|
* Security and compliance analytics class.
|
|
276
276
|
*/
|
|
277
|
-
export declare class SecurityAnalytics extends
|
|
277
|
+
export declare class SecurityAnalytics extends FlowGridTransport {
|
|
278
278
|
/**
|
|
279
279
|
* Track login attempt.
|
|
280
280
|
*/
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* });
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
import {
|
|
42
|
+
import { FlowGridTransport } from "../../client/transport";
|
|
43
43
|
import { DateRangeFilter, TimeSeriesData, TimeGranularity } from "../../types";
|
|
44
44
|
/**
|
|
45
45
|
* Ticket priority levels.
|
|
@@ -248,7 +248,7 @@ export declare function formatDuration(ms: number): string;
|
|
|
248
248
|
/**
|
|
249
249
|
* Customer support and experience analytics class.
|
|
250
250
|
*/
|
|
251
|
-
export declare class SupportAnalytics extends
|
|
251
|
+
export declare class SupportAnalytics extends FlowGridTransport {
|
|
252
252
|
/**
|
|
253
253
|
* Track new support ticket.
|
|
254
254
|
*/
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
import { type ReactNode } from 'react';
|
|
29
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment,
|
|
29
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, PageViews, Sessions, Events, Identify, Funnels, Products, CartTracking, Checkout, Purchases } from '../../../index';
|
|
30
30
|
export interface FlowGridConfig {
|
|
31
31
|
webId: string;
|
|
32
32
|
endpoint: string;
|
|
33
33
|
apiKey: string;
|
|
34
|
+
visitorId?: string;
|
|
34
35
|
autoTrackPageViews?: boolean;
|
|
35
36
|
autoTrackSessions?: boolean;
|
|
36
37
|
debug?: boolean;
|
|
@@ -40,7 +41,6 @@ export interface FlowGridContextValue {
|
|
|
40
41
|
trackFeature: TrackFeature;
|
|
41
42
|
trackPrompt: TrackPrompt;
|
|
42
43
|
experiment: Experiment;
|
|
43
|
-
featureFlag: FeatureFlag;
|
|
44
44
|
pageViews: PageViews;
|
|
45
45
|
sessions: Sessions;
|
|
46
46
|
events: Events;
|
|
@@ -94,7 +94,7 @@ export interface FlowGridProviderProps extends FlowGridConfig {
|
|
|
94
94
|
* }
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
|
-
export declare function FlowGridProvider({ children, webId, endpoint, apiKey, autoTrackPageViews, autoTrackSessions, debug }: FlowGridProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
97
|
+
export declare function FlowGridProvider({ children, webId, endpoint, apiKey, visitorId, autoTrackPageViews, autoTrackSessions, debug }: FlowGridProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
98
98
|
/**
|
|
99
99
|
* Access the FlowGrid SDK instance.
|
|
100
100
|
*/
|
|
@@ -127,15 +127,6 @@ export declare function useExperiment(experimentId: string, userId: string): {
|
|
|
127
127
|
variant: string | null;
|
|
128
128
|
isLoading: boolean;
|
|
129
129
|
};
|
|
130
|
-
/**
|
|
131
|
-
* Evaluate a feature flag.
|
|
132
|
-
*/
|
|
133
|
-
export declare function useFeatureFlag(flagKey: string, context?: {
|
|
134
|
-
userId?: string;
|
|
135
|
-
}): {
|
|
136
|
-
isEnabled: boolean;
|
|
137
|
-
isLoading: boolean;
|
|
138
|
-
};
|
|
139
130
|
/**
|
|
140
131
|
* Identify user.
|
|
141
132
|
*/
|
|
@@ -195,14 +186,17 @@ export declare function useEcommerce(): {
|
|
|
195
186
|
* ```
|
|
196
187
|
*/
|
|
197
188
|
export declare function PageViewTracker(): null;
|
|
189
|
+
import { CookieBanner as _CookieBanner } from '../react/CookieBanner';
|
|
190
|
+
export { CookieBanner } from '../react/CookieBanner';
|
|
191
|
+
export type { CookieBannerProps } from '../react/CookieBanner';
|
|
198
192
|
declare const _default: {
|
|
199
193
|
FlowGridProvider: typeof FlowGridProvider;
|
|
200
194
|
useFlowGrid: typeof useFlowGrid;
|
|
201
195
|
useTrackEvent: typeof useTrackEvent;
|
|
202
196
|
useExperiment: typeof useExperiment;
|
|
203
|
-
useFeatureFlag: typeof useFeatureFlag;
|
|
204
197
|
useIdentify: typeof useIdentify;
|
|
205
198
|
useEcommerce: typeof useEcommerce;
|
|
206
199
|
PageViewTracker: typeof PageViewTracker;
|
|
200
|
+
CookieBanner: typeof _CookieBanner;
|
|
207
201
|
};
|
|
208
202
|
export default _default;
|
|
@@ -21,18 +21,21 @@
|
|
|
21
21
|
* }
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment,
|
|
24
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, PageViews, Sessions, Events, Identify, Funnels, Purchases, Subscriptions, CustomerLTV } from '../../../index';
|
|
25
|
+
import { type ServerCookieReader } from '../../utils/identity';
|
|
25
26
|
export interface ServerFlowGridConfig {
|
|
26
27
|
webId: string;
|
|
27
28
|
endpoint: string;
|
|
28
29
|
apiKey: string;
|
|
30
|
+
visitorId?: string;
|
|
31
|
+
/** Next.js `cookies()` for reading visitor identity from the request */
|
|
32
|
+
cookies?: ServerCookieReader;
|
|
29
33
|
}
|
|
30
34
|
export interface ServerFlowGridInstance {
|
|
31
35
|
activation: Activation;
|
|
32
36
|
trackFeature: TrackFeature;
|
|
33
37
|
trackPrompt: TrackPrompt;
|
|
34
38
|
experiment: Experiment;
|
|
35
|
-
featureFlag: FeatureFlag;
|
|
36
39
|
pageViews: PageViews;
|
|
37
40
|
sessions: Sessions;
|
|
38
41
|
events: Events;
|
|
@@ -70,7 +73,6 @@ export declare const flowgrid: {
|
|
|
70
73
|
readonly purchases: Purchases;
|
|
71
74
|
readonly subscriptions: Subscriptions;
|
|
72
75
|
readonly experiment: Experiment;
|
|
73
|
-
readonly featureFlag: FeatureFlag;
|
|
74
76
|
readonly activation: Activation;
|
|
75
77
|
readonly trackFeature: TrackFeature;
|
|
76
78
|
readonly trackPrompt: TrackPrompt;
|
|
@@ -136,16 +138,6 @@ export declare function trackServerPurchase(order: {
|
|
|
136
138
|
quantity: number;
|
|
137
139
|
}>;
|
|
138
140
|
}): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Evaluate a feature flag server-side.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```ts
|
|
144
|
-
* // In a Server Component or API route
|
|
145
|
-
* const isEnabled = await evaluateServerFlag('new_feature', userId);
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
export declare function evaluateServerFlag(flagKey: string, userId?: string, context?: Record<string, unknown>): Promise<boolean>;
|
|
149
141
|
/**
|
|
150
142
|
* Get experiment variant server-side.
|
|
151
143
|
*
|
|
@@ -184,7 +176,6 @@ declare const _default: {
|
|
|
184
176
|
readonly purchases: Purchases;
|
|
185
177
|
readonly subscriptions: Subscriptions;
|
|
186
178
|
readonly experiment: Experiment;
|
|
187
|
-
readonly featureFlag: FeatureFlag;
|
|
188
179
|
readonly activation: Activation;
|
|
189
180
|
readonly trackFeature: TrackFeature;
|
|
190
181
|
readonly trackPrompt: TrackPrompt;
|
|
@@ -194,7 +185,6 @@ declare const _default: {
|
|
|
194
185
|
trackServerEvent: typeof trackServerEvent;
|
|
195
186
|
identifyServerUser: typeof identifyServerUser;
|
|
196
187
|
trackServerPurchase: typeof trackServerPurchase;
|
|
197
|
-
evaluateServerFlag: typeof evaluateServerFlag;
|
|
198
188
|
getServerExperimentVariant: typeof getServerExperimentVariant;
|
|
199
189
|
createTrackedAction: typeof createTrackedAction;
|
|
200
190
|
};
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
* await flowgrid.track('user_signed_up', { userId: 'user_123' });
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment,
|
|
26
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, Events, Identify, Funnels, Purchases, Refunds, Subscriptions, CustomerLTV, Inventory } from '../../../index';
|
|
27
27
|
export interface FlowGridConfig {
|
|
28
28
|
webId: string;
|
|
29
29
|
endpoint: string;
|
|
30
30
|
apiKey: string;
|
|
31
|
+
visitorId?: string;
|
|
31
32
|
/** Flush events in batches (default: true) */
|
|
32
33
|
batchEvents?: boolean;
|
|
33
34
|
/** Batch size before auto-flush (default: 100) */
|
|
@@ -87,7 +88,6 @@ export declare class FlowGrid {
|
|
|
87
88
|
readonly trackFeature: TrackFeature;
|
|
88
89
|
readonly trackPrompt: TrackPrompt;
|
|
89
90
|
readonly experiment: Experiment;
|
|
90
|
-
readonly featureFlag: FeatureFlag;
|
|
91
91
|
readonly events: Events;
|
|
92
92
|
readonly identify: Identify;
|
|
93
93
|
readonly funnels: Funnels;
|
|
@@ -215,10 +215,6 @@ export declare class FlowGrid {
|
|
|
215
215
|
* Get experiment variant for a user.
|
|
216
216
|
*/
|
|
217
217
|
getExperimentVariant(experimentId: string, userId: string): Promise<string>;
|
|
218
|
-
/**
|
|
219
|
-
* Evaluate a feature flag.
|
|
220
|
-
*/
|
|
221
|
-
evaluateFlag(flagKey: string, userId?: string, defaultValue?: boolean): Promise<boolean>;
|
|
222
218
|
}
|
|
223
219
|
/**
|
|
224
220
|
* Express middleware for automatic request tracking.
|
|
@@ -35,11 +35,12 @@
|
|
|
35
35
|
*/
|
|
36
36
|
export * from '../vue/index';
|
|
37
37
|
import { type Ref } from 'vue';
|
|
38
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment,
|
|
38
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, PageViews, Sessions, Events, Identify, Funnels, Products, CartTracking, Checkout, Purchases, Subscriptions, CustomerLTV } from '../../../index';
|
|
39
39
|
export interface NuxtFlowGridConfig {
|
|
40
40
|
webId: string;
|
|
41
41
|
endpoint: string;
|
|
42
42
|
apiKey: string;
|
|
43
|
+
visitorId?: string;
|
|
43
44
|
autoTrackPageViews?: boolean;
|
|
44
45
|
autoTrackSessions?: boolean;
|
|
45
46
|
debug?: boolean;
|
|
@@ -76,7 +77,6 @@ export declare function createFlowGridPlugin(config: NuxtFlowGridConfig): {
|
|
|
76
77
|
trackFeature: TrackFeature;
|
|
77
78
|
trackPrompt: TrackPrompt;
|
|
78
79
|
experiment: Experiment;
|
|
79
|
-
featureFlag: FeatureFlag;
|
|
80
80
|
pageViews: PageViews;
|
|
81
81
|
sessions: Sessions;
|
|
82
82
|
events: Events;
|
|
@@ -146,12 +146,16 @@ export declare function createServerFlowGrid(config: {
|
|
|
146
146
|
webId: string;
|
|
147
147
|
endpoint: string;
|
|
148
148
|
apiKey: string;
|
|
149
|
+
visitorId?: string;
|
|
150
|
+
/** Nuxt server cookie reader (e.g. from getCookie or parseCookies) */
|
|
151
|
+
cookies?: {
|
|
152
|
+
get(name: string): string | undefined | null;
|
|
153
|
+
};
|
|
149
154
|
}): {
|
|
150
155
|
activation: Activation;
|
|
151
156
|
trackFeature: TrackFeature;
|
|
152
157
|
trackPrompt: TrackPrompt;
|
|
153
158
|
experiment: Experiment;
|
|
154
|
-
featureFlag: FeatureFlag;
|
|
155
159
|
events: Events;
|
|
156
160
|
identify: Identify;
|
|
157
161
|
funnels: Funnels;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowGrid Cookie Banner — React Component
|
|
3
|
+
* @module frameworks/react/CookieBanner
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* A customisable cookie consent banner for React applications.
|
|
7
|
+
* Works with the FlowGrid {@link ConsentManager} to persist user
|
|
8
|
+
* choices and gate analytics/marketing tracking.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { CookieBanner } from 'flowgrid-sdk/react';
|
|
13
|
+
* import { ConsentManager, FlowGridTransport } from 'flowgrid-sdk';
|
|
14
|
+
*
|
|
15
|
+
* const consent = new ConsentManager({
|
|
16
|
+
* onChange: (prefs) => {
|
|
17
|
+
* FlowGridTransport.setConsent({
|
|
18
|
+
* analytics: prefs.analytics,
|
|
19
|
+
* marketing: prefs.marketing,
|
|
20
|
+
* });
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* function App() {
|
|
25
|
+
* return (
|
|
26
|
+
* <>
|
|
27
|
+
* <MyApp />
|
|
28
|
+
* <CookieBanner
|
|
29
|
+
* consent={consent}
|
|
30
|
+
* config={{
|
|
31
|
+
* title: 'We use cookies',
|
|
32
|
+
* description: 'We use cookies to improve your experience and analyse traffic.',
|
|
33
|
+
* privacyPolicyUrl: '/privacy',
|
|
34
|
+
* theme: { position: 'bottom', primaryColor: '#4F46E5' },
|
|
35
|
+
* }}
|
|
36
|
+
* />
|
|
37
|
+
* </>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
import type { ConsentManager } from '../../consent/manager';
|
|
43
|
+
import type { CookieBannerConfig } from '../../consent/types';
|
|
44
|
+
/**
|
|
45
|
+
* Props for the {@link CookieBanner} component.
|
|
46
|
+
*/
|
|
47
|
+
export interface CookieBannerProps {
|
|
48
|
+
/** The {@link ConsentManager} instance. */
|
|
49
|
+
consent: ConsentManager;
|
|
50
|
+
/** Banner configuration and theme. */
|
|
51
|
+
config?: CookieBannerConfig;
|
|
52
|
+
/** Called after the user makes a choice and the banner closes. */
|
|
53
|
+
onClose?: () => void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Cookie consent banner for React.
|
|
57
|
+
*
|
|
58
|
+
* Shows a GDPR/CCPA-compliant cookie banner with "Accept All",
|
|
59
|
+
* "Reject All", and "Customise" options. Persists choices via
|
|
60
|
+
* the provided {@link ConsentManager}.
|
|
61
|
+
*
|
|
62
|
+
* @param props - Component props.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* import { CookieBanner } from 'flowgrid-sdk/react';
|
|
67
|
+
*
|
|
68
|
+
* function App() {
|
|
69
|
+
* return (
|
|
70
|
+
* <>
|
|
71
|
+
* <Routes />
|
|
72
|
+
* <CookieBanner
|
|
73
|
+
* consent={consentManager}
|
|
74
|
+
* config={{
|
|
75
|
+
* title: 'Cookie Preferences',
|
|
76
|
+
* description: 'We use cookies to personalise content and ads.',
|
|
77
|
+
* privacyPolicyUrl: '/privacy',
|
|
78
|
+
* theme: { position: 'bottom-right', primaryColor: '#059669' },
|
|
79
|
+
* categoryDescriptions: {
|
|
80
|
+
* analytics: 'Help us understand how visitors interact with our site.',
|
|
81
|
+
* marketing: 'Used to deliver relevant ads and track campaigns.',
|
|
82
|
+
* preferences: 'Remember your settings and preferences.',
|
|
83
|
+
* },
|
|
84
|
+
* }}
|
|
85
|
+
* />
|
|
86
|
+
* </>
|
|
87
|
+
* );
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function CookieBanner({ consent, config, onClose }: CookieBannerProps): import("react/jsx-runtime").JSX.Element | null;
|