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,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Subscription & Recurring Revenue
|
|
3
|
+
* @module features/ecommerce/subscriptions
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track subscription lifecycle events for SaaS and subscription
|
|
7
|
+
* ecommerce businesses.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track subscription signups
|
|
11
|
+
* - Monitor subscription changes (upgrades/downgrades)
|
|
12
|
+
* - Track cancellations and churn
|
|
13
|
+
* - Calculate MRR/ARR metrics
|
|
14
|
+
* - Analyze subscription cohorts
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Monthly Recurring Revenue (MRR)
|
|
18
|
+
* - Annual Recurring Revenue (ARR)
|
|
19
|
+
* - Churn rate
|
|
20
|
+
* - Expansion revenue
|
|
21
|
+
* - Net revenue retention
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Line chart: MRR over time
|
|
25
|
+
* - Waterfall: MRR movement
|
|
26
|
+
* - Bar chart: Revenue by plan
|
|
27
|
+
* - Cohort: Subscription retention
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const subscriptions = new Subscriptions(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Track subscription start
|
|
34
|
+
* await subscriptions.start({
|
|
35
|
+
* subscriptionId: 'sub_123',
|
|
36
|
+
* userId: 'user_456',
|
|
37
|
+
* plan: 'pro',
|
|
38
|
+
* mrr: { amount: 4900, currency: 'USD' },
|
|
39
|
+
* billingCycle: 'monthly'
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
44
|
+
import { MoneyValue, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
45
|
+
/**
|
|
46
|
+
* Subscription start configuration.
|
|
47
|
+
*/
|
|
48
|
+
export interface SubscriptionStartConfig {
|
|
49
|
+
/** Subscription ID */
|
|
50
|
+
subscriptionId: string;
|
|
51
|
+
/** User ID */
|
|
52
|
+
userId: string;
|
|
53
|
+
/** Plan name */
|
|
54
|
+
plan: string;
|
|
55
|
+
/** Monthly recurring revenue */
|
|
56
|
+
mrr: MoneyValue;
|
|
57
|
+
/** Billing cycle */
|
|
58
|
+
billingCycle: 'monthly' | 'quarterly' | 'yearly';
|
|
59
|
+
/** Trial period (if applicable) */
|
|
60
|
+
trialDays?: number;
|
|
61
|
+
/** Coupon applied */
|
|
62
|
+
coupon?: string;
|
|
63
|
+
/** Custom properties */
|
|
64
|
+
properties?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Subscription change configuration.
|
|
68
|
+
*/
|
|
69
|
+
export interface SubscriptionChangeConfig {
|
|
70
|
+
/** Subscription ID */
|
|
71
|
+
subscriptionId: string;
|
|
72
|
+
/** User ID */
|
|
73
|
+
userId: string;
|
|
74
|
+
/** Previous plan */
|
|
75
|
+
previousPlan: string;
|
|
76
|
+
/** New plan */
|
|
77
|
+
newPlan: string;
|
|
78
|
+
/** Previous MRR */
|
|
79
|
+
previousMrr: MoneyValue;
|
|
80
|
+
/** New MRR */
|
|
81
|
+
newMrr: MoneyValue;
|
|
82
|
+
/** Change type */
|
|
83
|
+
changeType: 'upgrade' | 'downgrade' | 'cross_grade';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Subscription cancellation configuration.
|
|
87
|
+
*/
|
|
88
|
+
export interface SubscriptionCancelConfig {
|
|
89
|
+
/** Subscription ID */
|
|
90
|
+
subscriptionId: string;
|
|
91
|
+
/** User ID */
|
|
92
|
+
userId: string;
|
|
93
|
+
/** Plan being cancelled */
|
|
94
|
+
plan: string;
|
|
95
|
+
/** Lost MRR */
|
|
96
|
+
lostMrr: MoneyValue;
|
|
97
|
+
/** Cancellation reason */
|
|
98
|
+
reason?: string;
|
|
99
|
+
/** Feedback provided */
|
|
100
|
+
feedback?: string;
|
|
101
|
+
/** Whether cancelled immediately or at period end */
|
|
102
|
+
immediate: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Subscription response from API.
|
|
106
|
+
*/
|
|
107
|
+
export interface SubscriptionResponse {
|
|
108
|
+
eventName: string;
|
|
109
|
+
properties: Record<string, unknown>;
|
|
110
|
+
response: {
|
|
111
|
+
subscriptionId: string;
|
|
112
|
+
tracked: boolean;
|
|
113
|
+
};
|
|
114
|
+
timestamp: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Subscription analytics data.
|
|
118
|
+
*/
|
|
119
|
+
export interface SubscriptionAnalyticsData {
|
|
120
|
+
/** Summary metrics */
|
|
121
|
+
summary: {
|
|
122
|
+
totalMrr: MoneyValue;
|
|
123
|
+
totalArr: MoneyValue;
|
|
124
|
+
activeSubscriptions: number;
|
|
125
|
+
newSubscriptions: number;
|
|
126
|
+
churnedSubscriptions: number;
|
|
127
|
+
churnRate: number;
|
|
128
|
+
expansionMrr: MoneyValue;
|
|
129
|
+
contractionMrr: MoneyValue;
|
|
130
|
+
netMrrMovement: MoneyValue;
|
|
131
|
+
netRevenueRetention: number;
|
|
132
|
+
avgRevenuePerUser: MoneyValue;
|
|
133
|
+
};
|
|
134
|
+
/** MRR by plan */
|
|
135
|
+
byPlan: Array<{
|
|
136
|
+
plan: string;
|
|
137
|
+
subscriptions: number;
|
|
138
|
+
mrr: MoneyValue;
|
|
139
|
+
percentage: number;
|
|
140
|
+
}>;
|
|
141
|
+
/** MRR waterfall */
|
|
142
|
+
mrrMovement: {
|
|
143
|
+
startingMrr: MoneyValue;
|
|
144
|
+
newMrr: MoneyValue;
|
|
145
|
+
expansionMrr: MoneyValue;
|
|
146
|
+
contractionMrr: MoneyValue;
|
|
147
|
+
churnedMrr: MoneyValue;
|
|
148
|
+
endingMrr: MoneyValue;
|
|
149
|
+
};
|
|
150
|
+
/** MRR trend */
|
|
151
|
+
mrrTrend: TimeSeriesData;
|
|
152
|
+
/** Churn by reason */
|
|
153
|
+
churnByReason: Array<{
|
|
154
|
+
reason: string;
|
|
155
|
+
count: number;
|
|
156
|
+
lostMrr: MoneyValue;
|
|
157
|
+
}>;
|
|
158
|
+
/** Trial conversion rate */
|
|
159
|
+
trialMetrics: {
|
|
160
|
+
trialsStarted: number;
|
|
161
|
+
trialsConverted: number;
|
|
162
|
+
conversionRate: number;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Subscriptions - Track subscription lifecycle events.
|
|
167
|
+
*
|
|
168
|
+
* @extends FTRPC
|
|
169
|
+
*
|
|
170
|
+
* @description
|
|
171
|
+
* Provides subscription tracking including:
|
|
172
|
+
* - Subscription starts (new MRR)
|
|
173
|
+
* - Plan changes (expansion/contraction)
|
|
174
|
+
* - Cancellations (churned MRR)
|
|
175
|
+
* - Renewals
|
|
176
|
+
* - Trial conversions
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const subscriptions = new Subscriptions(webId, endpoint, apiKey);
|
|
181
|
+
*
|
|
182
|
+
* // New subscription
|
|
183
|
+
* await subscriptions.start({
|
|
184
|
+
* subscriptionId: 'sub_abc123',
|
|
185
|
+
* userId: 'user_456',
|
|
186
|
+
* plan: 'professional',
|
|
187
|
+
* mrr: { amount: 9900, currency: 'USD' },
|
|
188
|
+
* billingCycle: 'monthly',
|
|
189
|
+
* trialDays: 14
|
|
190
|
+
* });
|
|
191
|
+
*
|
|
192
|
+
* // Upgrade
|
|
193
|
+
* await subscriptions.change({
|
|
194
|
+
* subscriptionId: 'sub_abc123',
|
|
195
|
+
* userId: 'user_456',
|
|
196
|
+
* previousPlan: 'professional',
|
|
197
|
+
* newPlan: 'enterprise',
|
|
198
|
+
* previousMrr: { amount: 9900, currency: 'USD' },
|
|
199
|
+
* newMrr: { amount: 29900, currency: 'USD' },
|
|
200
|
+
* changeType: 'upgrade'
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare class Subscriptions extends FTRPC {
|
|
205
|
+
/**
|
|
206
|
+
* Tracks subscription start.
|
|
207
|
+
*
|
|
208
|
+
* @param config - Subscription start configuration
|
|
209
|
+
* @returns Promise resolving to subscription response
|
|
210
|
+
*/
|
|
211
|
+
start(config: SubscriptionStartConfig): Promise<SubscriptionResponse>;
|
|
212
|
+
/**
|
|
213
|
+
* Tracks subscription plan change.
|
|
214
|
+
*
|
|
215
|
+
* @param config - Subscription change configuration
|
|
216
|
+
* @returns Promise resolving to subscription response
|
|
217
|
+
*/
|
|
218
|
+
change(config: SubscriptionChangeConfig): Promise<SubscriptionResponse>;
|
|
219
|
+
/**
|
|
220
|
+
* Tracks subscription cancellation.
|
|
221
|
+
*
|
|
222
|
+
* @param config - Cancellation configuration
|
|
223
|
+
* @returns Promise resolving to subscription response
|
|
224
|
+
*/
|
|
225
|
+
cancel(config: SubscriptionCancelConfig): Promise<SubscriptionResponse>;
|
|
226
|
+
/**
|
|
227
|
+
* Tracks subscription renewal.
|
|
228
|
+
*
|
|
229
|
+
* @param subscriptionId - Subscription ID
|
|
230
|
+
* @param userId - User ID
|
|
231
|
+
* @param mrr - Renewed MRR
|
|
232
|
+
* @returns Promise resolving to subscription response
|
|
233
|
+
*/
|
|
234
|
+
renew(subscriptionId: string, userId: string, mrr: MoneyValue): Promise<SubscriptionResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* Tracks trial conversion to paid.
|
|
237
|
+
*
|
|
238
|
+
* @param subscriptionId - Subscription ID
|
|
239
|
+
* @param userId - User ID
|
|
240
|
+
* @param plan - Converted to plan
|
|
241
|
+
* @param mrr - New MRR
|
|
242
|
+
* @returns Promise resolving to subscription response
|
|
243
|
+
*/
|
|
244
|
+
trialConverted(subscriptionId: string, userId: string, plan: string, mrr: MoneyValue): Promise<SubscriptionResponse>;
|
|
245
|
+
/**
|
|
246
|
+
* Tracks trial expiration without conversion.
|
|
247
|
+
*
|
|
248
|
+
* @param subscriptionId - Subscription ID
|
|
249
|
+
* @param userId - User ID
|
|
250
|
+
* @returns Promise resolving to subscription response
|
|
251
|
+
*/
|
|
252
|
+
trialExpired(subscriptionId: string, userId: string): Promise<SubscriptionResponse>;
|
|
253
|
+
/**
|
|
254
|
+
* Gets subscription analytics for dashboards.
|
|
255
|
+
*
|
|
256
|
+
* @param filter - Date range filter
|
|
257
|
+
* @returns Promise resolving to subscription analytics
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* const analytics = await subscriptions.getAnalytics({
|
|
262
|
+
* range: 'thisMonth'
|
|
263
|
+
* });
|
|
264
|
+
*
|
|
265
|
+
* // KPI cards
|
|
266
|
+
* const kpis = [
|
|
267
|
+
* { label: 'MRR', value: analytics.summary.totalMrr.amount },
|
|
268
|
+
* { label: 'Churn Rate', value: analytics.summary.churnRate },
|
|
269
|
+
* { label: 'NRR', value: analytics.summary.netRevenueRetention }
|
|
270
|
+
* ];
|
|
271
|
+
*
|
|
272
|
+
* // Waterfall chart
|
|
273
|
+
* const waterfall = analytics.mrrMovement;
|
|
274
|
+
*
|
|
275
|
+
* // MRR trend line
|
|
276
|
+
* const trend = analytics.mrrTrend.data;
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
getAnalytics(filter?: DateRangeFilter): Promise<SubscriptionAnalyticsData>;
|
|
280
|
+
}
|
|
281
|
+
export default Subscriptions;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Ecommerce - Wishlist Tracking
|
|
3
|
+
* @module features/ecommerce/wishlist
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Track wishlist interactions to understand purchase intent
|
|
7
|
+
* and drive conversions from saved items.
|
|
8
|
+
*
|
|
9
|
+
* @useCases
|
|
10
|
+
* - Track wishlist additions
|
|
11
|
+
* - Monitor wishlist to cart conversions
|
|
12
|
+
* - Identify popular wishlist items
|
|
13
|
+
* - Trigger price drop notifications
|
|
14
|
+
* - Analyze wishlist behavior patterns
|
|
15
|
+
*
|
|
16
|
+
* @metrics
|
|
17
|
+
* - Wishlist additions
|
|
18
|
+
* - Wishlist to cart rate
|
|
19
|
+
* - Wishlist to purchase rate
|
|
20
|
+
* - Average items per wishlist
|
|
21
|
+
* - Top wishlisted products
|
|
22
|
+
*
|
|
23
|
+
* @chartData
|
|
24
|
+
* - Bar chart: Top wishlisted products
|
|
25
|
+
* - Line chart: Wishlist activity over time
|
|
26
|
+
* - Funnel: Wishlist to purchase conversion
|
|
27
|
+
* - Table: Wishlist conversion rates by product
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const wishlist = new WishlistTracking(webId, endpoint, apiKey);
|
|
32
|
+
*
|
|
33
|
+
* // Add to wishlist
|
|
34
|
+
* await wishlist.add({
|
|
35
|
+
* product: { productId: 'PROD-123', name: 'Widget', price: 49.99, currency: 'USD' },
|
|
36
|
+
* wishlistId: 'wl_user123'
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
import { FTRPC } from "../../client/ftrpc";
|
|
41
|
+
import { Product, Wishlist, DateRangeFilter, TimeSeriesData } from "../../types";
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for adding to wishlist.
|
|
44
|
+
*/
|
|
45
|
+
export interface AddToWishlistConfig {
|
|
46
|
+
/** Product being added */
|
|
47
|
+
product: Product;
|
|
48
|
+
/** Wishlist ID */
|
|
49
|
+
wishlistId?: string;
|
|
50
|
+
/** User ID */
|
|
51
|
+
userId?: string;
|
|
52
|
+
/** Source of add */
|
|
53
|
+
source?: 'product_page' | 'quick_add' | 'list_view' | 'search';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Configuration for removing from wishlist.
|
|
57
|
+
*/
|
|
58
|
+
export interface RemoveFromWishlistConfig {
|
|
59
|
+
/** Product being removed */
|
|
60
|
+
product: Product;
|
|
61
|
+
/** Wishlist ID */
|
|
62
|
+
wishlistId?: string;
|
|
63
|
+
/** User ID */
|
|
64
|
+
userId?: string;
|
|
65
|
+
/** Reason for removal */
|
|
66
|
+
reason?: 'user_action' | 'purchased' | 'moved_to_cart' | 'out_of_stock';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Wishlist event response from API.
|
|
70
|
+
*/
|
|
71
|
+
export interface WishlistResponse {
|
|
72
|
+
eventName: string;
|
|
73
|
+
properties: Record<string, unknown>;
|
|
74
|
+
response: {
|
|
75
|
+
wishlistId: string;
|
|
76
|
+
productId: string;
|
|
77
|
+
tracked: boolean;
|
|
78
|
+
};
|
|
79
|
+
timestamp: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Wishlist analytics data for charts.
|
|
83
|
+
*/
|
|
84
|
+
export interface WishlistAnalyticsData {
|
|
85
|
+
/** Summary metrics */
|
|
86
|
+
summary: {
|
|
87
|
+
totalWishlistAdds: number;
|
|
88
|
+
totalWishlistRemoves: number;
|
|
89
|
+
activeWishlists: number;
|
|
90
|
+
avgItemsPerWishlist: number;
|
|
91
|
+
wishlistToCartRate: number;
|
|
92
|
+
wishlistToPurchaseRate: number;
|
|
93
|
+
};
|
|
94
|
+
/** Top wishlisted products */
|
|
95
|
+
topProducts: Array<{
|
|
96
|
+
product: Pick<Product, 'productId' | 'name' | 'category' | 'price'>;
|
|
97
|
+
wishlistCount: number;
|
|
98
|
+
conversionToCart: number;
|
|
99
|
+
conversionToPurchase: number;
|
|
100
|
+
}>;
|
|
101
|
+
/** Wishlist activity time series */
|
|
102
|
+
timeSeries: TimeSeriesData;
|
|
103
|
+
/** Conversion funnel */
|
|
104
|
+
conversionFunnel: {
|
|
105
|
+
wishlisted: number;
|
|
106
|
+
addedToCart: number;
|
|
107
|
+
purchased: number;
|
|
108
|
+
wishlistToCartRate: number;
|
|
109
|
+
cartToPurchaseRate: number;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* WishlistTracking - Track wishlist interactions.
|
|
114
|
+
*
|
|
115
|
+
* @extends FTRPC
|
|
116
|
+
*
|
|
117
|
+
* @description
|
|
118
|
+
* Provides wishlist tracking capabilities including:
|
|
119
|
+
* - Add to wishlist events
|
|
120
|
+
* - Remove from wishlist events
|
|
121
|
+
* - Wishlist views
|
|
122
|
+
* - Move to cart tracking
|
|
123
|
+
* - Wishlist sharing
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const wishlist = new WishlistTracking(webId, endpoint, apiKey);
|
|
128
|
+
*
|
|
129
|
+
* // Add product to wishlist
|
|
130
|
+
* await wishlist.add({
|
|
131
|
+
* product: {
|
|
132
|
+
* productId: 'PROD-001',
|
|
133
|
+
* name: 'Designer Bag',
|
|
134
|
+
* price: 299.99,
|
|
135
|
+
* currency: 'USD'
|
|
136
|
+
* },
|
|
137
|
+
* source: 'product_page'
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* // Track wishlist view
|
|
141
|
+
* await wishlist.view({
|
|
142
|
+
* wishlistId: 'wl_user123',
|
|
143
|
+
* items: wishlistItems
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare class WishlistTracking extends FTRPC {
|
|
148
|
+
/**
|
|
149
|
+
* Tracks adding product to wishlist.
|
|
150
|
+
*
|
|
151
|
+
* @param config - Add to wishlist configuration
|
|
152
|
+
* @returns Promise resolving to wishlist response
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* await wishlist.add({
|
|
157
|
+
* product: {
|
|
158
|
+
* productId: 'SKU-789',
|
|
159
|
+
* name: 'Premium Sneakers',
|
|
160
|
+
* price: 159.99,
|
|
161
|
+
* currency: 'USD',
|
|
162
|
+
* category: 'Footwear'
|
|
163
|
+
* },
|
|
164
|
+
* source: 'product_page'
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
add(config: AddToWishlistConfig): Promise<WishlistResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Tracks removing product from wishlist.
|
|
171
|
+
*
|
|
172
|
+
* @param config - Remove from wishlist configuration
|
|
173
|
+
* @returns Promise resolving to wishlist response
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* await wishlist.remove({
|
|
178
|
+
* product: productToRemove,
|
|
179
|
+
* wishlistId: 'wl_user123',
|
|
180
|
+
* reason: 'moved_to_cart'
|
|
181
|
+
* });
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
remove(config: RemoveFromWishlistConfig): Promise<WishlistResponse>;
|
|
185
|
+
/**
|
|
186
|
+
* Tracks wishlist view.
|
|
187
|
+
*
|
|
188
|
+
* @param wishlist - Wishlist being viewed
|
|
189
|
+
* @returns Promise resolving to wishlist response
|
|
190
|
+
*/
|
|
191
|
+
view(wishlist: Wishlist): Promise<WishlistResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Tracks moving item from wishlist to cart.
|
|
194
|
+
*
|
|
195
|
+
* @param product - Product being moved
|
|
196
|
+
* @param wishlistId - Source wishlist
|
|
197
|
+
* @returns Promise resolving to wishlist response
|
|
198
|
+
*/
|
|
199
|
+
moveToCart(product: Product, wishlistId?: string): Promise<WishlistResponse>;
|
|
200
|
+
/**
|
|
201
|
+
* Tracks wishlist sharing.
|
|
202
|
+
*
|
|
203
|
+
* @param wishlistId - Wishlist being shared
|
|
204
|
+
* @param method - Share method
|
|
205
|
+
* @returns Promise resolving to wishlist response
|
|
206
|
+
*/
|
|
207
|
+
share(wishlistId: string, method: 'email' | 'link' | 'social'): Promise<WishlistResponse>;
|
|
208
|
+
/**
|
|
209
|
+
* Retrieves wishlist analytics for dashboards and charts.
|
|
210
|
+
*
|
|
211
|
+
* @param filter - Date range filter
|
|
212
|
+
* @returns Promise resolving to wishlist analytics
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* const analytics = await wishlist.getAnalytics({
|
|
217
|
+
* range: 'last30days'
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* // Bar chart - top wishlisted products
|
|
221
|
+
* const topProducts = analytics.topProducts.map(p => ({
|
|
222
|
+
* name: p.product.name,
|
|
223
|
+
* value: p.wishlistCount
|
|
224
|
+
* }));
|
|
225
|
+
*
|
|
226
|
+
* // Funnel - wishlist to purchase
|
|
227
|
+
* const funnel = [
|
|
228
|
+
* { name: 'Wishlisted', value: analytics.conversionFunnel.wishlisted },
|
|
229
|
+
* { name: 'Added to Cart', value: analytics.conversionFunnel.addedToCart },
|
|
230
|
+
* { name: 'Purchased', value: analytics.conversionFunnel.purchased }
|
|
231
|
+
* ];
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
getAnalytics(filter?: DateRangeFilter): Promise<WishlistAnalyticsData>;
|
|
235
|
+
}
|
|
236
|
+
export default WishlistTracking;
|