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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/dist/browser.d.ts +119 -0
  3. package/dist/flowgrid.min.js +2 -0
  4. package/dist/flowgrid.min.js.map +1 -0
  5. package/dist/index.d.ts +44 -0
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lib/client/enterprise-ftrpc.d.ts +51 -0
  9. package/dist/lib/client/ftrpc.d.ts +43 -0
  10. package/dist/lib/client/modules.d.ts +104 -0
  11. package/dist/lib/features/analytics/attribution.d.ts +257 -0
  12. package/dist/lib/features/analytics/events.d.ts +304 -0
  13. package/dist/lib/features/analytics/funnels.d.ts +291 -0
  14. package/dist/lib/features/analytics/heatmaps.d.ts +247 -0
  15. package/dist/lib/features/analytics/identify.d.ts +273 -0
  16. package/dist/lib/features/analytics/index.d.ts +22 -0
  17. package/dist/lib/features/analytics/page-views.d.ts +250 -0
  18. package/dist/lib/features/analytics/performance.d.ts +281 -0
  19. package/dist/lib/features/analytics/retention.d.ts +294 -0
  20. package/dist/lib/features/analytics/sessions.d.ts +277 -0
  21. package/dist/lib/features/core/activation.d.ts +239 -0
  22. package/dist/lib/features/core/experiment.d.ts +286 -0
  23. package/dist/lib/features/core/feature-flag.d.ts +264 -0
  24. package/dist/lib/features/core/index.d.ts +14 -0
  25. package/dist/lib/features/core/track-feature.d.ts +220 -0
  26. package/dist/lib/features/core/track-prompt.d.ts +247 -0
  27. package/dist/lib/features/ecommerce/cart.d.ts +298 -0
  28. package/dist/lib/features/ecommerce/checkout.d.ts +324 -0
  29. package/dist/lib/features/ecommerce/index.d.ts +26 -0
  30. package/dist/lib/features/ecommerce/inventory.d.ts +221 -0
  31. package/dist/lib/features/ecommerce/ltv.d.ts +258 -0
  32. package/dist/lib/features/ecommerce/products.d.ts +268 -0
  33. package/dist/lib/features/ecommerce/promotions.d.ts +266 -0
  34. package/dist/lib/features/ecommerce/purchases.d.ts +287 -0
  35. package/dist/lib/features/ecommerce/refunds.d.ts +232 -0
  36. package/dist/lib/features/ecommerce/search.d.ts +225 -0
  37. package/dist/lib/features/ecommerce/subscriptions.d.ts +281 -0
  38. package/dist/lib/features/ecommerce/wishlist.d.ts +236 -0
  39. package/dist/lib/features/enterprise/acquisition.d.ts +373 -0
  40. package/dist/lib/features/enterprise/alerts.d.ts +348 -0
  41. package/dist/lib/features/enterprise/churn.d.ts +288 -0
  42. package/dist/lib/features/enterprise/cohorts.d.ts +270 -0
  43. package/dist/lib/features/enterprise/engagement.d.ts +233 -0
  44. package/dist/lib/features/enterprise/forecasting.d.ts +351 -0
  45. package/dist/lib/features/enterprise/index.d.ts +20 -0
  46. package/dist/lib/features/enterprise/monetization.d.ts +356 -0
  47. package/dist/lib/features/enterprise/multi-path-funnels.d.ts +327 -0
  48. package/dist/lib/features/enterprise/paths.d.ts +332 -0
  49. package/dist/lib/features/enterprise/security.d.ts +387 -0
  50. package/dist/lib/features/enterprise/support.d.ts +329 -0
  51. package/dist/lib/frameworks/index.d.ts +9 -0
  52. package/dist/lib/frameworks/nextjs/client.d.ts +208 -0
  53. package/dist/lib/frameworks/nextjs/index.d.ts +29 -0
  54. package/dist/lib/frameworks/nextjs/server.d.ts +201 -0
  55. package/dist/lib/frameworks/node/index.d.ts +265 -0
  56. package/dist/lib/frameworks/nuxt/index.d.ts +190 -0
  57. package/dist/lib/frameworks/react/index.d.ts +245 -0
  58. package/dist/lib/frameworks/vue/index.d.ts +275 -0
  59. package/dist/lib/types/analytics.d.ts +365 -0
  60. package/dist/lib/types/common.d.ts +230 -0
  61. package/dist/lib/types/ecommerce.d.ts +309 -0
  62. package/dist/lib/types/index.d.ts +7 -0
  63. package/dist/lib/utils/functions.d.ts +1 -0
  64. package/package.json +139 -0
@@ -0,0 +1,309 @@
1
+ /**
2
+ * @fileoverview Type definitions for ecommerce tracking.
3
+ * @module types/ecommerce
4
+ */
5
+ import { CurrencyCode, MoneyValue, TimeSeriesData } from './common';
6
+ /**
7
+ * Product information for tracking.
8
+ */
9
+ export interface Product {
10
+ /** Unique product identifier (SKU or ID) */
11
+ productId: string;
12
+ /** Product name */
13
+ name: string;
14
+ /** Product brand */
15
+ brand?: string;
16
+ /** Product category (can be nested with /) */
17
+ category?: string;
18
+ /** Product variant (size, color, etc.) */
19
+ variant?: string;
20
+ /** Unit price */
21
+ price: number;
22
+ /** Currency code */
23
+ currency: CurrencyCode | string;
24
+ /** Quantity */
25
+ quantity?: number;
26
+ /** Discount amount applied */
27
+ discount?: number;
28
+ /** Coupon code applied */
29
+ coupon?: string;
30
+ /** Position in a list (for impressions) */
31
+ position?: number;
32
+ /** Product URL */
33
+ url?: string;
34
+ /** Product image URL */
35
+ imageUrl?: string;
36
+ /** Product rating (0-5) */
37
+ rating?: number;
38
+ /** Number of reviews */
39
+ reviewCount?: number;
40
+ /** Stock status */
41
+ stockStatus?: 'in_stock' | 'out_of_stock' | 'limited' | 'preorder' | 'backorder';
42
+ /** Custom attributes */
43
+ attributes?: Record<string, string | number | boolean>;
44
+ }
45
+ /**
46
+ * Product list/collection information.
47
+ */
48
+ export interface ProductList {
49
+ /** List identifier */
50
+ listId: string;
51
+ /** List name (e.g., "Search Results", "Featured Products") */
52
+ listName: string;
53
+ /** Products in the list */
54
+ products: Product[];
55
+ }
56
+ /**
57
+ * Cart item with product and quantity.
58
+ */
59
+ export interface CartItem extends Product {
60
+ /** Quantity in cart */
61
+ quantity: number;
62
+ /** Line item total (price * quantity - discount) */
63
+ lineTotal: number;
64
+ }
65
+ /**
66
+ * Shopping cart state.
67
+ */
68
+ export interface Cart {
69
+ /** Cart identifier */
70
+ cartId: string;
71
+ /** Items in cart */
72
+ items: CartItem[];
73
+ /** Cart subtotal (before discounts/shipping/tax) */
74
+ subtotal: number;
75
+ /** Total discount amount */
76
+ discountTotal: number;
77
+ /** Shipping cost */
78
+ shippingTotal?: number;
79
+ /** Tax amount */
80
+ taxTotal?: number;
81
+ /** Cart grand total */
82
+ total: number;
83
+ /** Currency code */
84
+ currency: CurrencyCode | string;
85
+ /** Number of items */
86
+ itemCount: number;
87
+ /** Applied coupon codes */
88
+ coupons?: string[];
89
+ }
90
+ /**
91
+ * Shipping information.
92
+ */
93
+ export interface ShippingInfo {
94
+ /** Shipping method (e.g., "standard", "express", "overnight") */
95
+ method: string;
96
+ /** Shipping carrier */
97
+ carrier?: string;
98
+ /** Shipping cost */
99
+ cost: number;
100
+ /** Estimated delivery date */
101
+ estimatedDelivery?: string;
102
+ /** Tracking number */
103
+ trackingNumber?: string;
104
+ }
105
+ /**
106
+ * Payment information (non-sensitive).
107
+ */
108
+ export interface PaymentInfo {
109
+ /** Payment method (e.g., "credit_card", "paypal", "apple_pay") */
110
+ method: string;
111
+ /** Payment provider */
112
+ provider?: string;
113
+ /** Last 4 digits of card (if applicable) */
114
+ cardLast4?: string;
115
+ /** Card brand (if applicable) */
116
+ cardBrand?: string;
117
+ }
118
+ /**
119
+ * Order/transaction information.
120
+ */
121
+ export interface Order {
122
+ /** Unique order/transaction ID */
123
+ orderId: string;
124
+ /** Order items */
125
+ items: CartItem[];
126
+ /** Order subtotal */
127
+ subtotal: number;
128
+ /** Discount total */
129
+ discountTotal: number;
130
+ /** Shipping total */
131
+ shippingTotal: number;
132
+ /** Tax total */
133
+ taxTotal: number;
134
+ /** Order grand total */
135
+ total: number;
136
+ /** Currency code */
137
+ currency: CurrencyCode | string;
138
+ /** Shipping information */
139
+ shipping?: ShippingInfo;
140
+ /** Payment information */
141
+ payment?: PaymentInfo;
142
+ /** Applied coupon codes */
143
+ coupons?: string[];
144
+ /** Affiliate/referral code */
145
+ affiliation?: string;
146
+ /** Order status */
147
+ status?: 'pending' | 'processing' | 'shipped' | 'delivered' | 'cancelled' | 'refunded';
148
+ /** Order creation timestamp */
149
+ createdAt?: string;
150
+ }
151
+ /**
152
+ * Refund information.
153
+ */
154
+ export interface Refund {
155
+ /** Original order ID */
156
+ orderId: string;
157
+ /** Refund ID */
158
+ refundId: string;
159
+ /** Items being refunded */
160
+ items?: CartItem[];
161
+ /** Refund amount */
162
+ amount: number;
163
+ /** Currency code */
164
+ currency: CurrencyCode | string;
165
+ /** Refund reason */
166
+ reason?: string;
167
+ /** Whether it's a full refund */
168
+ isFullRefund: boolean;
169
+ }
170
+ /**
171
+ * Checkout step identifiers.
172
+ */
173
+ export type CheckoutStep = 'view_cart' | 'begin_checkout' | 'add_shipping_info' | 'add_payment_info' | 'review_order' | 'purchase';
174
+ /**
175
+ * Checkout progress information.
176
+ */
177
+ export interface CheckoutProgress {
178
+ /** Current step */
179
+ step: CheckoutStep;
180
+ /** Step number (1-indexed) */
181
+ stepNumber: number;
182
+ /** Cart state at this step */
183
+ cart: Cart;
184
+ /** Optional checkout option (e.g., selected shipping method) */
185
+ option?: string;
186
+ }
187
+ /**
188
+ * Promotion/coupon information.
189
+ */
190
+ export interface Promotion {
191
+ /** Promotion ID */
192
+ promotionId: string;
193
+ /** Promotion name */
194
+ name: string;
195
+ /** Creative/banner name */
196
+ creative?: string;
197
+ /** Position of the promotion */
198
+ position?: string;
199
+ /** Discount type */
200
+ discountType?: 'percentage' | 'fixed' | 'free_shipping' | 'buy_x_get_y';
201
+ /** Discount value */
202
+ discountValue?: number;
203
+ /** Minimum order value */
204
+ minimumOrderValue?: number;
205
+ /** Valid from date */
206
+ validFrom?: string;
207
+ /** Valid until date */
208
+ validUntil?: string;
209
+ }
210
+ /**
211
+ * Wishlist item.
212
+ */
213
+ export interface WishlistItem extends Product {
214
+ /** Date added to wishlist */
215
+ addedAt: string;
216
+ /** Priority level */
217
+ priority?: 'high' | 'medium' | 'low';
218
+ /** Notes */
219
+ notes?: string;
220
+ }
221
+ /**
222
+ * Wishlist state.
223
+ */
224
+ export interface Wishlist {
225
+ /** Wishlist ID */
226
+ wishlistId: string;
227
+ /** Wishlist name */
228
+ name?: string;
229
+ /** Items in wishlist */
230
+ items: WishlistItem[];
231
+ /** Whether the wishlist is public */
232
+ isPublic?: boolean;
233
+ }
234
+ /**
235
+ * Revenue metrics for dashboards.
236
+ */
237
+ export interface RevenueMetrics {
238
+ /** Total revenue */
239
+ totalRevenue: MoneyValue;
240
+ /** Average order value */
241
+ averageOrderValue: MoneyValue;
242
+ /** Number of orders */
243
+ orderCount: number;
244
+ /** Number of items sold */
245
+ itemsSold: number;
246
+ /** Refund total */
247
+ refundTotal: MoneyValue;
248
+ /** Net revenue (total - refunds) */
249
+ netRevenue: MoneyValue;
250
+ /** Revenue by time period */
251
+ revenueTimeSeries: TimeSeriesData;
252
+ }
253
+ /**
254
+ * Conversion funnel metrics.
255
+ */
256
+ export interface ConversionFunnel {
257
+ /** Product views */
258
+ productViews: number;
259
+ /** Add to cart events */
260
+ addToCarts: number;
261
+ /** Checkout initiations */
262
+ checkoutStarts: number;
263
+ /** Completed purchases */
264
+ purchases: number;
265
+ /** View to cart rate */
266
+ viewToCartRate: number;
267
+ /** Cart to checkout rate */
268
+ cartToCheckoutRate: number;
269
+ /** Checkout to purchase rate */
270
+ checkoutToPurchaseRate: number;
271
+ /** Overall conversion rate */
272
+ overallConversionRate: number;
273
+ }
274
+ /**
275
+ * Product performance metrics.
276
+ */
277
+ export interface ProductPerformance {
278
+ /** Product information */
279
+ product: Pick<Product, 'productId' | 'name' | 'category' | 'brand'>;
280
+ /** Number of views */
281
+ views: number;
282
+ /** Add to cart count */
283
+ addToCarts: number;
284
+ /** Purchase count */
285
+ purchases: number;
286
+ /** Total revenue generated */
287
+ revenue: MoneyValue;
288
+ /** Conversion rate (views to purchases) */
289
+ conversionRate: number;
290
+ /** Cart abandonment rate */
291
+ cartAbandonmentRate: number;
292
+ }
293
+ /**
294
+ * Cart analytics.
295
+ */
296
+ export interface CartAnalytics {
297
+ /** Total active carts */
298
+ activeCarts: number;
299
+ /** Average cart value */
300
+ averageCartValue: MoneyValue;
301
+ /** Cart abandonment rate */
302
+ abandonmentRate: number;
303
+ /** Average items per cart */
304
+ averageItemsPerCart: number;
305
+ /** Top abandoned products */
306
+ topAbandonedProducts: Array<Pick<Product, 'productId' | 'name'> & {
307
+ count: number;
308
+ }>;
309
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fileoverview Central export for all FlowGrid SDK types.
3
+ * @module types
4
+ */
5
+ export * from './common';
6
+ export * from './ecommerce';
7
+ export * from './analytics';
@@ -0,0 +1 @@
1
+ export declare function _0x7777(): string;
package/package.json ADDED
@@ -0,0 +1,139 @@
1
+ {
2
+ "name": "flowgrid-sdk",
3
+ "version": "1.0.0",
4
+ "description": "A TypeScript SDK for tracking user events, feature usage, experiments, and feature flags with Flowgrid.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./react": {
15
+ "types": "./dist/lib/frameworks/react/index.d.ts",
16
+ "import": "./dist/lib/frameworks/react/index.mjs",
17
+ "require": "./dist/lib/frameworks/react/index.js"
18
+ },
19
+ "./vue": {
20
+ "types": "./dist/lib/frameworks/vue/index.d.ts",
21
+ "import": "./dist/lib/frameworks/vue/index.mjs",
22
+ "require": "./dist/lib/frameworks/vue/index.js"
23
+ },
24
+ "./nextjs": {
25
+ "types": "./dist/lib/frameworks/nextjs/index.d.ts",
26
+ "import": "./dist/lib/frameworks/nextjs/index.mjs",
27
+ "require": "./dist/lib/frameworks/nextjs/index.js"
28
+ },
29
+ "./nextjs/client": {
30
+ "types": "./dist/lib/frameworks/nextjs/client.d.ts",
31
+ "import": "./dist/lib/frameworks/nextjs/client.mjs",
32
+ "require": "./dist/lib/frameworks/nextjs/client.js"
33
+ },
34
+ "./nextjs/server": {
35
+ "types": "./dist/lib/frameworks/nextjs/server.d.ts",
36
+ "import": "./dist/lib/frameworks/nextjs/server.mjs",
37
+ "require": "./dist/lib/frameworks/nextjs/server.js"
38
+ },
39
+ "./nuxt": {
40
+ "types": "./dist/lib/frameworks/nuxt/index.d.ts",
41
+ "import": "./dist/lib/frameworks/nuxt/index.mjs",
42
+ "require": "./dist/lib/frameworks/nuxt/index.js"
43
+ },
44
+ "./node": {
45
+ "types": "./dist/lib/frameworks/node/index.d.ts",
46
+ "import": "./dist/lib/frameworks/node/index.mjs",
47
+ "require": "./dist/lib/frameworks/node/index.js"
48
+ },
49
+ "./analytics": {
50
+ "types": "./dist/lib/features/analytics/index.d.ts",
51
+ "import": "./dist/lib/features/analytics/index.mjs",
52
+ "require": "./dist/lib/features/analytics/index.js"
53
+ },
54
+ "./ecommerce": {
55
+ "types": "./dist/lib/features/ecommerce/index.d.ts",
56
+ "import": "./dist/lib/features/ecommerce/index.mjs",
57
+ "require": "./dist/lib/features/ecommerce/index.js"
58
+ },
59
+ "./core": {
60
+ "types": "./dist/lib/features/core/index.d.ts",
61
+ "import": "./dist/lib/features/core/index.mjs",
62
+ "require": "./dist/lib/features/core/index.js"
63
+ },
64
+ "./types": {
65
+ "types": "./dist/lib/types/index.d.ts",
66
+ "import": "./dist/lib/types/index.mjs",
67
+ "require": "./dist/lib/types/index.js"
68
+ }
69
+ },
70
+ "scripts": {
71
+ "build": "webpack --mode production && tsc --emitDeclarationOnly",
72
+ "build:browser": "webpack --config webpack.browser.config.js",
73
+ "build:all": "npm run build && npm run build:browser",
74
+ "build:types": "tsc --emitDeclarationOnly",
75
+ "test": "echo \"No tests specified\" && exit 0",
76
+ "lint": "echo \"No linting configured\" && exit 0",
77
+ "prepublishOnly": "npm run build:all"
78
+ },
79
+ "keywords": [
80
+ "sdk",
81
+ "analytics",
82
+ "tracking",
83
+ "flowgrid",
84
+ "events",
85
+ "feature-flags",
86
+ "experiments",
87
+ "ecommerce",
88
+ "product-analytics",
89
+ "react",
90
+ "vue",
91
+ "nextjs",
92
+ "nuxt",
93
+ "nodejs"
94
+ ],
95
+ "author": "Brandon Roulstone",
96
+ "license": "MIT",
97
+ "repository": {
98
+ "type": "git",
99
+ "url": "https://github.com/FrostXk9/flowgrid-sdk"
100
+ },
101
+ "bugs": {
102
+ "url": "https://github.com/FrostXk9/flowgrid-sdk/issues"
103
+ },
104
+ "homepage": "https://github.com/FrostXk9/flowgrid-sdk#readme",
105
+ "peerDependencies": {
106
+ "next": ">=13.0.0",
107
+ "react": ">=17.0.0",
108
+ "react-dom": ">=17.0.0",
109
+ "vue": ">=3.0.0"
110
+ },
111
+ "peerDependenciesMeta": {
112
+ "react": {
113
+ "optional": true
114
+ },
115
+ "react-dom": {
116
+ "optional": true
117
+ },
118
+ "vue": {
119
+ "optional": true
120
+ },
121
+ "next": {
122
+ "optional": true
123
+ }
124
+ },
125
+ "devDependencies": {
126
+ "@types/jest": "^30.0.0",
127
+ "@types/node": "^25.2.1",
128
+ "@types/react": "^18.0.0",
129
+ "react": "^18.3.1",
130
+ "ts-loader": "^9.5.1",
131
+ "typescript": "^5.9.2",
132
+ "vue": "^3.5.27",
133
+ "webpack": "^5.105.0",
134
+ "webpack-cli": "^6.0.1"
135
+ },
136
+ "engines": {
137
+ "node": ">=18.12.0"
138
+ }
139
+ }