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
|
@@ -1,48 +1,84 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview FlowGrid SDK
|
|
2
|
+
* @fileoverview FlowGrid SDK — React Integration
|
|
3
3
|
* @module frameworks/react
|
|
4
4
|
*
|
|
5
5
|
* @description
|
|
6
|
-
* React hooks and
|
|
7
|
-
*
|
|
6
|
+
* React provider, hooks, and cookie banner component for FlowGrid SDK.
|
|
7
|
+
* Uses React Context API for state management.
|
|
8
|
+
*
|
|
9
|
+
* ## Quick Start
|
|
8
10
|
*
|
|
9
|
-
* @example
|
|
10
11
|
* ```tsx
|
|
11
|
-
* //
|
|
12
|
-
* import { FlowGridProvider } from 'flowgrid-sdk/react';
|
|
12
|
+
* // app.tsx
|
|
13
|
+
* import { FlowGridProvider, useFlowGrid, CookieBanner } from 'flowgrid-sdk/react';
|
|
14
|
+
* import { ConsentManager, FlowGridTransport } from 'flowgrid-sdk';
|
|
15
|
+
*
|
|
16
|
+
* const consent = new ConsentManager({
|
|
17
|
+
* onChange: (prefs) => {
|
|
18
|
+
* FlowGridTransport.setConsent({
|
|
19
|
+
* analytics: prefs.analytics,
|
|
20
|
+
* marketing: prefs.marketing,
|
|
21
|
+
* });
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
13
24
|
*
|
|
14
25
|
* function App() {
|
|
15
26
|
* return (
|
|
16
27
|
* <FlowGridProvider
|
|
17
|
-
* webId="
|
|
18
|
-
* endpoint="https://api.
|
|
19
|
-
* apiKey="
|
|
28
|
+
* webId="web_abc123"
|
|
29
|
+
* endpoint="https://api.flow-grid.xyz"
|
|
30
|
+
* apiKey="key_xxx"
|
|
20
31
|
* >
|
|
21
|
-
* <
|
|
32
|
+
* <MyApp />
|
|
33
|
+
* <CookieBanner consent={consent} />
|
|
22
34
|
* </FlowGridProvider>
|
|
23
35
|
* );
|
|
24
36
|
* }
|
|
37
|
+
*
|
|
38
|
+
* function MyComponent() {
|
|
39
|
+
* const { trackEvent } = useFlowGrid();
|
|
40
|
+
* return <button onClick={() => trackEvent('click', { id: 'cta' })}>Click</button>;
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
import { type ReactNode } from 'react';
|
|
45
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, PageViews, Sessions, Events, Identify, Funnels, Products, CartTracking, Checkout, Purchases } from '../../../index';
|
|
46
|
+
export { CookieBanner } from './CookieBanner';
|
|
47
|
+
export type { CookieBannerProps } from './CookieBanner';
|
|
48
|
+
/**
|
|
49
|
+
* Configuration for the React FlowGrid provider.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <FlowGridProvider
|
|
54
|
+
* webId="web_abc123"
|
|
55
|
+
* endpoint="https://api.flow-grid.xyz"
|
|
56
|
+
* apiKey="key_xxx"
|
|
57
|
+
* autoTrackPageViews={true}
|
|
58
|
+
* autoTrackSessions={true}
|
|
59
|
+
* debug={false}
|
|
60
|
+
* >
|
|
61
|
+
* {children}
|
|
62
|
+
* </FlowGridProvider>
|
|
25
63
|
* ```
|
|
26
64
|
*/
|
|
27
|
-
import React, { type ReactNode } from 'react';
|
|
28
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment, FeatureFlag, PageViews, Sessions, Events, Identify, Funnels, Products, CartTracking, Checkout, Purchases } from '../../../index';
|
|
29
65
|
export interface FlowGridConfig {
|
|
30
66
|
webId: string;
|
|
31
67
|
endpoint: string;
|
|
32
68
|
apiKey: string;
|
|
33
|
-
|
|
69
|
+
visitorId?: string;
|
|
34
70
|
autoTrackPageViews?: boolean;
|
|
35
|
-
/** Auto-track sessions (default: true) */
|
|
36
71
|
autoTrackSessions?: boolean;
|
|
37
|
-
/** Enable debug mode (default: false) */
|
|
38
72
|
debug?: boolean;
|
|
39
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Value provided by the FlowGrid React context.
|
|
76
|
+
*/
|
|
40
77
|
export interface FlowGridContextValue {
|
|
41
78
|
activation: Activation;
|
|
42
79
|
trackFeature: TrackFeature;
|
|
43
80
|
trackPrompt: TrackPrompt;
|
|
44
81
|
experiment: Experiment;
|
|
45
|
-
featureFlag: FeatureFlag;
|
|
46
82
|
pageViews: PageViews;
|
|
47
83
|
sessions: Sessions;
|
|
48
84
|
events: Events;
|
|
@@ -52,148 +88,102 @@ export interface FlowGridContextValue {
|
|
|
52
88
|
cart: CartTracking;
|
|
53
89
|
checkout: Checkout;
|
|
54
90
|
purchases: Purchases;
|
|
91
|
+
/** Shorthand: track a custom event. */
|
|
55
92
|
trackEvent: (name: string, properties?: Record<string, unknown>) => Promise<void>;
|
|
93
|
+
/** Shorthand: identify a user. */
|
|
56
94
|
identifyUser: (userId: string, traits?: Record<string, unknown>) => Promise<void>;
|
|
95
|
+
/** `true` once the session has started and the SDK is ready. */
|
|
57
96
|
isReady: boolean;
|
|
58
97
|
}
|
|
59
98
|
export interface FlowGridProviderProps extends FlowGridConfig {
|
|
60
99
|
children: ReactNode;
|
|
61
100
|
}
|
|
62
101
|
/**
|
|
63
|
-
*
|
|
102
|
+
* React context provider for FlowGrid SDK.
|
|
64
103
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* <FlowGridProvider
|
|
68
|
-
* webId="web_123"
|
|
69
|
-
* endpoint="https://api.flowgrid.io"
|
|
70
|
-
* apiKey="key_abc"
|
|
71
|
-
* autoTrackPageViews={true}
|
|
72
|
-
* >
|
|
73
|
-
* <App />
|
|
74
|
-
* </FlowGridProvider>
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function FlowGridProvider({ children, webId, endpoint, apiKey, autoTrackPageViews, autoTrackSessions, debug }: FlowGridProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
-
/**
|
|
79
|
-
* Access the FlowGrid SDK instance.
|
|
80
|
-
* Must be used within FlowGridProvider.
|
|
104
|
+
* Initialises all SDK modules, auto-tracks sessions and page views,
|
|
105
|
+
* and provides them to child components via {@link useFlowGrid}.
|
|
81
106
|
*
|
|
82
107
|
* @example
|
|
83
108
|
* ```tsx
|
|
84
|
-
*
|
|
85
|
-
* const { trackEvent, events } = useFlowGrid();
|
|
86
|
-
*
|
|
87
|
-
* const handleClick = () => {
|
|
88
|
-
* trackEvent('button_clicked', { buttonId: 'cta' });
|
|
89
|
-
* };
|
|
90
|
-
*
|
|
91
|
-
* return <button onClick={handleClick}>Click me</button>;
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function useFlowGrid(): FlowGridContextValue;
|
|
96
|
-
/**
|
|
97
|
-
* Track page views automatically on route changes.
|
|
98
|
-
* Use in your root layout or App component.
|
|
109
|
+
* import { FlowGridProvider } from 'flowgrid-sdk/react';
|
|
99
110
|
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```tsx
|
|
102
111
|
* function App() {
|
|
103
|
-
*
|
|
104
|
-
*
|
|
112
|
+
* return (
|
|
113
|
+
* <FlowGridProvider
|
|
114
|
+
* webId={process.env.REACT_APP_FLOWGRID_WEB_ID!}
|
|
115
|
+
* endpoint={process.env.REACT_APP_FLOWGRID_ENDPOINT!}
|
|
116
|
+
* apiKey={process.env.REACT_APP_FLOWGRID_API_KEY!}
|
|
117
|
+
* >
|
|
118
|
+
* <Routes />
|
|
119
|
+
* </FlowGridProvider>
|
|
120
|
+
* );
|
|
105
121
|
* }
|
|
106
122
|
* ```
|
|
107
123
|
*/
|
|
108
|
-
export declare function
|
|
124
|
+
export declare function FlowGridProvider({ children, webId, endpoint, apiKey, visitorId, autoTrackPageViews, autoTrackSessions, debug, }: FlowGridProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
109
125
|
/**
|
|
110
|
-
*
|
|
126
|
+
* Access the FlowGrid SDK instance from context.
|
|
111
127
|
*
|
|
112
|
-
* @
|
|
113
|
-
* ```tsx
|
|
114
|
-
* function PricingPage() {
|
|
115
|
-
* useTrackEvent('pricing_page_viewed', { source: 'navbar' });
|
|
116
|
-
* return <PricingContent />;
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export declare function useTrackEvent(eventName: string, properties?: Record<string, unknown>, deps?: React.DependencyList): void;
|
|
121
|
-
/**
|
|
122
|
-
* Get experiment variant for a user.
|
|
128
|
+
* @throws If used outside a {@link FlowGridProvider}.
|
|
123
129
|
*
|
|
124
130
|
* @example
|
|
125
131
|
* ```tsx
|
|
126
|
-
*
|
|
127
|
-
* const { variant, isLoading } = useExperiment('checkout_v2', 'user_123');
|
|
132
|
+
* import { useFlowGrid } from 'flowgrid-sdk/react';
|
|
128
133
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* ? <NewCheckout />
|
|
133
|
-
* : <OldCheckout />;
|
|
134
|
+
* function Dashboard() {
|
|
135
|
+
* const { events, isReady } = useFlowGrid();
|
|
136
|
+
* // ...
|
|
134
137
|
* }
|
|
135
138
|
* ```
|
|
136
139
|
*/
|
|
137
|
-
export declare function
|
|
138
|
-
variant: string | null;
|
|
139
|
-
isLoading: boolean;
|
|
140
|
-
};
|
|
140
|
+
export declare function useFlowGrid(): FlowGridContextValue;
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
142
|
+
* Get the `trackEvent` helper from context.
|
|
143
143
|
*
|
|
144
144
|
* @example
|
|
145
145
|
* ```tsx
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* userId: 'user_123'
|
|
149
|
-
* });
|
|
150
|
-
*
|
|
151
|
-
* if (isLoading) return <Loading />;
|
|
152
|
-
*
|
|
153
|
-
* return isEnabled ? <NewDashboard /> : <OldDashboard />;
|
|
154
|
-
* }
|
|
146
|
+
* const trackEvent = useTrackEvent();
|
|
147
|
+
* <button onClick={() => trackEvent('signup_click')}>Sign Up</button>
|
|
155
148
|
* ```
|
|
156
149
|
*/
|
|
157
|
-
export declare function
|
|
158
|
-
userId?: string;
|
|
159
|
-
[key: string]: unknown;
|
|
160
|
-
}): {
|
|
161
|
-
isEnabled: boolean;
|
|
162
|
-
isLoading: boolean;
|
|
163
|
-
};
|
|
150
|
+
export declare function useTrackEvent(): (name: string, properties?: Record<string, unknown>) => Promise<void>;
|
|
164
151
|
/**
|
|
165
|
-
*
|
|
152
|
+
* Identify a user when their ID becomes available.
|
|
153
|
+
*
|
|
154
|
+
* @param userId - User ID (pass `null` when unknown).
|
|
155
|
+
* @param traits - Optional user traits.
|
|
166
156
|
*
|
|
167
157
|
* @example
|
|
168
158
|
* ```tsx
|
|
169
|
-
*
|
|
170
|
-
* useIdentify(user.id, {
|
|
171
|
-
* email: user.email,
|
|
172
|
-
* plan: user.plan
|
|
173
|
-
* });
|
|
159
|
+
* import { useIdentify } from 'flowgrid-sdk/react';
|
|
174
160
|
*
|
|
175
|
-
*
|
|
161
|
+
* function Profile({ userId }: { userId: string }) {
|
|
162
|
+
* useIdentify(userId, { plan: 'pro' });
|
|
163
|
+
* return <div>...</div>;
|
|
176
164
|
* }
|
|
177
165
|
* ```
|
|
178
166
|
*/
|
|
179
|
-
export declare function useIdentify(userId: string, traits?: Record<string, unknown>): void;
|
|
167
|
+
export declare function useIdentify(userId: string | null, traits?: Record<string, unknown>): void;
|
|
180
168
|
/**
|
|
181
|
-
*
|
|
169
|
+
* Get ecommerce tracking helpers.
|
|
182
170
|
*
|
|
183
171
|
* @example
|
|
184
172
|
* ```tsx
|
|
173
|
+
* import { useEcommerce } from 'flowgrid-sdk/react';
|
|
174
|
+
*
|
|
185
175
|
* function ProductPage({ product }) {
|
|
186
176
|
* const { trackProductView, trackAddToCart } = useEcommerce();
|
|
187
177
|
*
|
|
188
178
|
* useEffect(() => {
|
|
189
|
-
* trackProductView(product);
|
|
179
|
+
* trackProductView({ id: product.id, name: product.name, price: product.price });
|
|
190
180
|
* }, [product]);
|
|
191
181
|
*
|
|
192
|
-
*
|
|
193
|
-
* trackAddToCart(product,
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
182
|
+
* return (
|
|
183
|
+
* <button onClick={() => trackAddToCart({ id: product.id, name: product.name, price: product.price })}>
|
|
184
|
+
* Add to Cart
|
|
185
|
+
* </button>
|
|
186
|
+
* );
|
|
197
187
|
* }
|
|
198
188
|
* ```
|
|
199
189
|
*/
|
|
@@ -203,7 +193,6 @@ export declare function useEcommerce(): {
|
|
|
203
193
|
name: string;
|
|
204
194
|
price: number;
|
|
205
195
|
currency?: string;
|
|
206
|
-
category?: string;
|
|
207
196
|
}) => Promise<void>;
|
|
208
197
|
trackAddToCart: (product: {
|
|
209
198
|
id: string;
|
|
@@ -211,35 +200,8 @@ export declare function useEcommerce(): {
|
|
|
211
200
|
price: number;
|
|
212
201
|
currency?: string;
|
|
213
202
|
}, quantity?: number) => Promise<void>;
|
|
214
|
-
trackCheckoutStart: (cartItems: Array<{
|
|
215
|
-
productId: string;
|
|
216
|
-
name: string;
|
|
217
|
-
price: number;
|
|
218
|
-
quantity: number;
|
|
219
|
-
}>) => Promise<void>;
|
|
220
|
-
trackPurchase: (orderData: {
|
|
221
|
-
orderId: string;
|
|
222
|
-
revenue: number;
|
|
223
|
-
items: Array<{
|
|
224
|
-
id: string;
|
|
225
|
-
name: string;
|
|
226
|
-
price: number;
|
|
227
|
-
quantity: number;
|
|
228
|
-
}>;
|
|
229
|
-
}) => Promise<void>;
|
|
230
203
|
products: Products;
|
|
231
204
|
cart: CartTracking;
|
|
232
205
|
checkout: Checkout;
|
|
233
206
|
purchases: Purchases;
|
|
234
207
|
};
|
|
235
|
-
declare const _default: {
|
|
236
|
-
FlowGridProvider: typeof FlowGridProvider;
|
|
237
|
-
useFlowGrid: typeof useFlowGrid;
|
|
238
|
-
usePageView: typeof usePageView;
|
|
239
|
-
useTrackEvent: typeof useTrackEvent;
|
|
240
|
-
useExperiment: typeof useExperiment;
|
|
241
|
-
useFeatureFlag: typeof useFeatureFlag;
|
|
242
|
-
useIdentify: typeof useIdentify;
|
|
243
|
-
useEcommerce: typeof useEcommerce;
|
|
244
|
-
};
|
|
245
|
-
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowGrid Cookie Banner — Vue 3 Component
|
|
3
|
+
* @module frameworks/vue/CookieBanner
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* A customisable cookie consent banner for Vue 3 applications.
|
|
7
|
+
* Works with the FlowGrid {@link ConsentManager}.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```vue
|
|
11
|
+
* <script setup>
|
|
12
|
+
* import { CookieBanner } from 'flowgrid-sdk/vue';
|
|
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
|
+
* </script>
|
|
24
|
+
*
|
|
25
|
+
* <template>
|
|
26
|
+
* <CookieBanner
|
|
27
|
+
* :consent="consent"
|
|
28
|
+
* :config="{
|
|
29
|
+
* title: 'We use cookies',
|
|
30
|
+
* description: 'We use cookies to improve your experience.',
|
|
31
|
+
* privacyPolicyUrl: '/privacy',
|
|
32
|
+
* theme: { position: 'bottom', primaryColor: '#4F46E5' },
|
|
33
|
+
* }"
|
|
34
|
+
* />
|
|
35
|
+
* </template>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import { type PropType } from 'vue';
|
|
39
|
+
import type { ConsentManager } from '../../consent/manager';
|
|
40
|
+
import type { CookieBannerConfig } from '../../consent/types';
|
|
41
|
+
/**
|
|
42
|
+
* Vue 3 Cookie Banner component.
|
|
43
|
+
*
|
|
44
|
+
* Renders a GDPR-compliant cookie consent banner with accept, reject,
|
|
45
|
+
* and customise options. Uses the {@link ConsentManager} to persist choices.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```vue
|
|
49
|
+
* <template>
|
|
50
|
+
* <CookieBanner
|
|
51
|
+
* :consent="consentManager"
|
|
52
|
+
* :config="{ title: 'Cookies', theme: { position: 'bottom-right' } }"
|
|
53
|
+
* @close="onBannerClosed"
|
|
54
|
+
* />
|
|
55
|
+
* </template>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const CookieBanner: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
59
|
+
consent: {
|
|
60
|
+
type: PropType<ConsentManager>;
|
|
61
|
+
required: true;
|
|
62
|
+
};
|
|
63
|
+
config: {
|
|
64
|
+
type: PropType<CookieBannerConfig>;
|
|
65
|
+
default: () => {};
|
|
66
|
+
};
|
|
67
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
70
|
+
consent: {
|
|
71
|
+
type: PropType<ConsentManager>;
|
|
72
|
+
required: true;
|
|
73
|
+
};
|
|
74
|
+
config: {
|
|
75
|
+
type: PropType<CookieBannerConfig>;
|
|
76
|
+
default: () => {};
|
|
77
|
+
};
|
|
78
|
+
}>> & Readonly<{
|
|
79
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
80
|
+
}>, {
|
|
81
|
+
config: CookieBannerConfig;
|
|
82
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
* const app = createApp(App);
|
|
16
16
|
* app.use(FlowGridPlugin, {
|
|
17
17
|
* webId: 'your-web-id',
|
|
18
|
-
* endpoint: 'https://api.
|
|
18
|
+
* endpoint: 'https://api.flow-grid.xyz',
|
|
19
19
|
* apiKey: 'your-api-key'
|
|
20
20
|
* });
|
|
21
21
|
* app.mount('#app');
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
import { type App, type Ref } from 'vue';
|
|
25
|
-
import { Activation, TrackFeature, TrackPrompt, Experiment,
|
|
25
|
+
import { Activation, TrackFeature, TrackPrompt, Experiment, PageViews, Sessions, Events, Identify, Funnels, Products, CartTracking, Checkout, Purchases } from '../../../index';
|
|
26
26
|
export interface FlowGridConfig {
|
|
27
27
|
webId: string;
|
|
28
28
|
endpoint: string;
|
|
29
29
|
apiKey: string;
|
|
30
|
+
visitorId?: string;
|
|
30
31
|
autoTrackPageViews?: boolean;
|
|
31
32
|
autoTrackSessions?: boolean;
|
|
32
33
|
debug?: boolean;
|
|
@@ -36,7 +37,6 @@ export interface FlowGridInstance {
|
|
|
36
37
|
trackFeature: TrackFeature;
|
|
37
38
|
trackPrompt: TrackPrompt;
|
|
38
39
|
experiment: Experiment;
|
|
39
|
-
featureFlag: FeatureFlag;
|
|
40
40
|
pageViews: PageViews;
|
|
41
41
|
sessions: Sessions;
|
|
42
42
|
events: Events;
|
|
@@ -60,7 +60,7 @@ export interface FlowGridInstance {
|
|
|
60
60
|
* createApp(App)
|
|
61
61
|
* .use(FlowGridPlugin, {
|
|
62
62
|
* webId: 'web_123',
|
|
63
|
-
* endpoint: 'https://api.
|
|
63
|
+
* endpoint: 'https://api.flow-grid.xyz',
|
|
64
64
|
* apiKey: 'key_abc',
|
|
65
65
|
* autoTrackPageViews: true
|
|
66
66
|
* })
|
|
@@ -93,7 +93,6 @@ export declare function useFlowGrid(): {
|
|
|
93
93
|
trackFeature: TrackFeature;
|
|
94
94
|
trackPrompt: TrackPrompt;
|
|
95
95
|
experiment: Experiment;
|
|
96
|
-
featureFlag: FeatureFlag;
|
|
97
96
|
pageViews: PageViews;
|
|
98
97
|
sessions: Sessions;
|
|
99
98
|
events: Events;
|
|
@@ -155,27 +154,6 @@ export declare function useExperiment(experimentId: string, userId: string): {
|
|
|
155
154
|
variant: Ref<string | null, string | null>;
|
|
156
155
|
isLoading: Ref<boolean, boolean>;
|
|
157
156
|
};
|
|
158
|
-
/**
|
|
159
|
-
* Evaluate a feature flag.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```vue
|
|
163
|
-
* <script setup>
|
|
164
|
-
* import { useFeatureFlag } from 'flowgrid-sdk/vue';
|
|
165
|
-
*
|
|
166
|
-
* const { isEnabled, isLoading } = useFeatureFlag('new_dashboard');
|
|
167
|
-
* </script>
|
|
168
|
-
*
|
|
169
|
-
* <template>
|
|
170
|
-
* <NewDashboard v-if="isEnabled" />
|
|
171
|
-
* <OldDashboard v-else />
|
|
172
|
-
* </template>
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
export declare function useFeatureFlag(flagKey: string, userId?: string): {
|
|
176
|
-
isEnabled: Ref<boolean, boolean>;
|
|
177
|
-
isLoading: Ref<boolean, boolean>;
|
|
178
|
-
};
|
|
179
157
|
/**
|
|
180
158
|
* Identify a user.
|
|
181
159
|
*
|
|
@@ -259,6 +237,7 @@ export declare function createRouterPlugin(): (to: {
|
|
|
259
237
|
}, from: {
|
|
260
238
|
path: string;
|
|
261
239
|
}) => void;
|
|
240
|
+
export { CookieBanner } from './CookieBanner';
|
|
262
241
|
declare const _default: {
|
|
263
242
|
FlowGridPlugin: {
|
|
264
243
|
install(app: App, options: FlowGridConfig): void;
|
|
@@ -267,9 +246,33 @@ declare const _default: {
|
|
|
267
246
|
usePageView: typeof usePageView;
|
|
268
247
|
useTrackEvent: typeof useTrackEvent;
|
|
269
248
|
useExperiment: typeof useExperiment;
|
|
270
|
-
useFeatureFlag: typeof useFeatureFlag;
|
|
271
249
|
useIdentify: typeof useIdentify;
|
|
272
250
|
useEcommerce: typeof useEcommerce;
|
|
273
251
|
createRouterPlugin: typeof createRouterPlugin;
|
|
252
|
+
CookieBanner: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
253
|
+
consent: {
|
|
254
|
+
type: import("vue").PropType<import("../../consent/manager").ConsentManager>;
|
|
255
|
+
required: true;
|
|
256
|
+
};
|
|
257
|
+
config: {
|
|
258
|
+
type: import("vue").PropType<import("../../consent/types").CookieBannerConfig>;
|
|
259
|
+
default: () => {};
|
|
260
|
+
};
|
|
261
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
262
|
+
[key: string]: any;
|
|
263
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
264
|
+
consent: {
|
|
265
|
+
type: import("vue").PropType<import("../../consent/manager").ConsentManager>;
|
|
266
|
+
required: true;
|
|
267
|
+
};
|
|
268
|
+
config: {
|
|
269
|
+
type: import("vue").PropType<import("../../consent/types").CookieBannerConfig>;
|
|
270
|
+
default: () => {};
|
|
271
|
+
};
|
|
272
|
+
}>> & Readonly<{
|
|
273
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
274
|
+
}>, {
|
|
275
|
+
config: import("../../consent/types").CookieBannerConfig;
|
|
276
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
274
277
|
};
|
|
275
278
|
export default _default;
|
|
@@ -340,6 +340,68 @@ export interface RealTimeMetrics {
|
|
|
340
340
|
count: number;
|
|
341
341
|
}>;
|
|
342
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Granularity for active user queries.
|
|
345
|
+
*/
|
|
346
|
+
export type ActiveUserGranularity = 'day' | 'week' | 'month';
|
|
347
|
+
/**
|
|
348
|
+
* Configuration for querying active users.
|
|
349
|
+
*/
|
|
350
|
+
export interface ActiveUsersConfig {
|
|
351
|
+
/** Time granularity for the query */
|
|
352
|
+
granularity: ActiveUserGranularity;
|
|
353
|
+
/** Start date (ISO string) */
|
|
354
|
+
dateFrom?: string;
|
|
355
|
+
/** End date (ISO string) */
|
|
356
|
+
dateTo?: string;
|
|
357
|
+
/** Optional cohort/segment filter */
|
|
358
|
+
segment?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* A single period within an active users response.
|
|
362
|
+
*/
|
|
363
|
+
export interface ActiveUserPeriod {
|
|
364
|
+
/** Period label (e.g. '2026-04-15', '2026-W16', '2026-04') */
|
|
365
|
+
period: string;
|
|
366
|
+
/** Active users in this period */
|
|
367
|
+
activeUsers: number;
|
|
368
|
+
/** Active users in previous equivalent period */
|
|
369
|
+
previousPeriod?: number;
|
|
370
|
+
/** Percent change from previous period */
|
|
371
|
+
changePercent?: number;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Response from an active users query.
|
|
375
|
+
*/
|
|
376
|
+
export interface ActiveUsersResponse {
|
|
377
|
+
/** Granularity used */
|
|
378
|
+
granularity: ActiveUserGranularity;
|
|
379
|
+
/** Per-period active user counts */
|
|
380
|
+
periods: ActiveUserPeriod[];
|
|
381
|
+
/** Total unique active users across all periods */
|
|
382
|
+
total: number;
|
|
383
|
+
/** Overall trend direction */
|
|
384
|
+
trend: 'increasing' | 'stable' | 'decreasing';
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* DAU/WAU/MAU ratios (stickiness metrics).
|
|
388
|
+
*/
|
|
389
|
+
export interface ActiveUserRatios {
|
|
390
|
+
/** Daily active users */
|
|
391
|
+
dau: number;
|
|
392
|
+
/** Weekly active users */
|
|
393
|
+
wau: number;
|
|
394
|
+
/** Monthly active users */
|
|
395
|
+
mau: number;
|
|
396
|
+
/** DAU / WAU ratio */
|
|
397
|
+
dauWauRatio: number;
|
|
398
|
+
/** DAU / MAU ratio */
|
|
399
|
+
dauMauRatio: number;
|
|
400
|
+
/** WAU / MAU ratio */
|
|
401
|
+
wauMauRatio: number;
|
|
402
|
+
/** Timestamp of computation */
|
|
403
|
+
timestamp: string;
|
|
404
|
+
}
|
|
343
405
|
/**
|
|
344
406
|
* User lifecycle stage.
|
|
345
407
|
*/
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
export interface BaseConfig {
|
|
9
9
|
/** The name of the event to track */
|
|
10
10
|
eventName: string;
|
|
11
|
+
/** Optional visitor ID override; falls back to instance-level visitorId */
|
|
12
|
+
visitorId?: string;
|
|
11
13
|
/** Additional properties to send with the event */
|
|
12
14
|
properties?: Record<string, unknown>;
|
|
13
15
|
}
|