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.
Files changed (312) hide show
  1. package/README.md +221 -250
  2. package/dist/237.flowgrid.min.js +2 -0
  3. package/dist/237.flowgrid.min.js.map +1 -0
  4. package/dist/546.flowgrid.min.js +3 -0
  5. package/dist/546.flowgrid.min.js.LICENSE.txt +14 -0
  6. package/dist/546.flowgrid.min.js.map +1 -0
  7. package/dist/EXAMPLE.d.ts +1 -0
  8. package/dist/EXAMPLE.js +55 -0
  9. package/dist/EXAMPLE.js.map +1 -0
  10. package/dist/browser.d.ts +46 -103
  11. package/dist/browser.js +102 -0
  12. package/dist/browser.js.map +1 -0
  13. package/dist/flowgrid.min.js +1 -1
  14. package/dist/flowgrid.min.js.map +1 -1
  15. package/dist/index.d.ts +7 -8
  16. package/dist/index.js +64 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/lib/client/transport.d.ts +14 -4
  19. package/dist/lib/client/transport.js +432 -0
  20. package/dist/lib/client/transport.js.map +1 -0
  21. package/dist/lib/consent/index.d.ts +0 -5
  22. package/dist/lib/consent/index.js +32 -0
  23. package/dist/lib/consent/index.js.map +1 -0
  24. package/dist/lib/consent/manager.js +336 -0
  25. package/dist/lib/consent/manager.js.map +1 -0
  26. package/dist/lib/consent/types.d.ts +3 -20
  27. package/dist/lib/consent/types.js +10 -0
  28. package/dist/lib/consent/types.js.map +1 -0
  29. package/dist/lib/features/analytics/attribution.d.ts +6 -47
  30. package/dist/lib/features/analytics/attribution.js +181 -0
  31. package/dist/lib/features/analytics/attribution.js.map +1 -0
  32. package/dist/lib/features/analytics/events.d.ts +1 -28
  33. package/dist/lib/features/analytics/events.js +256 -0
  34. package/dist/lib/features/analytics/events.js.map +1 -0
  35. package/dist/lib/features/analytics/funnels.js +260 -0
  36. package/dist/lib/features/analytics/funnels.js.map +1 -0
  37. package/dist/lib/features/analytics/heatmaps.d.ts +12 -19
  38. package/dist/lib/features/analytics/heatmaps.js +258 -0
  39. package/dist/lib/features/analytics/heatmaps.js.map +1 -0
  40. package/dist/lib/features/analytics/identify.d.ts +1 -21
  41. package/dist/lib/features/analytics/identify.js +213 -0
  42. package/dist/lib/features/analytics/identify.js.map +1 -0
  43. package/dist/lib/features/analytics/index.d.ts +2 -0
  44. package/dist/lib/features/analytics/index.js +15 -0
  45. package/dist/lib/features/analytics/index.js.map +1 -0
  46. package/dist/lib/features/analytics/page-views.d.ts +13 -30
  47. package/dist/lib/features/analytics/page-views.js +268 -0
  48. package/dist/lib/features/analytics/page-views.js.map +1 -0
  49. package/dist/lib/features/analytics/performance.d.ts +18 -24
  50. package/dist/lib/features/analytics/performance.js +232 -0
  51. package/dist/lib/features/analytics/performance.js.map +1 -0
  52. package/dist/lib/features/analytics/replay.d.ts +170 -0
  53. package/dist/lib/features/analytics/replay.js +381 -0
  54. package/dist/lib/features/analytics/replay.js.map +1 -0
  55. package/dist/lib/features/analytics/retention.d.ts +1 -76
  56. package/dist/lib/features/analytics/retention.js +135 -0
  57. package/dist/lib/features/analytics/retention.js.map +1 -0
  58. package/dist/lib/features/analytics/sessions.d.ts +12 -37
  59. package/dist/lib/features/analytics/sessions.js +213 -0
  60. package/dist/lib/features/analytics/sessions.js.map +1 -0
  61. package/dist/lib/features/core/activation.d.ts +1 -24
  62. package/dist/lib/features/core/activation.js +175 -0
  63. package/dist/lib/features/core/activation.js.map +1 -0
  64. package/dist/lib/features/core/experiment.d.ts +53 -21
  65. package/dist/lib/features/core/experiment.js +554 -0
  66. package/dist/lib/features/core/experiment.js.map +1 -0
  67. package/dist/lib/features/core/index.js +9 -0
  68. package/dist/lib/features/core/index.js.map +1 -0
  69. package/dist/lib/features/core/track-feature.d.ts +1 -8
  70. package/dist/lib/features/core/track-feature.js +119 -0
  71. package/dist/lib/features/core/track-feature.js.map +1 -0
  72. package/dist/lib/features/core/track-prompt.d.ts +5 -8
  73. package/dist/lib/features/core/track-prompt.js +181 -0
  74. package/dist/lib/features/core/track-prompt.js.map +1 -0
  75. package/dist/lib/features/ecommerce/cart.d.ts +1 -24
  76. package/dist/lib/features/ecommerce/cart.js +244 -0
  77. package/dist/lib/features/ecommerce/cart.js.map +1 -0
  78. package/dist/lib/features/ecommerce/checkout.d.ts +1 -28
  79. package/dist/lib/features/ecommerce/checkout.js +254 -0
  80. package/dist/lib/features/ecommerce/checkout.js.map +1 -0
  81. package/dist/lib/features/ecommerce/index.d.ts +0 -2
  82. package/dist/lib/features/ecommerce/index.js +15 -0
  83. package/dist/lib/features/ecommerce/index.js.map +1 -0
  84. package/dist/lib/features/ecommerce/ltv.d.ts +1 -69
  85. package/dist/lib/features/ecommerce/ltv.js +114 -0
  86. package/dist/lib/features/ecommerce/ltv.js.map +1 -0
  87. package/dist/lib/features/ecommerce/products.d.ts +1 -33
  88. package/dist/lib/features/ecommerce/products.js +223 -0
  89. package/dist/lib/features/ecommerce/products.js.map +1 -0
  90. package/dist/lib/features/ecommerce/promotions.d.ts +1 -30
  91. package/dist/lib/features/ecommerce/promotions.js +197 -0
  92. package/dist/lib/features/ecommerce/promotions.js.map +1 -0
  93. package/dist/lib/features/ecommerce/purchases.d.ts +1 -48
  94. package/dist/lib/features/ecommerce/purchases.js +193 -0
  95. package/dist/lib/features/ecommerce/purchases.js.map +1 -0
  96. package/dist/lib/features/ecommerce/refunds.d.ts +1 -27
  97. package/dist/lib/features/ecommerce/refunds.js +195 -0
  98. package/dist/lib/features/ecommerce/refunds.js.map +1 -0
  99. package/dist/lib/features/ecommerce/search.d.ts +1 -24
  100. package/dist/lib/features/ecommerce/search.js +156 -0
  101. package/dist/lib/features/ecommerce/search.js.map +1 -0
  102. package/dist/lib/features/ecommerce/subscriptions.d.ts +1 -28
  103. package/dist/lib/features/ecommerce/subscriptions.js +207 -0
  104. package/dist/lib/features/ecommerce/subscriptions.js.map +1 -0
  105. package/dist/lib/features/ecommerce/wishlist.d.ts +1 -28
  106. package/dist/lib/features/ecommerce/wishlist.js +186 -0
  107. package/dist/lib/features/ecommerce/wishlist.js.map +1 -0
  108. package/dist/lib/features/enterprise/acquisition.d.ts +2 -57
  109. package/dist/lib/features/enterprise/acquisition.js +166 -0
  110. package/dist/lib/features/enterprise/acquisition.js.map +1 -0
  111. package/dist/lib/features/enterprise/alerts.d.ts +1 -37
  112. package/dist/lib/features/enterprise/alerts.js +246 -0
  113. package/dist/lib/features/enterprise/alerts.js.map +1 -0
  114. package/dist/lib/features/enterprise/churn.d.ts +1 -42
  115. package/dist/lib/features/enterprise/churn.js +175 -0
  116. package/dist/lib/features/enterprise/churn.js.map +1 -0
  117. package/dist/lib/features/enterprise/cohorts.d.ts +1 -37
  118. package/dist/lib/features/enterprise/cohorts.js +201 -0
  119. package/dist/lib/features/enterprise/cohorts.js.map +1 -0
  120. package/dist/lib/features/enterprise/engagement.d.ts +40 -46
  121. package/dist/lib/features/enterprise/engagement.js +335 -0
  122. package/dist/lib/features/enterprise/engagement.js.map +1 -0
  123. package/dist/lib/features/enterprise/forecasting.d.ts +0 -50
  124. package/dist/lib/features/enterprise/forecasting.js +232 -0
  125. package/dist/lib/features/enterprise/forecasting.js.map +1 -0
  126. package/dist/lib/features/enterprise/index.d.ts +1 -1
  127. package/dist/lib/features/enterprise/index.js +76 -0
  128. package/dist/lib/features/enterprise/index.js.map +1 -0
  129. package/dist/lib/features/enterprise/monetization.d.ts +1 -60
  130. package/dist/lib/features/enterprise/monetization.js +146 -0
  131. package/dist/lib/features/enterprise/monetization.js.map +1 -0
  132. package/dist/lib/features/enterprise/multi-path-funnels.d.ts +1 -17
  133. package/dist/lib/features/enterprise/multi-path-funnels.js +205 -0
  134. package/dist/lib/features/enterprise/multi-path-funnels.js.map +1 -0
  135. package/dist/lib/features/enterprise/paths.d.ts +1 -56
  136. package/dist/lib/features/enterprise/paths.js +149 -0
  137. package/dist/lib/features/enterprise/paths.js.map +1 -0
  138. package/dist/lib/features/enterprise/security.d.ts +8 -57
  139. package/dist/lib/features/enterprise/security.js +202 -0
  140. package/dist/lib/features/enterprise/security.js.map +1 -0
  141. package/dist/lib/features/enterprise/support.d.ts +3 -42
  142. package/dist/lib/features/enterprise/support.js +162 -0
  143. package/dist/lib/features/enterprise/support.js.map +1 -0
  144. package/dist/lib/flowgrid.d.ts +278 -0
  145. package/dist/lib/flowgrid.js +323 -0
  146. package/dist/lib/flowgrid.js.map +1 -0
  147. package/dist/lib/frameworks/index.d.ts +13 -6
  148. package/dist/lib/frameworks/index.js +18 -0
  149. package/dist/lib/frameworks/index.js.map +1 -0
  150. package/dist/lib/frameworks/nextjs/client.js +355 -0
  151. package/dist/lib/frameworks/nextjs/client.js.map +1 -0
  152. package/dist/lib/frameworks/nextjs/index.js +31 -0
  153. package/dist/lib/frameworks/nextjs/index.js.map +1 -0
  154. package/dist/lib/frameworks/nextjs/server.js +259 -0
  155. package/dist/lib/frameworks/nextjs/server.js.map +1 -0
  156. package/dist/lib/frameworks/node/index.js +391 -0
  157. package/dist/lib/frameworks/node/index.js.map +1 -0
  158. package/dist/lib/frameworks/nuxt/index.js +288 -0
  159. package/dist/lib/frameworks/nuxt/index.js.map +1 -0
  160. package/dist/lib/frameworks/react/CookieBanner.js +166 -0
  161. package/dist/lib/frameworks/react/CookieBanner.js.map +1 -0
  162. package/dist/lib/frameworks/react/index.js +271 -0
  163. package/dist/lib/frameworks/react/index.js.map +1 -0
  164. package/dist/lib/frameworks/vue/CookieBanner.js +165 -0
  165. package/dist/lib/frameworks/vue/CookieBanner.js.map +1 -0
  166. package/dist/lib/frameworks/vue/index.js +390 -0
  167. package/dist/lib/frameworks/vue/index.js.map +1 -0
  168. package/dist/lib/tracking/analytics/attribution.d.ts +14 -0
  169. package/dist/lib/tracking/analytics/attribution.js +18 -0
  170. package/dist/lib/tracking/analytics/attribution.js.map +1 -0
  171. package/dist/lib/tracking/analytics/events.d.ts +26 -0
  172. package/dist/lib/tracking/analytics/events.js +30 -0
  173. package/dist/lib/tracking/analytics/events.js.map +1 -0
  174. package/dist/lib/tracking/analytics/funnels.d.ts +16 -0
  175. package/dist/lib/tracking/analytics/funnels.js +22 -0
  176. package/dist/lib/tracking/analytics/funnels.js.map +1 -0
  177. package/dist/lib/tracking/analytics/heatmaps.d.ts +27 -0
  178. package/dist/lib/tracking/analytics/heatmaps.js +22 -0
  179. package/dist/lib/tracking/analytics/heatmaps.js.map +1 -0
  180. package/dist/lib/tracking/analytics/identify.d.ts +16 -0
  181. package/dist/lib/tracking/analytics/identify.js +22 -0
  182. package/dist/lib/tracking/analytics/identify.js.map +1 -0
  183. package/dist/lib/tracking/analytics/index.d.ts +10 -0
  184. package/dist/lib/tracking/analytics/index.js +11 -0
  185. package/dist/lib/tracking/analytics/index.js.map +1 -0
  186. package/dist/lib/tracking/analytics/page-views.d.ts +29 -0
  187. package/dist/lib/tracking/analytics/page-views.js +50 -0
  188. package/dist/lib/tracking/analytics/page-views.js.map +1 -0
  189. package/dist/lib/tracking/analytics/performance.d.ts +22 -0
  190. package/dist/lib/tracking/analytics/performance.js +22 -0
  191. package/dist/lib/tracking/analytics/performance.js.map +1 -0
  192. package/dist/lib/tracking/analytics/replay.d.ts +34 -0
  193. package/dist/lib/tracking/analytics/replay.js +46 -0
  194. package/dist/lib/tracking/analytics/replay.js.map +1 -0
  195. package/dist/lib/tracking/analytics/retention.d.ts +10 -0
  196. package/dist/lib/tracking/analytics/retention.js +10 -0
  197. package/dist/lib/tracking/analytics/retention.js.map +1 -0
  198. package/dist/lib/tracking/analytics/sessions.d.ts +20 -0
  199. package/dist/lib/tracking/analytics/sessions.js +26 -0
  200. package/dist/lib/tracking/analytics/sessions.js.map +1 -0
  201. package/dist/lib/tracking/core/activation.d.ts +23 -0
  202. package/dist/lib/tracking/core/activation.js +33 -0
  203. package/dist/lib/tracking/core/activation.js.map +1 -0
  204. package/dist/lib/tracking/core/experiment.d.ts +122 -0
  205. package/dist/lib/tracking/core/experiment.js +150 -0
  206. package/dist/lib/tracking/core/experiment.js.map +1 -0
  207. package/dist/lib/tracking/core/feature.d.ts +13 -0
  208. package/dist/lib/tracking/core/feature.js +14 -0
  209. package/dist/lib/tracking/core/feature.js.map +1 -0
  210. package/dist/lib/tracking/core/index.d.ts +4 -0
  211. package/dist/lib/tracking/core/index.js +5 -0
  212. package/dist/lib/tracking/core/index.js.map +1 -0
  213. package/dist/lib/tracking/core/prompt.d.ts +18 -0
  214. package/dist/lib/tracking/core/prompt.js +26 -0
  215. package/dist/lib/tracking/core/prompt.js.map +1 -0
  216. package/dist/lib/tracking/ecommerce/cart.d.ts +17 -0
  217. package/dist/lib/tracking/ecommerce/cart.js +22 -0
  218. package/dist/lib/tracking/ecommerce/cart.js.map +1 -0
  219. package/dist/lib/tracking/ecommerce/checkout.d.ts +17 -0
  220. package/dist/lib/tracking/ecommerce/checkout.js +22 -0
  221. package/dist/lib/tracking/ecommerce/checkout.js.map +1 -0
  222. package/dist/lib/tracking/ecommerce/index.d.ts +10 -0
  223. package/dist/lib/tracking/ecommerce/index.js +11 -0
  224. package/dist/lib/tracking/ecommerce/index.js.map +1 -0
  225. package/dist/lib/tracking/ecommerce/ltv.d.ts +15 -0
  226. package/dist/lib/tracking/ecommerce/ltv.js +14 -0
  227. package/dist/lib/tracking/ecommerce/ltv.js.map +1 -0
  228. package/dist/lib/tracking/ecommerce/products.d.ts +15 -0
  229. package/dist/lib/tracking/ecommerce/products.js +18 -0
  230. package/dist/lib/tracking/ecommerce/products.js.map +1 -0
  231. package/dist/lib/tracking/ecommerce/promotions.d.ts +14 -0
  232. package/dist/lib/tracking/ecommerce/promotions.js +25 -0
  233. package/dist/lib/tracking/ecommerce/promotions.js.map +1 -0
  234. package/dist/lib/tracking/ecommerce/purchases.d.ts +11 -0
  235. package/dist/lib/tracking/ecommerce/purchases.js +10 -0
  236. package/dist/lib/tracking/ecommerce/purchases.js.map +1 -0
  237. package/dist/lib/tracking/ecommerce/refunds.d.ts +17 -0
  238. package/dist/lib/tracking/ecommerce/refunds.js +22 -0
  239. package/dist/lib/tracking/ecommerce/refunds.js.map +1 -0
  240. package/dist/lib/tracking/ecommerce/search.d.ts +24 -0
  241. package/dist/lib/tracking/ecommerce/search.js +22 -0
  242. package/dist/lib/tracking/ecommerce/search.js.map +1 -0
  243. package/dist/lib/tracking/ecommerce/subscriptions.d.ts +21 -0
  244. package/dist/lib/tracking/ecommerce/subscriptions.js +38 -0
  245. package/dist/lib/tracking/ecommerce/subscriptions.js.map +1 -0
  246. package/dist/lib/tracking/ecommerce/wishlist.d.ts +19 -0
  247. package/dist/lib/tracking/ecommerce/wishlist.js +26 -0
  248. package/dist/lib/tracking/ecommerce/wishlist.js.map +1 -0
  249. package/dist/lib/tracking/enterprise/acquisition.d.ts +25 -0
  250. package/dist/lib/tracking/enterprise/acquisition.js +22 -0
  251. package/dist/lib/tracking/enterprise/acquisition.js.map +1 -0
  252. package/dist/lib/tracking/enterprise/alerts.d.ts +32 -0
  253. package/dist/lib/tracking/enterprise/alerts.js +30 -0
  254. package/dist/lib/tracking/enterprise/alerts.js.map +1 -0
  255. package/dist/lib/tracking/enterprise/churn.d.ts +23 -0
  256. package/dist/lib/tracking/enterprise/churn.js +22 -0
  257. package/dist/lib/tracking/enterprise/churn.js.map +1 -0
  258. package/dist/lib/tracking/enterprise/cohorts.d.ts +18 -0
  259. package/dist/lib/tracking/enterprise/cohorts.js +18 -0
  260. package/dist/lib/tracking/enterprise/cohorts.js.map +1 -0
  261. package/dist/lib/tracking/enterprise/engagement.d.ts +31 -0
  262. package/dist/lib/tracking/enterprise/engagement.js +44 -0
  263. package/dist/lib/tracking/enterprise/engagement.js.map +1 -0
  264. package/dist/lib/tracking/enterprise/forecasting.d.ts +18 -0
  265. package/dist/lib/tracking/enterprise/forecasting.js +22 -0
  266. package/dist/lib/tracking/enterprise/forecasting.js.map +1 -0
  267. package/dist/lib/tracking/enterprise/index.d.ts +11 -0
  268. package/dist/lib/tracking/enterprise/index.js +12 -0
  269. package/dist/lib/tracking/enterprise/index.js.map +1 -0
  270. package/dist/lib/tracking/enterprise/monetization.d.ts +14 -0
  271. package/dist/lib/tracking/enterprise/monetization.js +10 -0
  272. package/dist/lib/tracking/enterprise/monetization.js.map +1 -0
  273. package/dist/lib/tracking/enterprise/multi-path-funnels.d.ts +20 -0
  274. package/dist/lib/tracking/enterprise/multi-path-funnels.js +18 -0
  275. package/dist/lib/tracking/enterprise/multi-path-funnels.js.map +1 -0
  276. package/dist/lib/tracking/enterprise/paths.d.ts +20 -0
  277. package/dist/lib/tracking/enterprise/paths.js +18 -0
  278. package/dist/lib/tracking/enterprise/paths.js.map +1 -0
  279. package/dist/lib/tracking/enterprise/security.d.ts +28 -0
  280. package/dist/lib/tracking/enterprise/security.js +26 -0
  281. package/dist/lib/tracking/enterprise/security.js.map +1 -0
  282. package/dist/lib/tracking/enterprise/support.d.ts +25 -0
  283. package/dist/lib/tracking/enterprise/support.js +22 -0
  284. package/dist/lib/tracking/enterprise/support.js.map +1 -0
  285. package/dist/lib/tracking/index.d.ts +4 -0
  286. package/dist/lib/tracking/index.js +5 -0
  287. package/dist/lib/tracking/index.js.map +1 -0
  288. package/dist/lib/types/analytics.d.ts +10 -2
  289. package/dist/lib/types/analytics.js +6 -0
  290. package/dist/lib/types/analytics.js.map +1 -0
  291. package/dist/lib/types/common.js +6 -0
  292. package/dist/lib/types/common.js.map +1 -0
  293. package/dist/lib/types/ecommerce.js +6 -0
  294. package/dist/lib/types/ecommerce.js.map +1 -0
  295. package/dist/lib/types/index.js +8 -0
  296. package/dist/lib/types/index.js.map +1 -0
  297. package/dist/lib/utils/browser.d.ts +16 -0
  298. package/dist/lib/utils/browser.js +32 -0
  299. package/dist/lib/utils/browser.js.map +1 -0
  300. package/dist/lib/utils/identity.js +346 -0
  301. package/dist/lib/utils/identity.js.map +1 -0
  302. package/dist/lib/utils/storage.js +105 -0
  303. package/dist/lib/utils/storage.js.map +1 -0
  304. package/dist/umd/237.index.js +2 -0
  305. package/dist/umd/237.index.js.map +1 -0
  306. package/dist/umd/546.index.js +3 -0
  307. package/dist/umd/546.index.js.LICENSE.txt +14 -0
  308. package/dist/umd/546.index.js.map +1 -0
  309. package/dist/umd/index.js +2 -0
  310. package/dist/umd/index.js.map +1 -0
  311. package/package.json +27 -80
  312. 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
- Production-grade TypeScript SDK for product analytics, ecommerce tracking, experiments, and **universal feature flags** (client & server).
4
-
5
- ## Features
6
-
7
- - **🚩 Feature Flags** — Client & server-side evaluation with targeting and rollouts
8
- - **📊 Product Analytics**Page views, sessions, events, funnels, retention, attribution
9
- - **🛒 Ecommerce Tracking** Products, cart, checkout, purchases, subscriptions
10
- - **🧪 A/B Testing** Experiments with statistical significance
11
- - **🎯 User Identification** — Identity resolution and traits tracking
12
- - **📈 Enterprise Analytics** — Cohorts, churn prediction, monetization metrics
13
- - **⚛️ Framework Support** React, Vue, Next.js, Nuxt, Node.js
14
- - **🌐 CMS Embed** — Drop-in `<script>` tag for Bubble, WordPress, Wix, Squarespace, Webflow
15
- - **🍪 Cookie Consent** GDPR-compliant consent management with customisable banners
16
- - **🔒 Privacy First** DNT/GPC support, bot filtering, consent gating
17
- - **⚡ High Performance** — < 0.1ms flag evaluation, sendBeacon transport, offline buffering
3
+ [![npm](https://img.shields.io/npm/v/flowgrid-sdk.svg)](https://www.npmjs.com/package/flowgrid-sdk)
4
+ [![license](https://img.shields.io/npm/l/flowgrid-sdk.svg)](./LICENSE)
5
+ [![types](https://img.shields.io/npm/types/flowgrid-sdk.svg)](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
- ### 1. Script Tag (CMS / No-Build)
63
+ ### Unified client (recommended)
28
64
 
29
- Drop this into any HTML page — works on WordPress, Wix, Bubble, Squarespace, Webflow, etc.
65
+ ```ts
66
+ import { FlowGrid } from "flowgrid-sdk";
30
67
 
31
- ```html
32
- <script src="https://cdn.flow-grid.xyz/flowgrid.min.js"></script>
33
- <script>
34
- FlowGrid.init({
35
- webId: 'web_abc123',
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
- ### 2. Node / TypeScript
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
- ```typescript
45
- import {
46
- Events,
47
- Sessions,
48
- PageViews,
49
- Identify,
50
- Products,
51
- CartTracking,
52
- Purchases,
53
- Funnels,
54
- Activation,
55
- Experiment,
56
- } from 'flowgrid-sdk';
57
-
58
- const events = new Events('web_123', 'https://api.flow-grid.xyz', 'key_xxx');
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
- ### 3. React
96
+ Available namespaces on `FlowGrid`:
63
97
 
64
- ```tsx
65
- import { FlowGridProvider, useFlowGrid, CookieBanner } from 'flowgrid-sdk/react';
66
- import { ConsentManager } from 'flowgrid-sdk';
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
- const consent = new ConsentManager();
105
+ ### Direct module imports (tree-shaking)
69
106
 
70
- function App() {
71
- return (
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
- function MyComponent() {
80
- const { trackEvent, isReady } = useFlowGrid();
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
- ### 4. Vue 3
114
+ ### Browser script tag (CMS / no-build)
86
115
 
87
- ```vue
88
- <script setup>
89
- import { useFlowGrid, useEcommerce, CookieBanner } from 'flowgrid-sdk/vue';
90
- import { ConsentManager } from 'flowgrid-sdk';
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
- const { trackEvent, isReady } = useFlowGrid();
93
- const { trackAddToCart } = useEcommerce();
94
- const consent = new ConsentManager();
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
- ### 5. Next.js (App Router)
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
- ```tsx
106
- // app/layout.tsx
107
- import { FlowGridProvider, PageViewTracker, CookieBanner } from 'flowgrid-sdk/nextjs/client';
108
- import { ConsentManager } from 'flowgrid-sdk';
137
+ ---
109
138
 
110
- const consent = new ConsentManager();
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
- export default function RootLayout({ children }) {
113
- return (
114
- <FlowGridProvider webId="web_123" endpoint="https://api.flow-grid.xyz" apiKey="key_xxx">
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
- Server-side tracking:
164
+ Manual lifecycle control is available when you do not want init-time recording:
124
165
 
125
- ```typescript
126
- // app/api/track/route.ts
127
- import { createServerFlowGrid } from 'flowgrid-sdk/nextjs/server';
166
+ ```ts
167
+ const stop = await fg.replay.start({ sampleRate: 1, maskAllInputs: true });
168
+ const status = fg.replay.status();
128
169
 
129
- export async function POST(req: Request) {
130
- const fg = createServerFlowGrid({ webId: 'web_123', endpoint: '...', apiKey: '...' });
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
- ### 6. Nuxt 3
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
- ```typescript
139
- // plugins/flowgrid.client.ts
140
- import { FlowGridPlugin } from 'flowgrid-sdk/nuxt';
176
+ ---
141
177
 
142
- export default defineNuxtPlugin((nuxtApp) => {
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
- ```vue
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
- ### 7. Node.js (Server-only)
182
+ ```ts
183
+ // app/api/track/route.ts (Next.js example, but works anywhere)
184
+ import { FlowGrid } from "flowgrid-sdk";
163
185
 
164
- ```typescript
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
- const fg = createFlowGridNode({ webId: 'web_123', endpoint: '...', apiKey: '...' });
168
- await fg.events.track({ eventName: 'order_processed', properties: { orderId: '123' } });
169
- await fg.flush(); // Flush buffered events before shutdown
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 Management
199
+ ## Cookie Consent
175
200
 
176
- The SDK ships a framework-agnostic `ConsentManager` and pre-built cookie banner components for React, Vue, Next.js, and Nuxt.
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
- ```typescript
179
- import { ConsentManager } from 'flowgrid-sdk';
203
+ ```ts
204
+ import { ConsentManager, FlowGridTransport } from "flowgrid-sdk";
180
205
 
181
206
  const consent = new ConsentManager({
182
- cookieDomain: '.example.com',
207
+ cookieDomain: ".example.com",
183
208
  cookieExpiry: 365,
184
209
  respectDNT: true,
185
210
  onChange: (prefs) => {
186
- console.log('Consent updated:', prefs);
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('analytics'); // true
195
- consent.reset(); // Clear stored consent
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
- ### WordPress
227
+ You can also gate the transport directly without `ConsentManager`:
235
228
 
236
- Add to your theme's `functions.php` or use a custom HTML block:
229
+ ```ts
230
+ import { FlowGridTransport } from "flowgrid-sdk";
237
231
 
238
- ```php
239
- function flowgrid_tracking() {
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
- ### Wix
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
- Add `data-goal="goal_name"` to any element to track clicks as goals:
238
+ ## Identity & Storage Helpers
261
239
 
262
- ```html
263
- <button data-goal="signup_cta">Sign Up Free</button>
264
- <a href="/pricing" data-goal="view_pricing">View Pricing</a>
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
- ## Ecommerce Tracking
266
+ ## Package Exports
270
267
 
271
- ```typescript
272
- import { Products, CartTracking, Checkout, Purchases } from 'flowgrid-sdk/ecommerce';
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
- const products = new Products('web_123', endpoint, apiKey);
275
- const cart = new CartTracking('web_123', endpoint, apiKey);
277
+ ---
276
278
 
277
- // Track product view
278
- await products.view({ productId: 'sku_1', name: 'Widget', price: 29.99, currency: 'USD' });
279
+ ## Configuration
279
280
 
280
- // Add to cart
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
- // Track purchase
288
- const purchases = new Purchases('web_123', endpoint, apiKey);
289
- await purchases.track({
290
- order: {
291
- orderId: 'order_123',
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
- ## Feature Flags
303
-
304
- ```typescript
305
- import { FeatureFlagsClient } from 'flowgrid-sdk';
293
+ ---
306
294
 
307
- const flags = new FeatureFlagsClient('web_123', 'api.flowgrid.com', 'sk_live_xxx');
308
- await flags.initialize({ id: 'user_123', country: 'US', plan: 'pro' });
295
+ ## Scripts
309
296
 
310
- const enabled = flags.isEnabled('new_checkout');
311
- const variant = flags.getVariant('checkout_design');
312
- const value = flags.getValue('max_items');
313
- const reason = flags.getFlagReason('new_checkout');
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
- See the [official documentation](https://flow-grid.xyz/documentation) for detailed usage and API reference.
309
+ Full reference: <https://flow-grid.xyz/documentation>
339
310
 
340
311
  ## Contributing
341
312
 
342
- Contributions are welcome! Please open issues or pull requests on [GitHub](https://github.com/flowgrid/flowgrid-sdk).
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,EAAE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B,EAAEa,aAAajC,GAAE,KAAML,EAAEhC,IAAIA,EAAE8G,YAAYf,EAAEvF,GAAGmD,oBAAoB3D,EAAEsB,KAAKU,EAAE,CAACoE,SAAQ,MAAO,IAAI,MAAMpG,IAAI,CAAC,UAAU,QAAQ,oBAAoBE,iBAAiBF,EAAEgC,EAAE,CAACoE,SAAQ,IAAKnG,EAAEA,IAAImD,EAAE3C,EAAE,OAAO4B,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":""}