flowgrid-sdk 1.2.1 → 1.4.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 +221 -250
- package/dist/237.flowgrid.min.js +2 -0
- package/dist/237.flowgrid.min.js.map +1 -0
- package/dist/546.flowgrid.min.js +3 -0
- package/dist/546.flowgrid.min.js.LICENSE.txt +14 -0
- package/dist/546.flowgrid.min.js.map +1 -0
- package/dist/EXAMPLE.d.ts +1 -0
- package/dist/EXAMPLE.js +55 -0
- package/dist/EXAMPLE.js.map +1 -0
- package/dist/browser.d.ts +46 -103
- package/dist/browser.js +102 -0
- package/dist/browser.js.map +1 -0
- package/dist/flowgrid.min.js +1 -1
- package/dist/flowgrid.min.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +64 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/client/transport.d.ts +14 -4
- package/dist/lib/client/transport.js +432 -0
- package/dist/lib/client/transport.js.map +1 -0
- package/dist/lib/consent/index.d.ts +0 -5
- package/dist/lib/consent/index.js +32 -0
- package/dist/lib/consent/index.js.map +1 -0
- package/dist/lib/consent/manager.js +336 -0
- package/dist/lib/consent/manager.js.map +1 -0
- package/dist/lib/consent/types.d.ts +3 -20
- package/dist/lib/consent/types.js +10 -0
- package/dist/lib/consent/types.js.map +1 -0
- package/dist/lib/features/analytics/attribution.d.ts +6 -47
- package/dist/lib/features/analytics/attribution.js +181 -0
- package/dist/lib/features/analytics/attribution.js.map +1 -0
- package/dist/lib/features/analytics/events.d.ts +1 -28
- package/dist/lib/features/analytics/events.js +256 -0
- package/dist/lib/features/analytics/events.js.map +1 -0
- package/dist/lib/features/analytics/funnels.js +260 -0
- package/dist/lib/features/analytics/funnels.js.map +1 -0
- package/dist/lib/features/analytics/heatmaps.d.ts +12 -19
- package/dist/lib/features/analytics/heatmaps.js +258 -0
- package/dist/lib/features/analytics/heatmaps.js.map +1 -0
- package/dist/lib/features/analytics/identify.d.ts +1 -21
- package/dist/lib/features/analytics/identify.js +213 -0
- package/dist/lib/features/analytics/identify.js.map +1 -0
- package/dist/lib/features/analytics/index.d.ts +2 -0
- package/dist/lib/features/analytics/index.js +15 -0
- package/dist/lib/features/analytics/index.js.map +1 -0
- package/dist/lib/features/analytics/page-views.d.ts +13 -30
- package/dist/lib/features/analytics/page-views.js +268 -0
- package/dist/lib/features/analytics/page-views.js.map +1 -0
- package/dist/lib/features/analytics/performance.d.ts +18 -24
- package/dist/lib/features/analytics/performance.js +232 -0
- package/dist/lib/features/analytics/performance.js.map +1 -0
- package/dist/lib/features/analytics/replay.d.ts +170 -0
- package/dist/lib/features/analytics/replay.js +381 -0
- package/dist/lib/features/analytics/replay.js.map +1 -0
- package/dist/lib/features/analytics/retention.d.ts +1 -76
- package/dist/lib/features/analytics/retention.js +135 -0
- package/dist/lib/features/analytics/retention.js.map +1 -0
- package/dist/lib/features/analytics/sessions.d.ts +12 -37
- package/dist/lib/features/analytics/sessions.js +213 -0
- package/dist/lib/features/analytics/sessions.js.map +1 -0
- package/dist/lib/features/core/activation.d.ts +1 -24
- package/dist/lib/features/core/activation.js +175 -0
- package/dist/lib/features/core/activation.js.map +1 -0
- package/dist/lib/features/core/experiment.d.ts +53 -21
- package/dist/lib/features/core/experiment.js +554 -0
- package/dist/lib/features/core/experiment.js.map +1 -0
- package/dist/lib/features/core/index.js +9 -0
- package/dist/lib/features/core/index.js.map +1 -0
- package/dist/lib/features/core/track-feature.d.ts +1 -8
- package/dist/lib/features/core/track-feature.js +119 -0
- package/dist/lib/features/core/track-feature.js.map +1 -0
- package/dist/lib/features/core/track-prompt.d.ts +5 -8
- package/dist/lib/features/core/track-prompt.js +181 -0
- package/dist/lib/features/core/track-prompt.js.map +1 -0
- package/dist/lib/features/ecommerce/cart.d.ts +1 -24
- package/dist/lib/features/ecommerce/cart.js +244 -0
- package/dist/lib/features/ecommerce/cart.js.map +1 -0
- package/dist/lib/features/ecommerce/checkout.d.ts +1 -28
- package/dist/lib/features/ecommerce/checkout.js +254 -0
- package/dist/lib/features/ecommerce/checkout.js.map +1 -0
- package/dist/lib/features/ecommerce/index.d.ts +0 -2
- package/dist/lib/features/ecommerce/index.js +15 -0
- package/dist/lib/features/ecommerce/index.js.map +1 -0
- package/dist/lib/features/ecommerce/ltv.d.ts +1 -69
- package/dist/lib/features/ecommerce/ltv.js +114 -0
- package/dist/lib/features/ecommerce/ltv.js.map +1 -0
- package/dist/lib/features/ecommerce/products.d.ts +1 -33
- package/dist/lib/features/ecommerce/products.js +223 -0
- package/dist/lib/features/ecommerce/products.js.map +1 -0
- package/dist/lib/features/ecommerce/promotions.d.ts +1 -30
- package/dist/lib/features/ecommerce/promotions.js +197 -0
- package/dist/lib/features/ecommerce/promotions.js.map +1 -0
- package/dist/lib/features/ecommerce/purchases.d.ts +1 -48
- package/dist/lib/features/ecommerce/purchases.js +193 -0
- package/dist/lib/features/ecommerce/purchases.js.map +1 -0
- package/dist/lib/features/ecommerce/refunds.d.ts +1 -27
- package/dist/lib/features/ecommerce/refunds.js +195 -0
- package/dist/lib/features/ecommerce/refunds.js.map +1 -0
- package/dist/lib/features/ecommerce/search.d.ts +1 -24
- package/dist/lib/features/ecommerce/search.js +156 -0
- package/dist/lib/features/ecommerce/search.js.map +1 -0
- package/dist/lib/features/ecommerce/subscriptions.d.ts +1 -28
- package/dist/lib/features/ecommerce/subscriptions.js +207 -0
- package/dist/lib/features/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/features/ecommerce/wishlist.d.ts +1 -28
- package/dist/lib/features/ecommerce/wishlist.js +186 -0
- package/dist/lib/features/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/features/enterprise/acquisition.d.ts +2 -57
- package/dist/lib/features/enterprise/acquisition.js +166 -0
- package/dist/lib/features/enterprise/acquisition.js.map +1 -0
- package/dist/lib/features/enterprise/alerts.d.ts +1 -37
- package/dist/lib/features/enterprise/alerts.js +246 -0
- package/dist/lib/features/enterprise/alerts.js.map +1 -0
- package/dist/lib/features/enterprise/churn.d.ts +1 -42
- package/dist/lib/features/enterprise/churn.js +175 -0
- package/dist/lib/features/enterprise/churn.js.map +1 -0
- package/dist/lib/features/enterprise/cohorts.d.ts +1 -37
- package/dist/lib/features/enterprise/cohorts.js +201 -0
- package/dist/lib/features/enterprise/cohorts.js.map +1 -0
- package/dist/lib/features/enterprise/engagement.d.ts +40 -46
- package/dist/lib/features/enterprise/engagement.js +335 -0
- package/dist/lib/features/enterprise/engagement.js.map +1 -0
- package/dist/lib/features/enterprise/forecasting.d.ts +0 -50
- package/dist/lib/features/enterprise/forecasting.js +232 -0
- package/dist/lib/features/enterprise/forecasting.js.map +1 -0
- package/dist/lib/features/enterprise/index.d.ts +1 -1
- package/dist/lib/features/enterprise/index.js +76 -0
- package/dist/lib/features/enterprise/index.js.map +1 -0
- package/dist/lib/features/enterprise/monetization.d.ts +1 -60
- package/dist/lib/features/enterprise/monetization.js +146 -0
- package/dist/lib/features/enterprise/monetization.js.map +1 -0
- package/dist/lib/features/enterprise/multi-path-funnels.d.ts +1 -17
- package/dist/lib/features/enterprise/multi-path-funnels.js +205 -0
- package/dist/lib/features/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/features/enterprise/paths.d.ts +1 -56
- package/dist/lib/features/enterprise/paths.js +149 -0
- package/dist/lib/features/enterprise/paths.js.map +1 -0
- package/dist/lib/features/enterprise/security.d.ts +8 -57
- package/dist/lib/features/enterprise/security.js +202 -0
- package/dist/lib/features/enterprise/security.js.map +1 -0
- package/dist/lib/features/enterprise/support.d.ts +3 -42
- package/dist/lib/features/enterprise/support.js +162 -0
- package/dist/lib/features/enterprise/support.js.map +1 -0
- package/dist/lib/flowgrid.d.ts +278 -0
- package/dist/lib/flowgrid.js +323 -0
- package/dist/lib/flowgrid.js.map +1 -0
- package/dist/lib/frameworks/index.d.ts +13 -6
- package/dist/lib/frameworks/index.js +18 -0
- package/dist/lib/frameworks/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/client.js +355 -0
- package/dist/lib/frameworks/nextjs/client.js.map +1 -0
- package/dist/lib/frameworks/nextjs/index.js +31 -0
- package/dist/lib/frameworks/nextjs/index.js.map +1 -0
- package/dist/lib/frameworks/nextjs/server.js +259 -0
- package/dist/lib/frameworks/nextjs/server.js.map +1 -0
- package/dist/lib/frameworks/node/index.js +391 -0
- package/dist/lib/frameworks/node/index.js.map +1 -0
- package/dist/lib/frameworks/nuxt/index.js +288 -0
- package/dist/lib/frameworks/nuxt/index.js.map +1 -0
- package/dist/lib/frameworks/react/CookieBanner.js +166 -0
- package/dist/lib/frameworks/react/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/react/index.js +271 -0
- package/dist/lib/frameworks/react/index.js.map +1 -0
- package/dist/lib/frameworks/vue/CookieBanner.js +165 -0
- package/dist/lib/frameworks/vue/CookieBanner.js.map +1 -0
- package/dist/lib/frameworks/vue/index.js +390 -0
- package/dist/lib/frameworks/vue/index.js.map +1 -0
- package/dist/lib/tracking/analytics/attribution.d.ts +14 -0
- package/dist/lib/tracking/analytics/attribution.js +18 -0
- package/dist/lib/tracking/analytics/attribution.js.map +1 -0
- package/dist/lib/tracking/analytics/events.d.ts +26 -0
- package/dist/lib/tracking/analytics/events.js +30 -0
- package/dist/lib/tracking/analytics/events.js.map +1 -0
- package/dist/lib/tracking/analytics/funnels.d.ts +16 -0
- package/dist/lib/tracking/analytics/funnels.js +22 -0
- package/dist/lib/tracking/analytics/funnels.js.map +1 -0
- package/dist/lib/tracking/analytics/heatmaps.d.ts +27 -0
- package/dist/lib/tracking/analytics/heatmaps.js +22 -0
- package/dist/lib/tracking/analytics/heatmaps.js.map +1 -0
- package/dist/lib/tracking/analytics/identify.d.ts +16 -0
- package/dist/lib/tracking/analytics/identify.js +22 -0
- package/dist/lib/tracking/analytics/identify.js.map +1 -0
- package/dist/lib/tracking/analytics/index.d.ts +10 -0
- package/dist/lib/tracking/analytics/index.js +11 -0
- package/dist/lib/tracking/analytics/index.js.map +1 -0
- package/dist/lib/tracking/analytics/page-views.d.ts +29 -0
- package/dist/lib/tracking/analytics/page-views.js +50 -0
- package/dist/lib/tracking/analytics/page-views.js.map +1 -0
- package/dist/lib/tracking/analytics/performance.d.ts +22 -0
- package/dist/lib/tracking/analytics/performance.js +22 -0
- package/dist/lib/tracking/analytics/performance.js.map +1 -0
- package/dist/lib/tracking/analytics/replay.d.ts +34 -0
- package/dist/lib/tracking/analytics/replay.js +46 -0
- package/dist/lib/tracking/analytics/replay.js.map +1 -0
- package/dist/lib/tracking/analytics/retention.d.ts +10 -0
- package/dist/lib/tracking/analytics/retention.js +10 -0
- package/dist/lib/tracking/analytics/retention.js.map +1 -0
- package/dist/lib/tracking/analytics/sessions.d.ts +20 -0
- package/dist/lib/tracking/analytics/sessions.js +26 -0
- package/dist/lib/tracking/analytics/sessions.js.map +1 -0
- package/dist/lib/tracking/core/activation.d.ts +23 -0
- package/dist/lib/tracking/core/activation.js +33 -0
- package/dist/lib/tracking/core/activation.js.map +1 -0
- package/dist/lib/tracking/core/experiment.d.ts +122 -0
- package/dist/lib/tracking/core/experiment.js +150 -0
- package/dist/lib/tracking/core/experiment.js.map +1 -0
- package/dist/lib/tracking/core/feature.d.ts +13 -0
- package/dist/lib/tracking/core/feature.js +14 -0
- package/dist/lib/tracking/core/feature.js.map +1 -0
- package/dist/lib/tracking/core/index.d.ts +4 -0
- package/dist/lib/tracking/core/index.js +5 -0
- package/dist/lib/tracking/core/index.js.map +1 -0
- package/dist/lib/tracking/core/prompt.d.ts +18 -0
- package/dist/lib/tracking/core/prompt.js +26 -0
- package/dist/lib/tracking/core/prompt.js.map +1 -0
- package/dist/lib/tracking/ecommerce/cart.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/cart.js +22 -0
- package/dist/lib/tracking/ecommerce/cart.js.map +1 -0
- package/dist/lib/tracking/ecommerce/checkout.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/checkout.js +22 -0
- package/dist/lib/tracking/ecommerce/checkout.js.map +1 -0
- package/dist/lib/tracking/ecommerce/index.d.ts +10 -0
- package/dist/lib/tracking/ecommerce/index.js +11 -0
- package/dist/lib/tracking/ecommerce/index.js.map +1 -0
- package/dist/lib/tracking/ecommerce/ltv.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/ltv.js +14 -0
- package/dist/lib/tracking/ecommerce/ltv.js.map +1 -0
- package/dist/lib/tracking/ecommerce/products.d.ts +15 -0
- package/dist/lib/tracking/ecommerce/products.js +18 -0
- package/dist/lib/tracking/ecommerce/products.js.map +1 -0
- package/dist/lib/tracking/ecommerce/promotions.d.ts +14 -0
- package/dist/lib/tracking/ecommerce/promotions.js +25 -0
- package/dist/lib/tracking/ecommerce/promotions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/purchases.d.ts +11 -0
- package/dist/lib/tracking/ecommerce/purchases.js +10 -0
- package/dist/lib/tracking/ecommerce/purchases.js.map +1 -0
- package/dist/lib/tracking/ecommerce/refunds.d.ts +17 -0
- package/dist/lib/tracking/ecommerce/refunds.js +22 -0
- package/dist/lib/tracking/ecommerce/refunds.js.map +1 -0
- package/dist/lib/tracking/ecommerce/search.d.ts +24 -0
- package/dist/lib/tracking/ecommerce/search.js +22 -0
- package/dist/lib/tracking/ecommerce/search.js.map +1 -0
- package/dist/lib/tracking/ecommerce/subscriptions.d.ts +21 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js +38 -0
- package/dist/lib/tracking/ecommerce/subscriptions.js.map +1 -0
- package/dist/lib/tracking/ecommerce/wishlist.d.ts +19 -0
- package/dist/lib/tracking/ecommerce/wishlist.js +26 -0
- package/dist/lib/tracking/ecommerce/wishlist.js.map +1 -0
- package/dist/lib/tracking/enterprise/acquisition.d.ts +25 -0
- package/dist/lib/tracking/enterprise/acquisition.js +22 -0
- package/dist/lib/tracking/enterprise/acquisition.js.map +1 -0
- package/dist/lib/tracking/enterprise/alerts.d.ts +32 -0
- package/dist/lib/tracking/enterprise/alerts.js +30 -0
- package/dist/lib/tracking/enterprise/alerts.js.map +1 -0
- package/dist/lib/tracking/enterprise/churn.d.ts +23 -0
- package/dist/lib/tracking/enterprise/churn.js +22 -0
- package/dist/lib/tracking/enterprise/churn.js.map +1 -0
- package/dist/lib/tracking/enterprise/cohorts.d.ts +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js +18 -0
- package/dist/lib/tracking/enterprise/cohorts.js.map +1 -0
- package/dist/lib/tracking/enterprise/engagement.d.ts +31 -0
- package/dist/lib/tracking/enterprise/engagement.js +44 -0
- package/dist/lib/tracking/enterprise/engagement.js.map +1 -0
- package/dist/lib/tracking/enterprise/forecasting.d.ts +18 -0
- package/dist/lib/tracking/enterprise/forecasting.js +22 -0
- package/dist/lib/tracking/enterprise/forecasting.js.map +1 -0
- package/dist/lib/tracking/enterprise/index.d.ts +11 -0
- package/dist/lib/tracking/enterprise/index.js +12 -0
- package/dist/lib/tracking/enterprise/index.js.map +1 -0
- package/dist/lib/tracking/enterprise/monetization.d.ts +14 -0
- package/dist/lib/tracking/enterprise/monetization.js +10 -0
- package/dist/lib/tracking/enterprise/monetization.js.map +1 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.d.ts +20 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js +18 -0
- package/dist/lib/tracking/enterprise/multi-path-funnels.js.map +1 -0
- package/dist/lib/tracking/enterprise/paths.d.ts +20 -0
- package/dist/lib/tracking/enterprise/paths.js +18 -0
- package/dist/lib/tracking/enterprise/paths.js.map +1 -0
- package/dist/lib/tracking/enterprise/security.d.ts +28 -0
- package/dist/lib/tracking/enterprise/security.js +26 -0
- package/dist/lib/tracking/enterprise/security.js.map +1 -0
- package/dist/lib/tracking/enterprise/support.d.ts +25 -0
- package/dist/lib/tracking/enterprise/support.js +22 -0
- package/dist/lib/tracking/enterprise/support.js.map +1 -0
- package/dist/lib/tracking/index.d.ts +4 -0
- package/dist/lib/tracking/index.js +5 -0
- package/dist/lib/tracking/index.js.map +1 -0
- package/dist/lib/types/analytics.d.ts +10 -2
- package/dist/lib/types/analytics.js +6 -0
- package/dist/lib/types/analytics.js.map +1 -0
- package/dist/lib/types/common.js +6 -0
- package/dist/lib/types/common.js.map +1 -0
- package/dist/lib/types/ecommerce.js +6 -0
- package/dist/lib/types/ecommerce.js.map +1 -0
- package/dist/lib/types/index.js +8 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/utils/browser.d.ts +16 -0
- package/dist/lib/utils/browser.js +32 -0
- package/dist/lib/utils/browser.js.map +1 -0
- package/dist/lib/utils/identity.js +346 -0
- package/dist/lib/utils/identity.js.map +1 -0
- package/dist/lib/utils/storage.js +105 -0
- package/dist/lib/utils/storage.js.map +1 -0
- package/dist/umd/237.index.js +2 -0
- package/dist/umd/237.index.js.map +1 -0
- package/dist/umd/546.index.js +3 -0
- package/dist/umd/546.index.js.LICENSE.txt +14 -0
- package/dist/umd/546.index.js.map +1 -0
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +27 -80
- package/dist/lib/features/ecommerce/inventory.d.ts +0 -219
package/README.md
CHANGED
|
@@ -1,346 +1,317 @@
|
|
|
1
1
|
# Flowgrid SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/flowgrid-sdk)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/flowgrid-sdk)
|
|
6
|
+
|
|
7
|
+
A production-grade, **framework-agnostic** TypeScript SDK for product analytics,
|
|
8
|
+
ecommerce, experiments, and enterprise insights — with a single unified entry
|
|
9
|
+
point that works in any JavaScript environment (Node, browsers, edge runtimes,
|
|
10
|
+
React, Vue, Next, Nuxt, Svelte, Angular, etc.).
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { FlowGrid } from "flowgrid-sdk";
|
|
14
|
+
|
|
15
|
+
// One line. Sane defaults. Auto-instruments sessions, page views,
|
|
16
|
+
// performance, heatmaps, and attribution out of the box.
|
|
17
|
+
const fg = FlowGrid.init({ webId: "wx_123", apiKey: "pk_xxx" });
|
|
18
|
+
|
|
19
|
+
// Opt in to session replay (rrweb) when you want it:
|
|
20
|
+
FlowGrid.init({
|
|
21
|
+
webId: "wx_123",
|
|
22
|
+
apiKey: "pk_xxx",
|
|
23
|
+
user: { userId: "u_1", traits: { plan: "pro" } },
|
|
24
|
+
replay: { sampleRate: 0.25, maskAllInputs: true },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
await fg.track("signup_completed", { plan: "pro" });
|
|
28
|
+
await fg.experiment("checkout_v2", { variant: "B", userId: "u_1" });
|
|
29
|
+
await fg.products.view({ productId: "sku_1", name: "T-Shirt", price: 29, currency: "USD" });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Highlights
|
|
36
|
+
|
|
37
|
+
- **One class, every feature** — `new FlowGrid(...)` exposes analytics, ecommerce, experiments, and enterprise modules as lazy properties.
|
|
38
|
+
- **Framework-agnostic** — zero peer dependencies. Works with React, Vue, Next.js, Nuxt, Svelte, Astro, plain Node, Cloudflare Workers, etc.
|
|
39
|
+
- **Tree-shake-friendly** — also export individual modules (`Events`, `Products`, `Experiment`, …) for minimal bundles.
|
|
40
|
+
- **Privacy & consent built-in** — DNT/GPC support, `ConsentManager`, bot filtering.
|
|
41
|
+
- **Resilient transport** — retry with exponential backoff, `sendBeacon` fallback, offline `localStorage` buffering, 10KB payload guard.
|
|
42
|
+
- **Identity layer** — visitor + session lifecycle, SSR-safe, backwards-compatible with track.js cookies.
|
|
43
|
+
- **Strict TypeScript** — strong types for every config and response.
|
|
44
|
+
|
|
45
|
+
---
|
|
18
46
|
|
|
19
47
|
## Installation
|
|
20
48
|
|
|
21
49
|
```bash
|
|
22
50
|
npm install flowgrid-sdk
|
|
51
|
+
# or
|
|
52
|
+
pnpm add flowgrid-sdk
|
|
53
|
+
# or
|
|
54
|
+
yarn add flowgrid-sdk
|
|
23
55
|
```
|
|
24
56
|
|
|
57
|
+
Requires Node `>= 18.12`. No peer dependencies.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
25
61
|
## Quick Start
|
|
26
62
|
|
|
27
|
-
###
|
|
63
|
+
### Unified client (recommended)
|
|
28
64
|
|
|
29
|
-
|
|
65
|
+
```ts
|
|
66
|
+
import { FlowGrid } from "flowgrid-sdk";
|
|
30
67
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
endpoint: 'https://api.flow-grid.xyz',
|
|
37
|
-
apiKey: 'key_xxx',
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
```
|
|
68
|
+
const fg = new FlowGrid(
|
|
69
|
+
"web_123", // webId
|
|
70
|
+
"https://core.flow-grid.xyz", // endpoint
|
|
71
|
+
"key_xxx" // apiKey
|
|
72
|
+
);
|
|
41
73
|
|
|
42
|
-
|
|
74
|
+
// Analytics
|
|
75
|
+
await fg.pageViews.track({ url: "/pricing", title: "Pricing" });
|
|
76
|
+
await fg.events.track({ eventName: "cta_click", properties: { id: "hero" } });
|
|
77
|
+
await fg.identify.identify({ userId: "u_1", traits: { plan: "pro" } });
|
|
43
78
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await events.track({ eventName: 'signup', properties: { plan: 'pro' } });
|
|
79
|
+
// Ecommerce
|
|
80
|
+
await fg.cart.addItem({
|
|
81
|
+
product: { productId: "sku_1", name: "Widget", price: 29.99, currency: "USD" },
|
|
82
|
+
quantity: 1,
|
|
83
|
+
cartId: "cart_abc",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Experiments
|
|
87
|
+
const variant = await fg.experiments.assign({
|
|
88
|
+
experimentId: "checkout_v2",
|
|
89
|
+
userId: "u_1",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Enterprise
|
|
93
|
+
await fg.churn.score({ userId: "u_1" });
|
|
60
94
|
```
|
|
61
95
|
|
|
62
|
-
|
|
96
|
+
Available namespaces on `FlowGrid`:
|
|
63
97
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
98
|
+
| Group | Properties |
|
|
99
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| Core | `activation`, `features`, `prompts`, `experiments` |
|
|
101
|
+
| Analytics | `pageViews`, `sessions`, `events`, `identify`, `funnels`, `retention`, `attribution`, `heatmaps`, `performance`, `replay` |
|
|
102
|
+
| Ecommerce | `products`, `cart`, `checkout`, `purchases`, `refunds`, `promotions`, `wishlist`, `ltv`, `search`, `subscriptions` |
|
|
103
|
+
| Enterprise | `engagement`, `cohorts`, `churn`, `monetization`, `multiPathFunnels`, `support`, `acquisition`, `paths`, `alerts`, `security`, `forecasting` |
|
|
67
104
|
|
|
68
|
-
|
|
105
|
+
### Direct module imports (tree-shaking)
|
|
69
106
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<FlowGridProvider webId="web_123" endpoint="https://api.flow-grid.xyz" apiKey="key_xxx">
|
|
73
|
-
<MyApp />
|
|
74
|
-
<CookieBanner consent={consent} config={{ title: 'We use cookies' }} />
|
|
75
|
-
</FlowGridProvider>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
107
|
+
```ts
|
|
108
|
+
import { Events, Products } from "flowgrid-sdk";
|
|
78
109
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return <button onClick={() => trackEvent('cta_click')}>Go</button>;
|
|
82
|
-
}
|
|
110
|
+
const events = new Events("web_123", "https://core.flow-grid.xyz", "key_xxx");
|
|
111
|
+
await events.track({ eventName: "signup", properties: { plan: "pro" } });
|
|
83
112
|
```
|
|
84
113
|
|
|
85
|
-
###
|
|
114
|
+
### Browser script tag (CMS / no-build)
|
|
86
115
|
|
|
87
|
-
```
|
|
88
|
-
<script
|
|
89
|
-
|
|
90
|
-
|
|
116
|
+
```html
|
|
117
|
+
<script src="https://cdn.flow-grid.xyz/flowgrid.min.js"></script>
|
|
118
|
+
<script>
|
|
119
|
+
FlowGrid.init({
|
|
120
|
+
webId: "web_abc123",
|
|
121
|
+
apiKey: "key_xxx",
|
|
122
|
+
});
|
|
91
123
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
124
|
+
FlowGrid.track("signup_clicked", { placement: "hero" });
|
|
125
|
+
FlowGrid.identify("user_123", { plan: "pro" });
|
|
126
|
+
FlowGrid.productView({ productId: "sku_1", name: "T-Shirt", price: 29 });
|
|
127
|
+
FlowGrid.addToCart({ productId: "sku_1", name: "T-Shirt", price: 29 }, 1);
|
|
95
128
|
</script>
|
|
96
|
-
|
|
97
|
-
<template>
|
|
98
|
-
<button @click="trackEvent('cta_click')">Go</button>
|
|
99
|
-
<CookieBanner :consent="consent" :config="{ title: 'Cookie Preferences' }" />
|
|
100
|
-
</template>
|
|
101
129
|
```
|
|
102
130
|
|
|
103
|
-
|
|
131
|
+
The script-tag API is intentionally small: `init`, `track`, `page`, `identify`,
|
|
132
|
+
`experiment`, `productView`, `addToCart`, `purchase`, consent helpers, and
|
|
133
|
+
`instance()` for the full SDK. `FlowGrid.init()` auto-instruments sessions, page
|
|
134
|
+
views, SPA route changes, scroll depth, time on page, performance, heatmaps,
|
|
135
|
+
and attribution by default; session replay is opt-in with `replay: true`.
|
|
104
136
|
|
|
105
|
-
|
|
106
|
-
// app/layout.tsx
|
|
107
|
-
import { FlowGridProvider, PageViewTracker, CookieBanner } from 'flowgrid-sdk/nextjs/client';
|
|
108
|
-
import { ConsentManager } from 'flowgrid-sdk';
|
|
137
|
+
---
|
|
109
138
|
|
|
110
|
-
|
|
139
|
+
## Session Replay
|
|
140
|
+
|
|
141
|
+
Replay is opt-in and browser-only. It uses `rrweb` dynamically, records DOM/input/scroll/mouse events, and sends sequenced chunks to core with `call=replay_chunk`.
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
const fg = FlowGrid.init({
|
|
145
|
+
webId: "wx_123",
|
|
146
|
+
apiKey: "pk_xxx",
|
|
147
|
+
user: { userId: "u_1" },
|
|
148
|
+
replay: {
|
|
149
|
+
sampleRate: 0.25,
|
|
150
|
+
maskAllInputs: true,
|
|
151
|
+
flushIntervalMs: 5000,
|
|
152
|
+
flushBytes: 512 * 1024,
|
|
153
|
+
onFlush: ({ sessionId, sequence, eventsCount }) => {
|
|
154
|
+
console.debug("replay chunk", sessionId, sequence, eventsCount);
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
111
158
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<PageViewTracker />
|
|
116
|
-
{children}
|
|
117
|
-
<CookieBanner consent={consent} />
|
|
118
|
-
</FlowGridProvider>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
159
|
+
fg.replay.identify("u_1");
|
|
160
|
+
await fg.replay.flush();
|
|
161
|
+
fg.replay.stop();
|
|
121
162
|
```
|
|
122
163
|
|
|
123
|
-
|
|
164
|
+
Manual lifecycle control is available when you do not want init-time recording:
|
|
124
165
|
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|
|
166
|
+
```ts
|
|
167
|
+
const stop = await fg.replay.start({ sampleRate: 1, maskAllInputs: true });
|
|
168
|
+
const status = fg.replay.status();
|
|
128
169
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
await fg.events.track({ eventName: 'server_event', properties: {} });
|
|
132
|
-
return Response.json({ ok: true });
|
|
133
|
-
}
|
|
170
|
+
await fg.replay.flush("manual");
|
|
171
|
+
stop();
|
|
134
172
|
```
|
|
135
173
|
|
|
136
|
-
|
|
174
|
+
Each replay chunk includes the core ingestion fields `web_id`, `visitor_id`, `session_id`, `sequence`, `started_at`, `captured_at`, `events`, plus replay metadata such as `page_url`, `idempotency_key`, `compression`, `is_final`, `privacy`, `flush_reason`, `dropped_events`, and `recorder_version`.
|
|
137
175
|
|
|
138
|
-
|
|
139
|
-
// plugins/flowgrid.client.ts
|
|
140
|
-
import { FlowGridPlugin } from 'flowgrid-sdk/nuxt';
|
|
176
|
+
---
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
nuxtApp.vueApp.use(FlowGridPlugin, {
|
|
144
|
-
webId: useRuntimeConfig().public.flowgridWebId,
|
|
145
|
-
endpoint: useRuntimeConfig().public.flowgridEndpoint,
|
|
146
|
-
apiKey: useRuntimeConfig().public.flowgridApiKey,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
```
|
|
178
|
+
## Server-side / Edge Usage
|
|
150
179
|
|
|
151
|
-
|
|
152
|
-
<script setup>
|
|
153
|
-
import { CookieBanner } from 'flowgrid-sdk/nuxt';
|
|
154
|
-
import { ConsentManager } from 'flowgrid-sdk';
|
|
155
|
-
const consent = new ConsentManager();
|
|
156
|
-
</script>
|
|
157
|
-
<template>
|
|
158
|
-
<CookieBanner :consent="consent" />
|
|
159
|
-
</template>
|
|
160
|
-
```
|
|
180
|
+
Works in any JavaScript runtime that supports `fetch` — Node, Bun, Deno, Cloudflare Workers, Vercel Edge, etc.
|
|
161
181
|
|
|
162
|
-
|
|
182
|
+
```ts
|
|
183
|
+
// app/api/track/route.ts (Next.js example, but works anywhere)
|
|
184
|
+
import { FlowGrid } from "flowgrid-sdk";
|
|
163
185
|
|
|
164
|
-
|
|
165
|
-
import { createFlowGridNode } from 'flowgrid-sdk/node';
|
|
186
|
+
const fg = new FlowGrid("web_123", "https://core.flow-grid.xyz", process.env.FG_API_KEY!);
|
|
166
187
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
await fg.
|
|
188
|
+
export async function POST(req: Request) {
|
|
189
|
+
const { userId } = await req.json();
|
|
190
|
+
await fg.events.track({ eventName: "server_event", properties: { userId } });
|
|
191
|
+
return Response.json({ ok: true });
|
|
192
|
+
}
|
|
170
193
|
```
|
|
171
194
|
|
|
195
|
+
For Node-style batch jobs, simply create a `FlowGrid` instance, fire your tracking calls, and let the process exit — events use `sendBeacon`/`fetch` and a localStorage-style buffer for resilience.
|
|
196
|
+
|
|
172
197
|
---
|
|
173
198
|
|
|
174
|
-
## Cookie Consent
|
|
199
|
+
## Cookie Consent
|
|
175
200
|
|
|
176
|
-
The SDK ships a framework-agnostic `ConsentManager
|
|
201
|
+
The SDK ships a framework-agnostic `ConsentManager`. Render your own banner UI in whatever framework you use, and call into the manager to persist preferences.
|
|
177
202
|
|
|
178
|
-
```
|
|
179
|
-
import { ConsentManager } from
|
|
203
|
+
```ts
|
|
204
|
+
import { ConsentManager, FlowGridTransport } from "flowgrid-sdk";
|
|
180
205
|
|
|
181
206
|
const consent = new ConsentManager({
|
|
182
|
-
cookieDomain:
|
|
207
|
+
cookieDomain: ".example.com",
|
|
183
208
|
cookieExpiry: 365,
|
|
184
209
|
respectDNT: true,
|
|
185
210
|
onChange: (prefs) => {
|
|
186
|
-
|
|
211
|
+
FlowGridTransport.setConsent({
|
|
212
|
+
analytics: prefs.analytics,
|
|
213
|
+
marketing: prefs.marketing,
|
|
214
|
+
});
|
|
187
215
|
},
|
|
188
216
|
});
|
|
189
217
|
|
|
190
|
-
// Programmatic control
|
|
191
218
|
consent.acceptAll();
|
|
192
219
|
consent.rejectNonEssential();
|
|
193
220
|
consent.update({ analytics: true, marketing: false, preferences: true });
|
|
194
|
-
consent.hasCategory(
|
|
195
|
-
consent.reset();
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Banner Configuration
|
|
199
|
-
|
|
200
|
-
All banner components accept the same config:
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
{
|
|
204
|
-
title: 'Cookie Preferences',
|
|
205
|
-
description: 'We use cookies to improve your experience.',
|
|
206
|
-
privacyPolicyUrl: '/privacy',
|
|
207
|
-
acceptAllLabel: 'Accept All',
|
|
208
|
-
rejectAllLabel: 'Reject All',
|
|
209
|
-
customizeLabel: 'Customize',
|
|
210
|
-
saveLabel: 'Save Preferences',
|
|
211
|
-
forceShow: false,
|
|
212
|
-
categoryDescriptions: {
|
|
213
|
-
necessary: 'Required for the site to function.',
|
|
214
|
-
analytics: 'Help us understand how you use the site.',
|
|
215
|
-
marketing: 'Used to show relevant ads.',
|
|
216
|
-
preferences: 'Remember your settings.',
|
|
217
|
-
},
|
|
218
|
-
theme: {
|
|
219
|
-
position: 'bottom', // 'top' | 'bottom' | 'bottom-left' | 'bottom-right' | 'center'
|
|
220
|
-
primaryColor: '#4F46E5',
|
|
221
|
-
backgroundColor: '#FFFFFF',
|
|
222
|
-
textColor: '#1F2937',
|
|
223
|
-
fontFamily: 'system-ui, sans-serif',
|
|
224
|
-
borderRadius: '12px',
|
|
225
|
-
zIndex: 9999,
|
|
226
|
-
},
|
|
227
|
-
}
|
|
221
|
+
consent.hasCategory("analytics"); // boolean
|
|
222
|
+
consent.reset();
|
|
228
223
|
```
|
|
229
224
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
## CMS / No-Build Integration
|
|
225
|
+
`CookieBannerConfig` and `CookieBannerTheme` types are exported from `flowgrid-sdk/consent` if you want a typed config object to pass to your own banner component.
|
|
233
226
|
|
|
234
|
-
|
|
227
|
+
You can also gate the transport directly without `ConsentManager`:
|
|
235
228
|
|
|
236
|
-
|
|
229
|
+
```ts
|
|
230
|
+
import { FlowGridTransport } from "flowgrid-sdk";
|
|
237
231
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
echo '<script src="https://cdn.flow-grid.xyz/flowgrid.min.js"></script>';
|
|
241
|
-
echo '<script>FlowGrid.init({ webId: "web_123", endpoint: "https://api.flow-grid.xyz", apiKey: "key_xxx" });</script>';
|
|
242
|
-
}
|
|
243
|
-
add_action('wp_footer', 'flowgrid_tracking');
|
|
232
|
+
FlowGridTransport.setConsent({ analytics: true, marketing: false });
|
|
233
|
+
FlowGridTransport.hasConsent("analytics"); // true
|
|
244
234
|
```
|
|
245
235
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
Site Settings → Custom Code → Add `<script>` tag to body end.
|
|
249
|
-
|
|
250
|
-
### Bubble
|
|
251
|
-
|
|
252
|
-
Settings → SEO/Meta Tags → Script in body.
|
|
253
|
-
|
|
254
|
-
### Webflow / Squarespace
|
|
255
|
-
|
|
256
|
-
Project Settings → Custom Code → Footer Code.
|
|
257
|
-
|
|
258
|
-
### Goal Tracking
|
|
236
|
+
---
|
|
259
237
|
|
|
260
|
-
|
|
238
|
+
## Identity & Storage Helpers
|
|
261
239
|
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
|
|
240
|
+
```ts
|
|
241
|
+
import {
|
|
242
|
+
FlowGrid,
|
|
243
|
+
IdentityManager,
|
|
244
|
+
getVisitorId,
|
|
245
|
+
getSessionId,
|
|
246
|
+
getWebId,
|
|
247
|
+
getUTM,
|
|
248
|
+
getUTMHistory,
|
|
249
|
+
} from "flowgrid-sdk";
|
|
250
|
+
|
|
251
|
+
const identity = new IdentityManager({ cookieDomain: ".example.com" });
|
|
252
|
+
const visitorId = identity.getVisitorId();
|
|
253
|
+
|
|
254
|
+
// Pass to FlowGrid for shared identity across modules
|
|
255
|
+
const fg = new FlowGrid(
|
|
256
|
+
"web_123",
|
|
257
|
+
"https://core.flow-grid.xyz",
|
|
258
|
+
"key_xxx",
|
|
259
|
+
visitorId,
|
|
260
|
+
identity
|
|
261
|
+
);
|
|
265
262
|
```
|
|
266
263
|
|
|
267
264
|
---
|
|
268
265
|
|
|
269
|
-
##
|
|
266
|
+
## Package Exports
|
|
270
267
|
|
|
271
|
-
|
|
272
|
-
|
|
268
|
+
| Import path | Description |
|
|
269
|
+
| -------------------------- | ------------------------------------------------ |
|
|
270
|
+
| `flowgrid-sdk` | Unified `FlowGrid` class + every feature module |
|
|
271
|
+
| `flowgrid-sdk/analytics` | Analytics modules only |
|
|
272
|
+
| `flowgrid-sdk/ecommerce` | Ecommerce modules only |
|
|
273
|
+
| `flowgrid-sdk/core` | Core modules (activation, experiments, prompts) |
|
|
274
|
+
| `flowgrid-sdk/consent` | `ConsentManager` + types |
|
|
275
|
+
| `flowgrid-sdk/types` | Shared TypeScript type definitions |
|
|
273
276
|
|
|
274
|
-
|
|
275
|
-
const cart = new CartTracking('web_123', endpoint, apiKey);
|
|
277
|
+
---
|
|
276
278
|
|
|
277
|
-
|
|
278
|
-
await products.view({ productId: 'sku_1', name: 'Widget', price: 29.99, currency: 'USD' });
|
|
279
|
+
## Configuration
|
|
279
280
|
|
|
280
|
-
|
|
281
|
-
await cart.addItem({
|
|
282
|
-
product: { productId: 'sku_1', name: 'Widget', price: 29.99, currency: 'USD' },
|
|
283
|
-
quantity: 2,
|
|
284
|
-
cartId: 'cart_abc',
|
|
285
|
-
});
|
|
281
|
+
The transport accepts an optional `FlowGridTransportConfig` as its 6th argument:
|
|
286
282
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
items: [{ productId: 'sku_1', name: 'Widget', price: 29.99, quantity: 2, lineTotal: 59.98, currency: 'USD' }],
|
|
293
|
-
subtotal: 59.98,
|
|
294
|
-
total: 64.98,
|
|
295
|
-
currency: 'USD',
|
|
296
|
-
},
|
|
283
|
+
```ts
|
|
284
|
+
new FlowGrid(webId, endpoint, apiKey, visitorId, identityManager, {
|
|
285
|
+
botDetection: "block", // "block" | "tag" | "disabled"
|
|
286
|
+
respectDNT: true, // honour Do-Not-Track / GPC
|
|
287
|
+
sampleRate: 1.0, // 0.0 – 1.0
|
|
297
288
|
});
|
|
298
289
|
```
|
|
299
290
|
|
|
300
|
-
|
|
291
|
+
Defaults: `botDetection: "block"`, `respectDNT: true`, `sampleRate: 1.0`.
|
|
301
292
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
```typescript
|
|
305
|
-
import { FeatureFlagsClient } from 'flowgrid-sdk';
|
|
293
|
+
---
|
|
306
294
|
|
|
307
|
-
|
|
308
|
-
await flags.initialize({ id: 'user_123', country: 'US', plan: 'pro' });
|
|
295
|
+
## Scripts
|
|
309
296
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
297
|
+
```bash
|
|
298
|
+
npm run build # tsc + webpack production build
|
|
299
|
+
npm run build:browser # browser UMD bundle (flowgrid.min.js)
|
|
300
|
+
npm run build:all # both
|
|
301
|
+
npm run build:types # emit .d.ts only
|
|
302
|
+
npm test # run audit-fixes test suite
|
|
314
303
|
```
|
|
315
304
|
|
|
316
305
|
---
|
|
317
306
|
|
|
318
|
-
## Package Exports
|
|
319
|
-
|
|
320
|
-
| Import Path | Description |
|
|
321
|
-
|---|---|
|
|
322
|
-
| `flowgrid-sdk` | All modules |
|
|
323
|
-
| `flowgrid-sdk/react` | React provider, hooks, CookieBanner |
|
|
324
|
-
| `flowgrid-sdk/vue` | Vue plugin, composables, CookieBanner |
|
|
325
|
-
| `flowgrid-sdk/nextjs` | Next.js integration |
|
|
326
|
-
| `flowgrid-sdk/nextjs/client` | Client components (provider, hooks, CookieBanner) |
|
|
327
|
-
| `flowgrid-sdk/nextjs/server` | Server-side tracking |
|
|
328
|
-
| `flowgrid-sdk/nuxt` | Nuxt plugin, composables, CookieBanner |
|
|
329
|
-
| `flowgrid-sdk/node` | Node.js-only (batch + flush) |
|
|
330
|
-
| `flowgrid-sdk/analytics` | Analytics features only |
|
|
331
|
-
| `flowgrid-sdk/ecommerce` | Ecommerce features only |
|
|
332
|
-
| `flowgrid-sdk/core` | Core features (activation, experiments) |
|
|
333
|
-
| `flowgrid-sdk/consent` | Consent management |
|
|
334
|
-
| `flowgrid-sdk/types` | TypeScript type definitions |
|
|
335
|
-
|
|
336
307
|
## Documentation
|
|
337
308
|
|
|
338
|
-
|
|
309
|
+
Full reference: <https://flow-grid.xyz/documentation>
|
|
339
310
|
|
|
340
311
|
## Contributing
|
|
341
312
|
|
|
342
|
-
|
|
313
|
+
Issues and PRs welcome on [GitHub](https://github.com/FrostXk9/flowgrid-sdk).
|
|
343
314
|
|
|
344
315
|
## License
|
|
345
316
|
|
|
346
|
-
MIT
|
|
317
|
+
MIT © Brandon Roulstone
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkflowgrid=this.webpackChunkflowgrid||[]).push([[237],{237(e,t,n){n.d(t,{onCLS:()=>E,onFCP:()=>L,onINP:()=>x,onLCP:()=>D,onTTFB:()=>W});let i=-1;const r=e=>{addEventListener("pageshow",t=>{t.persisted&&(i=t.timeStamp,e(t))},!0)},s=(e,t,n,i)=>{let r,s;return o=>{t.value>=0&&(o||i)&&(s=t.value-(r??0),(s||void 0===r)&&(r=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},a=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>a()?.activationStart??0,l=(e,t=-1)=>{const n=a();let r="navigate";return i>=0?r="back-forward-cache":n&&(document.prerendering||c()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},d=new WeakMap;function h(e,t){return d.get(e)||d.set(e,new t),d.get(e)}class u{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const p=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return i.observe({type:e,buffered:!0,...n}),i}}catch{}},m=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let f=-1;const g=new Set,v=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,T=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of g)e();isFinite(f)||(f="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",T,!0))}},y=()=>{if(f<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;f=t??v(),addEventListener("visibilitychange",T,!0),addEventListener("prerenderingchange",T,!0),r(()=>{setTimeout(()=>{f=v()})})}return{get firstHiddenTime(){return f},onHidden(e){g.add(e)}}},C=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},b=[1800,3e3],L=(e,t={})=>{C(()=>{const n=y();let i,a=l("FCP");const d=p("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(d.disconnect(),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-c(),0),a.entries.push(t),i(!0)))});d&&(i=s(e,a,b,t.reportAllChanges),r(n=>{a=l("FCP"),i=s(e,a,b,t.reportAllChanges),o(()=>{a.value=performance.now()-n.timeStamp,i(!0)})}))})},w=[.1,.25],E=(e,t={})=>{const n=y();L(m(()=>{let i,a=l("CLS",0);const c=h(t,u),d=e=>{for(const t of e)c.h(t);c.i>a.value&&(a.value=c.i,a.entries=c.o,i())},m=p("layout-shift",d);m&&(i=s(e,a,w,t.reportAllChanges),n.onHidden(()=>{d(m.takeRecords()),i(!0)}),r(()=>{c.i=0,a=l("CLS",0),i=s(e,a,w,t.reportAllChanges),o(i)}),setTimeout(i))}))};let S=0,k=1/0,A=0;const I=e=>{for(const t of e)t.interactionId&&(k=Math.min(k,t.interactionId),A=Math.max(A,t.interactionId),S=A?(A-k)/7+1:0)};let P;const M=()=>P?S:performance.interactionCount??0;let F=0;class H{l=[];u=new Map;m;p;v(){F=M(),this.l.length=0,this.u.clear()}T(){const e=Math.min(this.l.length-1,Math.floor((M()-F)/50));return this.l[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.l.at(-1);let n=this.u.get(e.interactionId);if(n||this.l.length<10||e.duration>t.L){if(n?e.duration>n.L?(n.entries=[e],n.L=e.duration):e.duration===n.L&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],L:e.duration},this.u.set(n.id,n),this.l.push(n)),this.l.sort((e,t)=>t.L-e.L),this.l.length>10){const e=this.l.splice(10);for(const t of e)this.u.delete(t.id)}this.p?.(n)}}}const B=e=>{const t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const i=m(e);let r=-1;const s=()=>{n(r),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),r=t(()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()})}},q=[200,500],x=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=y();C(()=>{"interactionCount"in performance||P||(P=p("event",I,{durationThreshold:0}));let i,o=l("INP");const a=h(t,H),c=e=>{B(()=>{for(const t of e)a.h(t);const t=a.T();t&&t.L!==o.value&&(o.value=t.L,o.entries=t.entries,i())})},d=p("event",c,{durationThreshold:t.durationThreshold??40});i=s(e,o,q,t.reportAllChanges),d&&(d.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{c(d.takeRecords()),i(!0)}),r(()=>{a.v(),o=l("INP"),i=s(e,o,q,t.reportAllChanges)}))})};class R{m;h(e){this.m?.(e)}}const N=[2500,4e3],D=(e,t={})=>{C(()=>{const n=y();let i,a=l("LCP");const d=h(t,R),u=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)d.h(t),t.startTime<n.firstHiddenTime&&(a.value=Math.max(t.startTime-c(),0),a.entries=[t],i())},f=p("largest-contentful-paint",u);if(f){i=s(e,a,N,t.reportAllChanges);const n=m(()=>{u(f.takeRecords()),f.disconnect(),i(!0)}),c=e=>{e.isTrusted&&(B(n),removeEventListener(e.type,c,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,c,{capture:!0});r(n=>{a=l("LCP"),i=s(e,a,N,t.reportAllChanges),o(()=>{a.value=performance.now()-n.timeStamp,i(!0)})})}})},O=[800,1800],$=e=>{document.prerendering?C(()=>$(e)):"complete"!==document.readyState?addEventListener("load",()=>$(e),!0):setTimeout(e)},W=(e,t={})=>{let n=l("TTFB"),i=s(e,n,O,t.reportAllChanges);$(()=>{const o=a();o&&(n.value=Math.max(o.responseStart-c(),0),n.entries=[o],i(!0),r(()=>{n=l("TTFB",0),i=s(e,n,O,t.reportAllChanges),i(!0)}))})}}}]);
|
|
2
|
+
//# sourceMappingURL=237.flowgrid.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"237.flowgrid.min.js","mappings":"qKAAA,IAAIA,GAAG,EAAE,MAAMC,EAAEA,IAAIC,iBAAiB,WAAWC,IAAIA,EAAEC,YAAYJ,EAAEG,EAAEE,UAAUJ,EAAEE,MAAK,IAAKA,EAAE,CAACH,EAAEC,EAAEE,EAAEG,KAAK,IAAIC,EAAEC,EAAE,OAAOC,IAAIR,EAAES,OAAO,IAAID,GAAGH,KAAKE,EAAEP,EAAES,OAAOH,GAAG,IAAIC,QAAQ,IAAID,KAAKA,EAAEN,EAAES,MAAMT,EAAEU,MAAMH,EAAEP,EAAEW,OAAO,EAAEZ,EAAEC,IAAID,EAAEC,EAAE,GAAG,OAAOD,EAAEC,EAAE,GAAG,oBAAoB,OAAjD,CAAyDA,EAAES,MAAMP,GAAGH,EAAEC,OAAOK,EAAEN,IAAIa,sBAAsB,IAAIA,sBAAsBb,KAAKO,EAAE,KAAK,MAAMP,EAAEc,YAAYC,iBAAiB,cAAc,GAAG,GAAGf,GAAGA,EAAEgB,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O4B,EAAElC,EAAEH,EAAEoD,EAAEuD,EAAEpG,EAAEiE,kBAAkBlE,EAAE,KAAK8C,EAAE1C,MAAMI,YAAYG,MAAMhB,EAAEI,UAAUgC,GAAE,MAAO,KAAK0E,EAAE,CAAC,IAAI,MAAMC,EAAEhH,IAAImB,SAASC,aAAa+C,EAAE,IAAI6C,EAAEhH,IAAI,aAAamB,SAAS8F,WAAW/G,iBAAiB,OAAO,IAAI8G,EAAEhH,IAAG,GAAI+D,WAAW/D,IAAIkH,EAAE,CAAClH,EAAEM,EAAE,CAAC,KAAK,IAAI0B,EAAEvB,EAAE,QAAQyB,EAAE/B,EAAEH,EAAEgC,EAAE+E,EAAEzG,EAAEkE,kBAAkBwC,EAAE,KAAK,MAAM3E,EAAE9B,IAAI8B,IAAIL,EAAEtB,MAAMkB,KAAK2C,IAAIlC,EAAErB,cAAcR,IAAI,GAAGwB,EAAEP,QAAQ,CAACY,GAAGH,GAAE,GAAIjC,EAAE,KAAK+B,EAAEvB,EAAE,OAAO,GAAGyB,EAAE/B,EAAEH,EAAEgC,EAAE+E,EAAEzG,EAAEkE,kBAAkBtC,GAAE,Q","sources":["webpack://flowgrid/./node_modules/web-vitals/dist/web-vitals.js"],"sourcesContent":["let e=-1;const t=t=>{addEventListener(\"pageshow\",n=>{n.persisted&&(e=n.timeStamp,t(n))},!0)},n=(e,t,n,i)=>{let s,o;return r=>{t.value>=0&&(r||i)&&(o=t.value-(s??0),(o||void 0===s)&&(s=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?\"poor\":e>t[0]?\"needs-improvement\":\"good\")(t.value,n),e(t)))}},i=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},s=()=>{const e=performance.getEntriesByType(\"navigation\")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},o=()=>s()?.activationStart??0,r=(t,n=-1)=>{const i=s();let r=\"navigate\";e>=0?r=\"back-forward-cache\":i&&(document.prerendering||o()>0?r=\"prerender\":document.wasDiscarded?r=\"restore\":i.type&&(r=i.type.replace(/_/g,\"-\")));return{name:t,value:n,rating:\"good\",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},c=new WeakMap;function a(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class d{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const h=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return i.observe({type:e,buffered:!0,...n}),i}}catch{}},f=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let l=-1;const u=new Set,m=()=>\"hidden\"!==document.visibilityState||document.prerendering?1/0:0,g=e=>{if(\"hidden\"===document.visibilityState){if(\"visibilitychange\"===e.type)for(const e of u)e();isFinite(l)||(l=\"visibilitychange\"===e.type?e.timeStamp:0,removeEventListener(\"prerenderingchange\",g,!0))}},p=()=>{if(l<0){const e=o(),n=document.prerendering?void 0:globalThis.performance.getEntriesByType(\"visibility-state\").find(t=>\"hidden\"===t.name&&t.startTime>=e)?.startTime;l=n??m(),addEventListener(\"visibilitychange\",g,!0),addEventListener(\"prerenderingchange\",g,!0),t(()=>{setTimeout(()=>{l=m()})})}return{get firstHiddenTime(){return l},onHidden(e){u.add(e)}}},v=e=>{document.prerendering?addEventListener(\"prerenderingchange\",e,!0):e()},y=[1800,3e3],T=(e,s={})=>{v(()=>{const c=p();let a,d=r(\"FCP\");const f=h(\"paint\",e=>{for(const t of e)\"first-contentful-paint\"===t.name&&(f.disconnect(),t.startTime<c.firstHiddenTime&&(d.value=Math.max(t.startTime-o(),0),d.entries.push(t),a(!0)))});f&&(a=n(e,d,y,s.reportAllChanges),t(t=>{d=r(\"FCP\"),a=n(e,d,y,s.reportAllChanges),i(()=>{d.value=performance.now()-t.timeStamp,a(!0)})}))})},E=[.1,.25],b=(e,s={})=>{const o=p();T(f(()=>{let c,f=r(\"CLS\",0);const l=a(s,d),u=e=>{for(const t of e)l.h(t);l.i>f.value&&(f.value=l.i,f.entries=l.o,c())},m=h(\"layout-shift\",u);m&&(c=n(e,f,E,s.reportAllChanges),o.onHidden(()=>{u(m.takeRecords()),c(!0)}),t(()=>{l.i=0,f=r(\"CLS\",0),c=n(e,f,E,s.reportAllChanges),i(c)}),setTimeout(c))}))};let L=0,P=1/0,_=0;const M=e=>{for(const t of e)t.interactionId&&(P=Math.min(P,t.interactionId),_=Math.max(_,t.interactionId),L=_?(_-P)/7+1:0)};let w;const C=()=>w?L:performance.interactionCount??0,I=()=>{\"interactionCount\"in performance||w||(w=h(\"event\",M,{durationThreshold:0}))};let F=0;class k{l=[];u=new Map;m;p;v(){F=C(),this.l.length=0,this.u.clear()}T(){const e=Math.min(this.l.length-1,Math.floor((C()-F)/50));return this.l[e]}h(e){if(this.m?.(e),!e.interactionId&&\"first-input\"!==e.entryType)return;const t=this.l.at(-1);let n=this.u.get(e.interactionId);if(n||this.l.length<10||e.duration>t.L){if(n?e.duration>n.L?(n.entries=[e],n.L=e.duration):e.duration===n.L&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],L:e.duration},this.u.set(n.id,n),this.l.push(n)),this.l.sort((e,t)=>t.L-e.L),this.l.length>10){const e=this.l.splice(10);for(const t of e)this.u.delete(t.id)}this.p?.(n)}}}const A=e=>{const t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(\"hidden\"===document.visibilityState)e();else{const i=f(e);let s=-1;const o=()=>{n(s),i()};addEventListener(\"visibilitychange\",o,{once:!0,capture:!0}),s=t(()=>{removeEventListener(\"visibilitychange\",o,{capture:!0}),i()})}},B=[200,500],S=(e,i={})=>{if(!globalThis.PerformanceEventTiming||!(\"interactionId\"in PerformanceEventTiming.prototype))return;const s=p();v(()=>{I();let o,c=r(\"INP\");const d=a(i,k),f=e=>{A(()=>{for(const t of e)d.h(t);const t=d.T();t&&t.L!==c.value&&(c.value=t.L,c.entries=t.entries,o())})},l=h(\"event\",f,{durationThreshold:i.durationThreshold??40});o=n(e,c,B,i.reportAllChanges),l&&(l.observe({type:\"first-input\",buffered:!0}),s.onHidden(()=>{f(l.takeRecords()),o(!0)}),t(()=>{d.v(),c=r(\"INP\"),o=n(e,c,B,i.reportAllChanges)}))})};class q{m;h(e){this.m?.(e)}}const N=[2500,4e3],x=(e,s={})=>{v(()=>{const c=p();let d,l=r(\"LCP\");const u=a(s,q),m=e=>{s.reportAllChanges||(e=e.slice(-1));for(const t of e)u.h(t),t.startTime<c.firstHiddenTime&&(l.value=Math.max(t.startTime-o(),0),l.entries=[t],d())},g=h(\"largest-contentful-paint\",m);if(g){d=n(e,l,N,s.reportAllChanges);const o=f(()=>{m(g.takeRecords()),g.disconnect(),d(!0)}),c=e=>{e.isTrusted&&(A(o),removeEventListener(e.type,c,{capture:!0}))};for(const e of[\"keydown\",\"click\",\"visibilitychange\"])addEventListener(e,c,{capture:!0});t(t=>{l=r(\"LCP\"),d=n(e,l,N,s.reportAllChanges),i(()=>{l.value=performance.now()-t.timeStamp,d(!0)})})}})},H=[800,1800],O=e=>{document.prerendering?v(()=>O(e)):\"complete\"!==document.readyState?addEventListener(\"load\",()=>O(e),!0):setTimeout(e)},$=(e,i={})=>{let c=r(\"TTFB\"),a=n(e,c,H,i.reportAllChanges);O(()=>{const d=s();d&&(c.value=Math.max(d.responseStart-o(),0),c.entries=[d],a(!0),t(()=>{c=r(\"TTFB\",0),a=n(e,c,H,i.reportAllChanges),a(!0)}))})};export{E as CLSThresholds,y as FCPThresholds,B as INPThresholds,N as LCPThresholds,H as TTFBThresholds,b as onCLS,T as onFCP,S as onINP,x as onLCP,$ as onTTFB};\n"],"names":["e","t","addEventListener","n","persisted","timeStamp","i","s","o","r","value","delta","rating","requestAnimationFrame","performance","getEntriesByType","responseStart","now","activationStart","document","prerendering","wasDiscarded","type","replace","name","entries","id","Date","Math","floor","random","navigationType","c","WeakMap","a","get","set","d","h","hadRecentInput","this","at","startTime","push","PerformanceObserver","supportedEntryTypes","includes","queueMicrotask","getEntries","observe","buffered","f","l","u","Set","m","visibilityState","g","isFinite","removeEventListener","p","globalThis","find","setTimeout","firstHiddenTime","onHidden","add","v","y","T","disconnect","max","reportAllChanges","E","b","takeRecords","L","P","_","M","interactionId","min","w","C","interactionCount","F","k","Map","length","clear","entryType","duration","sort","splice","delete","A","requestIdleCallback","cancelIdleCallback","clearTimeout","once","capture","B","S","PerformanceEventTiming","prototype","durationThreshold","q","N","x","slice","isTrusted","H","O","readyState","$"],"sourceRoot":""}
|