@scalebun/web 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1030) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -0
  3. package/dist/bootstrap/FeatureRegistry.d.ts +44 -0
  4. package/dist/bootstrap/FeatureRegistry.d.ts.map +1 -0
  5. package/dist/bootstrap/FeatureRegistry.js +85 -0
  6. package/dist/bootstrap/FeatureRegistry.js.map +1 -0
  7. package/dist/bootstrap/SDKBootstrapper.d.ts +37 -0
  8. package/dist/bootstrap/SDKBootstrapper.d.ts.map +1 -0
  9. package/dist/bootstrap/SDKBootstrapper.js +248 -0
  10. package/dist/bootstrap/SDKBootstrapper.js.map +1 -0
  11. package/dist/browser.d.ts +51 -0
  12. package/dist/browser.d.ts.map +1 -0
  13. package/dist/browser.js +81 -0
  14. package/dist/browser.js.map +1 -0
  15. package/dist/config/schema.d.ts +108 -0
  16. package/dist/config/schema.d.ts.map +1 -0
  17. package/dist/config/schema.js +95 -0
  18. package/dist/config/schema.js.map +1 -0
  19. package/dist/core/breadcrumbs.d.ts +56 -0
  20. package/dist/core/breadcrumbs.d.ts.map +1 -0
  21. package/dist/core/breadcrumbs.js +141 -0
  22. package/dist/core/breadcrumbs.js.map +1 -0
  23. package/dist/core/capabilities.d.ts +38 -0
  24. package/dist/core/capabilities.d.ts.map +1 -0
  25. package/dist/core/capabilities.js +78 -0
  26. package/dist/core/capabilities.js.map +1 -0
  27. package/dist/core/consent.d.ts +17 -0
  28. package/dist/core/consent.d.ts.map +1 -0
  29. package/dist/core/consent.js +38 -0
  30. package/dist/core/consent.js.map +1 -0
  31. package/dist/core/csp.d.ts +31 -0
  32. package/dist/core/csp.d.ts.map +1 -0
  33. package/dist/core/csp.js +74 -0
  34. package/dist/core/csp.js.map +1 -0
  35. package/dist/core/evalContext.d.ts +7 -0
  36. package/dist/core/evalContext.d.ts.map +1 -0
  37. package/dist/core/evalContext.js +22 -0
  38. package/dist/core/evalContext.js.map +1 -0
  39. package/dist/core/ids.d.ts +6 -0
  40. package/dist/core/ids.d.ts.map +1 -0
  41. package/dist/core/ids.js +35 -0
  42. package/dist/core/ids.js.map +1 -0
  43. package/dist/core/index.d.ts +15 -0
  44. package/dist/core/index.d.ts.map +1 -0
  45. package/dist/core/index.js +15 -0
  46. package/dist/core/index.js.map +1 -0
  47. package/dist/core/lifecycle.d.ts +4 -0
  48. package/dist/core/lifecycle.d.ts.map +1 -0
  49. package/dist/core/lifecycle.js +24 -0
  50. package/dist/core/lifecycle.js.map +1 -0
  51. package/dist/core/logger.d.ts +12 -0
  52. package/dist/core/logger.d.ts.map +1 -0
  53. package/dist/core/logger.js +14 -0
  54. package/dist/core/logger.js.map +1 -0
  55. package/dist/core/observe.d.ts +3 -0
  56. package/dist/core/observe.d.ts.map +1 -0
  57. package/dist/core/observe.js +22 -0
  58. package/dist/core/observe.js.map +1 -0
  59. package/dist/core/pageContext.d.ts +13 -0
  60. package/dist/core/pageContext.d.ts.map +1 -0
  61. package/dist/core/pageContext.js +73 -0
  62. package/dist/core/pageContext.js.map +1 -0
  63. package/dist/core/prune.d.ts +7 -0
  64. package/dist/core/prune.d.ts.map +1 -0
  65. package/dist/core/prune.js +31 -0
  66. package/dist/core/prune.js.map +1 -0
  67. package/dist/core/redact.d.ts +15 -0
  68. package/dist/core/redact.d.ts.map +1 -0
  69. package/dist/core/redact.js +50 -0
  70. package/dist/core/redact.js.map +1 -0
  71. package/dist/core/replayCoord.d.ts +22 -0
  72. package/dist/core/replayCoord.d.ts.map +1 -0
  73. package/dist/core/replayCoord.js +20 -0
  74. package/dist/core/replayCoord.js.map +1 -0
  75. package/dist/core/retry.d.ts +25 -0
  76. package/dist/core/retry.d.ts.map +1 -0
  77. package/dist/core/retry.js +44 -0
  78. package/dist/core/retry.js.map +1 -0
  79. package/dist/core/runtime.d.ts +28 -0
  80. package/dist/core/runtime.d.ts.map +1 -0
  81. package/dist/core/runtime.js +67 -0
  82. package/dist/core/runtime.js.map +1 -0
  83. package/dist/core/scrollDepth.d.ts +48 -0
  84. package/dist/core/scrollDepth.d.ts.map +1 -0
  85. package/dist/core/scrollDepth.js +63 -0
  86. package/dist/core/scrollDepth.js.map +1 -0
  87. package/dist/debug/index.d.ts +6 -0
  88. package/dist/debug/index.d.ts.map +1 -0
  89. package/dist/debug/index.js +2 -0
  90. package/dist/debug/index.js.map +1 -0
  91. package/dist/features/analytics/AnalyticsFeature.d.ts +122 -0
  92. package/dist/features/analytics/AnalyticsFeature.d.ts.map +1 -0
  93. package/dist/features/analytics/AnalyticsFeature.js +757 -0
  94. package/dist/features/analytics/AnalyticsFeature.js.map +1 -0
  95. package/dist/features/analytics/autocapture.d.ts +13 -0
  96. package/dist/features/analytics/autocapture.d.ts.map +1 -0
  97. package/dist/features/analytics/autocapture.js +398 -0
  98. package/dist/features/analytics/autocapture.js.map +1 -0
  99. package/dist/features/analytics/governance.d.ts +15 -0
  100. package/dist/features/analytics/governance.d.ts.map +1 -0
  101. package/dist/features/analytics/governance.js +30 -0
  102. package/dist/features/analytics/governance.js.map +1 -0
  103. package/dist/features/analytics/revenue.d.ts +38 -0
  104. package/dist/features/analytics/revenue.d.ts.map +1 -0
  105. package/dist/features/analytics/revenue.js +26 -0
  106. package/dist/features/analytics/revenue.js.map +1 -0
  107. package/dist/features/analytics/sampler.d.ts +2 -0
  108. package/dist/features/analytics/sampler.d.ts.map +1 -0
  109. package/dist/features/analytics/sampler.js +24 -0
  110. package/dist/features/analytics/sampler.js.map +1 -0
  111. package/dist/features/analytics/subscription.d.ts +25 -0
  112. package/dist/features/analytics/subscription.d.ts.map +1 -0
  113. package/dist/features/analytics/subscription.js +51 -0
  114. package/dist/features/analytics/subscription.js.map +1 -0
  115. package/dist/features/attention/index.d.ts +29 -0
  116. package/dist/features/attention/index.d.ts.map +1 -0
  117. package/dist/features/attention/index.js +128 -0
  118. package/dist/features/attention/index.js.map +1 -0
  119. package/dist/features/bugreport/BugReportFeature.d.ts +36 -0
  120. package/dist/features/bugreport/BugReportFeature.d.ts.map +1 -0
  121. package/dist/features/bugreport/BugReportFeature.js +55 -0
  122. package/dist/features/bugreport/BugReportFeature.js.map +1 -0
  123. package/dist/features/bugreport/collect.d.ts +21 -0
  124. package/dist/features/bugreport/collect.d.ts.map +1 -0
  125. package/dist/features/bugreport/collect.js +27 -0
  126. package/dist/features/bugreport/collect.js.map +1 -0
  127. package/dist/features/bugreport/widget.d.ts +21 -0
  128. package/dist/features/bugreport/widget.d.ts.map +1 -0
  129. package/dist/features/bugreport/widget.js +111 -0
  130. package/dist/features/bugreport/widget.js.map +1 -0
  131. package/dist/features/coach/CoachmarkFeature.d.ts +78 -0
  132. package/dist/features/coach/CoachmarkFeature.d.ts.map +1 -0
  133. package/dist/features/coach/CoachmarkFeature.js +161 -0
  134. package/dist/features/coach/CoachmarkFeature.js.map +1 -0
  135. package/dist/features/coach/anchor.d.ts +32 -0
  136. package/dist/features/coach/anchor.d.ts.map +1 -0
  137. package/dist/features/coach/anchor.js +128 -0
  138. package/dist/features/coach/anchor.js.map +1 -0
  139. package/dist/features/coach/observers.d.ts +17 -0
  140. package/dist/features/coach/observers.d.ts.map +1 -0
  141. package/dist/features/coach/observers.js +49 -0
  142. package/dist/features/coach/observers.js.map +1 -0
  143. package/dist/features/coach/overlay.d.ts +15 -0
  144. package/dist/features/coach/overlay.d.ts.map +1 -0
  145. package/dist/features/coach/overlay.js +183 -0
  146. package/dist/features/coach/overlay.js.map +1 -0
  147. package/dist/features/coach/position.d.ts +9 -0
  148. package/dist/features/coach/position.d.ts.map +1 -0
  149. package/dist/features/coach/position.js +83 -0
  150. package/dist/features/coach/position.js.map +1 -0
  151. package/dist/features/coach/predicate.d.ts +10 -0
  152. package/dist/features/coach/predicate.d.ts.map +1 -0
  153. package/dist/features/coach/predicate.js +36 -0
  154. package/dist/features/coach/predicate.js.map +1 -0
  155. package/dist/features/coach/tour.d.ts +55 -0
  156. package/dist/features/coach/tour.d.ts.map +1 -0
  157. package/dist/features/coach/tour.js +181 -0
  158. package/dist/features/coach/tour.js.map +1 -0
  159. package/dist/features/coach/types.d.ts +161 -0
  160. package/dist/features/coach/types.d.ts.map +1 -0
  161. package/dist/features/coach/types.js +2 -0
  162. package/dist/features/coach/types.js.map +1 -0
  163. package/dist/features/coach/wait.d.ts +34 -0
  164. package/dist/features/coach/wait.d.ts.map +1 -0
  165. package/dist/features/coach/wait.js +107 -0
  166. package/dist/features/coach/wait.js.map +1 -0
  167. package/dist/features/config/ConfigFeature.d.ts +117 -0
  168. package/dist/features/config/ConfigFeature.d.ts.map +1 -0
  169. package/dist/features/config/ConfigFeature.js +437 -0
  170. package/dist/features/config/ConfigFeature.js.map +1 -0
  171. package/dist/features/config/bucketing.d.ts +20 -0
  172. package/dist/features/config/bucketing.d.ts.map +1 -0
  173. package/dist/features/config/bucketing.js +37 -0
  174. package/dist/features/config/bucketing.js.map +1 -0
  175. package/dist/features/config/configStore.d.ts +11 -0
  176. package/dist/features/config/configStore.d.ts.map +1 -0
  177. package/dist/features/config/configStore.js +66 -0
  178. package/dist/features/config/configStore.js.map +1 -0
  179. package/dist/features/config/targeting.d.ts +11 -0
  180. package/dist/features/config/targeting.d.ts.map +1 -0
  181. package/dist/features/config/targeting.js +57 -0
  182. package/dist/features/config/targeting.js.map +1 -0
  183. package/dist/features/config/types.d.ts +100 -0
  184. package/dist/features/config/types.d.ts.map +1 -0
  185. package/dist/features/config/types.js +9 -0
  186. package/dist/features/config/types.js.map +1 -0
  187. package/dist/features/console/ConsoleFeature.d.ts +31 -0
  188. package/dist/features/console/ConsoleFeature.d.ts.map +1 -0
  189. package/dist/features/console/ConsoleFeature.js +98 -0
  190. package/dist/features/console/ConsoleFeature.js.map +1 -0
  191. package/dist/features/console/normalize.d.ts +18 -0
  192. package/dist/features/console/normalize.d.ts.map +1 -0
  193. package/dist/features/console/normalize.js +64 -0
  194. package/dist/features/console/normalize.js.map +1 -0
  195. package/dist/features/console/serialize.d.ts +24 -0
  196. package/dist/features/console/serialize.d.ts.map +1 -0
  197. package/dist/features/console/serialize.js +99 -0
  198. package/dist/features/console/serialize.js.map +1 -0
  199. package/dist/features/console/throttle.d.ts +27 -0
  200. package/dist/features/console/throttle.d.ts.map +1 -0
  201. package/dist/features/console/throttle.js +37 -0
  202. package/dist/features/console/throttle.js.map +1 -0
  203. package/dist/features/crash/CrashFeature.d.ts +46 -0
  204. package/dist/features/crash/CrashFeature.d.ts.map +1 -0
  205. package/dist/features/crash/CrashFeature.js +173 -0
  206. package/dist/features/crash/CrashFeature.js.map +1 -0
  207. package/dist/features/crash/liveness.d.ts +30 -0
  208. package/dist/features/crash/liveness.d.ts.map +1 -0
  209. package/dist/features/crash/liveness.js +131 -0
  210. package/dist/features/crash/liveness.js.map +1 -0
  211. package/dist/features/engage/EngageFeature.d.ts +61 -0
  212. package/dist/features/engage/EngageFeature.d.ts.map +1 -0
  213. package/dist/features/engage/EngageFeature.js +221 -0
  214. package/dist/features/engage/EngageFeature.js.map +1 -0
  215. package/dist/features/engage/attachments.d.ts +24 -0
  216. package/dist/features/engage/attachments.d.ts.map +1 -0
  217. package/dist/features/engage/attachments.js +209 -0
  218. package/dist/features/engage/attachments.js.map +1 -0
  219. package/dist/features/engage/gameLogic.d.ts +60 -0
  220. package/dist/features/engage/gameLogic.d.ts.map +1 -0
  221. package/dist/features/engage/gameLogic.js +213 -0
  222. package/dist/features/engage/gameLogic.js.map +1 -0
  223. package/dist/features/engage/gameResolver.d.ts +35 -0
  224. package/dist/features/engage/gameResolver.d.ts.map +1 -0
  225. package/dist/features/engage/gameResolver.js +81 -0
  226. package/dist/features/engage/gameResolver.js.map +1 -0
  227. package/dist/features/engage/gameTypes.d.ts +76 -0
  228. package/dist/features/engage/gameTypes.d.ts.map +1 -0
  229. package/dist/features/engage/gameTypes.js +17 -0
  230. package/dist/features/engage/gameTypes.js.map +1 -0
  231. package/dist/features/engage/inappSlots.d.ts +39 -0
  232. package/dist/features/engage/inappSlots.d.ts.map +1 -0
  233. package/dist/features/engage/inappSlots.js +50 -0
  234. package/dist/features/engage/inappSlots.js.map +1 -0
  235. package/dist/features/engage/normalize.d.ts +11 -0
  236. package/dist/features/engage/normalize.d.ts.map +1 -0
  237. package/dist/features/engage/normalize.js +203 -0
  238. package/dist/features/engage/normalize.js.map +1 -0
  239. package/dist/features/engage/richInApp.d.ts +64 -0
  240. package/dist/features/engage/richInApp.d.ts.map +1 -0
  241. package/dist/features/engage/richInApp.js +1082 -0
  242. package/dist/features/engage/richInApp.js.map +1 -0
  243. package/dist/features/engage/runtime.d.ts +78 -0
  244. package/dist/features/engage/runtime.d.ts.map +1 -0
  245. package/dist/features/engage/runtime.js +349 -0
  246. package/dist/features/engage/runtime.js.map +1 -0
  247. package/dist/features/engage/shakeDetector.d.ts +6 -0
  248. package/dist/features/engage/shakeDetector.d.ts.map +1 -0
  249. package/dist/features/engage/shakeDetector.js +105 -0
  250. package/dist/features/engage/shakeDetector.js.map +1 -0
  251. package/dist/features/engage/theme.d.ts +129 -0
  252. package/dist/features/engage/theme.d.ts.map +1 -0
  253. package/dist/features/engage/theme.js +270 -0
  254. package/dist/features/engage/theme.js.map +1 -0
  255. package/dist/features/engage/throttle.d.ts +31 -0
  256. package/dist/features/engage/throttle.d.ts.map +1 -0
  257. package/dist/features/engage/throttle.js +130 -0
  258. package/dist/features/engage/throttle.js.map +1 -0
  259. package/dist/features/engage/transport.d.ts +62 -0
  260. package/dist/features/engage/transport.d.ts.map +1 -0
  261. package/dist/features/engage/transport.js +185 -0
  262. package/dist/features/engage/transport.js.map +1 -0
  263. package/dist/features/engage/triggerEngine.d.ts +39 -0
  264. package/dist/features/engage/triggerEngine.d.ts.map +1 -0
  265. package/dist/features/engage/triggerEngine.js +105 -0
  266. package/dist/features/engage/triggerEngine.js.map +1 -0
  267. package/dist/features/engage/types.d.ts +265 -0
  268. package/dist/features/engage/types.d.ts.map +1 -0
  269. package/dist/features/engage/types.js +3 -0
  270. package/dist/features/engage/types.js.map +1 -0
  271. package/dist/features/engage/widget/InAppWidget.d.ts +10 -0
  272. package/dist/features/engage/widget/InAppWidget.d.ts.map +1 -0
  273. package/dist/features/engage/widget/InAppWidget.js +136 -0
  274. package/dist/features/engage/widget/InAppWidget.js.map +1 -0
  275. package/dist/features/engage/widget/SurveyWidget.d.ts +11 -0
  276. package/dist/features/engage/widget/SurveyWidget.d.ts.map +1 -0
  277. package/dist/features/engage/widget/SurveyWidget.js +546 -0
  278. package/dist/features/engage/widget/SurveyWidget.js.map +1 -0
  279. package/dist/features/errors/ErrorsFeature.d.ts +62 -0
  280. package/dist/features/errors/ErrorsFeature.d.ts.map +1 -0
  281. package/dist/features/errors/ErrorsFeature.js +209 -0
  282. package/dist/features/errors/ErrorsFeature.js.map +1 -0
  283. package/dist/features/errors/causes.d.ts +15 -0
  284. package/dist/features/errors/causes.d.ts.map +1 -0
  285. package/dist/features/errors/causes.js +29 -0
  286. package/dist/features/errors/causes.js.map +1 -0
  287. package/dist/features/errors/dedup.d.ts +28 -0
  288. package/dist/features/errors/dedup.d.ts.map +1 -0
  289. package/dist/features/errors/dedup.js +42 -0
  290. package/dist/features/errors/dedup.js.map +1 -0
  291. package/dist/features/errors/group/fingerprint.d.ts +13 -0
  292. package/dist/features/errors/group/fingerprint.d.ts.map +1 -0
  293. package/dist/features/errors/group/fingerprint.js +45 -0
  294. package/dist/features/errors/group/fingerprint.js.map +1 -0
  295. package/dist/features/errors/lazy.d.ts +8 -0
  296. package/dist/features/errors/lazy.d.ts.map +1 -0
  297. package/dist/features/errors/lazy.js +8 -0
  298. package/dist/features/errors/lazy.js.map +1 -0
  299. package/dist/features/errors/normalize.d.ts +26 -0
  300. package/dist/features/errors/normalize.d.ts.map +1 -0
  301. package/dist/features/errors/normalize.js +58 -0
  302. package/dist/features/errors/normalize.js.map +1 -0
  303. package/dist/features/errors/parse/stacktrace.d.ts +13 -0
  304. package/dist/features/errors/parse/stacktrace.d.ts.map +1 -0
  305. package/dist/features/errors/parse/stacktrace.js +85 -0
  306. package/dist/features/errors/parse/stacktrace.js.map +1 -0
  307. package/dist/features/errors/redact.d.ts +7 -0
  308. package/dist/features/errors/redact.d.ts.map +1 -0
  309. package/dist/features/errors/redact.js +39 -0
  310. package/dist/features/errors/redact.js.map +1 -0
  311. package/dist/features/errors/sampling.d.ts +2 -0
  312. package/dist/features/errors/sampling.d.ts.map +1 -0
  313. package/dist/features/errors/sampling.js +24 -0
  314. package/dist/features/errors/sampling.js.map +1 -0
  315. package/dist/features/errors/scope.d.ts +26 -0
  316. package/dist/features/errors/scope.d.ts.map +1 -0
  317. package/dist/features/errors/scope.js +30 -0
  318. package/dist/features/errors/scope.js.map +1 -0
  319. package/dist/features/exit-intent/ExitIntentFeature.d.ts +16 -0
  320. package/dist/features/exit-intent/ExitIntentFeature.d.ts.map +1 -0
  321. package/dist/features/exit-intent/ExitIntentFeature.js +25 -0
  322. package/dist/features/exit-intent/ExitIntentFeature.js.map +1 -0
  323. package/dist/features/exit-intent/engine.d.ts +127 -0
  324. package/dist/features/exit-intent/engine.d.ts.map +1 -0
  325. package/dist/features/exit-intent/engine.js +227 -0
  326. package/dist/features/exit-intent/engine.js.map +1 -0
  327. package/dist/features/forms/index.d.ts +83 -0
  328. package/dist/features/forms/index.d.ts.map +1 -0
  329. package/dist/features/forms/index.js +405 -0
  330. package/dist/features/forms/index.js.map +1 -0
  331. package/dist/features/inapp/InApp2Feature.d.ts +24 -0
  332. package/dist/features/inapp/InApp2Feature.d.ts.map +1 -0
  333. package/dist/features/inapp/InApp2Feature.js +43 -0
  334. package/dist/features/inapp/InApp2Feature.js.map +1 -0
  335. package/dist/features/inapp/a11y/focus.d.ts +24 -0
  336. package/dist/features/inapp/a11y/focus.d.ts.map +1 -0
  337. package/dist/features/inapp/a11y/focus.js +112 -0
  338. package/dist/features/inapp/a11y/focus.js.map +1 -0
  339. package/dist/features/inapp/anchor/controller.d.ts +64 -0
  340. package/dist/features/inapp/anchor/controller.d.ts.map +1 -0
  341. package/dist/features/inapp/anchor/controller.js +155 -0
  342. package/dist/features/inapp/anchor/controller.js.map +1 -0
  343. package/dist/features/inapp/api.d.ts +28 -0
  344. package/dist/features/inapp/api.d.ts.map +1 -0
  345. package/dist/features/inapp/api.js +41 -0
  346. package/dist/features/inapp/api.js.map +1 -0
  347. package/dist/features/inapp/blocks/blocks.d.ts +65 -0
  348. package/dist/features/inapp/blocks/blocks.d.ts.map +1 -0
  349. package/dist/features/inapp/blocks/blocks.js +196 -0
  350. package/dist/features/inapp/blocks/blocks.js.map +1 -0
  351. package/dist/features/inapp/blocks/feedback.d.ts +13 -0
  352. package/dist/features/inapp/blocks/feedback.d.ts.map +1 -0
  353. package/dist/features/inapp/blocks/feedback.js +154 -0
  354. package/dist/features/inapp/blocks/feedback.js.map +1 -0
  355. package/dist/features/inapp/blocks/heavy/carousel.d.ts +8 -0
  356. package/dist/features/inapp/blocks/heavy/carousel.d.ts.map +1 -0
  357. package/dist/features/inapp/blocks/heavy/carousel.js +67 -0
  358. package/dist/features/inapp/blocks/heavy/carousel.js.map +1 -0
  359. package/dist/features/inapp/blocks/heavy/chart.d.ts +9 -0
  360. package/dist/features/inapp/blocks/heavy/chart.d.ts.map +1 -0
  361. package/dist/features/inapp/blocks/heavy/chart.js +83 -0
  362. package/dist/features/inapp/blocks/heavy/chart.js.map +1 -0
  363. package/dist/features/inapp/blocks/heavy/code.d.ts +8 -0
  364. package/dist/features/inapp/blocks/heavy/code.d.ts.map +1 -0
  365. package/dist/features/inapp/blocks/heavy/code.js +47 -0
  366. package/dist/features/inapp/blocks/heavy/code.js.map +1 -0
  367. package/dist/features/inapp/blocks/heavy/confetti.d.ts +9 -0
  368. package/dist/features/inapp/blocks/heavy/confetti.d.ts.map +1 -0
  369. package/dist/features/inapp/blocks/heavy/confetti.js +76 -0
  370. package/dist/features/inapp/blocks/heavy/confetti.js.map +1 -0
  371. package/dist/features/inapp/blocks/heavy/countdown.d.ts +9 -0
  372. package/dist/features/inapp/blocks/heavy/countdown.d.ts.map +1 -0
  373. package/dist/features/inapp/blocks/heavy/countdown.js +59 -0
  374. package/dist/features/inapp/blocks/heavy/countdown.js.map +1 -0
  375. package/dist/features/inapp/blocks/heavy/index.d.ts +11 -0
  376. package/dist/features/inapp/blocks/heavy/index.d.ts.map +1 -0
  377. package/dist/features/inapp/blocks/heavy/index.js +45 -0
  378. package/dist/features/inapp/blocks/heavy/index.js.map +1 -0
  379. package/dist/features/inapp/blocks/heavy/markdown.d.ts +9 -0
  380. package/dist/features/inapp/blocks/heavy/markdown.d.ts.map +1 -0
  381. package/dist/features/inapp/blocks/heavy/markdown.js +76 -0
  382. package/dist/features/inapp/blocks/heavy/markdown.js.map +1 -0
  383. package/dist/features/inapp/blocks/heavy/productgrid.d.ts +8 -0
  384. package/dist/features/inapp/blocks/heavy/productgrid.d.ts.map +1 -0
  385. package/dist/features/inapp/blocks/heavy/productgrid.js +46 -0
  386. package/dist/features/inapp/blocks/heavy/productgrid.js.map +1 -0
  387. package/dist/features/inapp/blocks/heavy/qr.d.ts +10 -0
  388. package/dist/features/inapp/blocks/heavy/qr.d.ts.map +1 -0
  389. package/dist/features/inapp/blocks/heavy/qr.js +69 -0
  390. package/dist/features/inapp/blocks/heavy/qr.js.map +1 -0
  391. package/dist/features/inapp/blocks/heavy/scratch.d.ts +8 -0
  392. package/dist/features/inapp/blocks/heavy/scratch.d.ts.map +1 -0
  393. package/dist/features/inapp/blocks/heavy/scratch.js +141 -0
  394. package/dist/features/inapp/blocks/heavy/scratch.js.map +1 -0
  395. package/dist/features/inapp/blocks/heavy/slot.d.ts +8 -0
  396. package/dist/features/inapp/blocks/heavy/slot.d.ts.map +1 -0
  397. package/dist/features/inapp/blocks/heavy/slot.js +96 -0
  398. package/dist/features/inapp/blocks/heavy/slot.js.map +1 -0
  399. package/dist/features/inapp/blocks/heavy/spinwheel.d.ts +9 -0
  400. package/dist/features/inapp/blocks/heavy/spinwheel.d.ts.map +1 -0
  401. package/dist/features/inapp/blocks/heavy/spinwheel.js +127 -0
  402. package/dist/features/inapp/blocks/heavy/spinwheel.js.map +1 -0
  403. package/dist/features/inapp/blocks/heavy/steps.d.ts +27 -0
  404. package/dist/features/inapp/blocks/heavy/steps.d.ts.map +1 -0
  405. package/dist/features/inapp/blocks/heavy/steps.js +127 -0
  406. package/dist/features/inapp/blocks/heavy/steps.js.map +1 -0
  407. package/dist/features/inapp/blocks/heavy/streak.d.ts +18 -0
  408. package/dist/features/inapp/blocks/heavy/streak.d.ts.map +1 -0
  409. package/dist/features/inapp/blocks/heavy/streak.js +52 -0
  410. package/dist/features/inapp/blocks/heavy/streak.js.map +1 -0
  411. package/dist/features/inapp/blocks/heavy/table.d.ts +7 -0
  412. package/dist/features/inapp/blocks/heavy/table.d.ts.map +1 -0
  413. package/dist/features/inapp/blocks/heavy/table.js +30 -0
  414. package/dist/features/inapp/blocks/heavy/table.js.map +1 -0
  415. package/dist/features/inapp/blocks/heavy/unavailable.d.ts +28 -0
  416. package/dist/features/inapp/blocks/heavy/unavailable.d.ts.map +1 -0
  417. package/dist/features/inapp/blocks/heavy/unavailable.js +33 -0
  418. package/dist/features/inapp/blocks/heavy/unavailable.js.map +1 -0
  419. package/dist/features/inapp/blocks/heavy/video.d.ts +7 -0
  420. package/dist/features/inapp/blocks/heavy/video.d.ts.map +1 -0
  421. package/dist/features/inapp/blocks/heavy/video.js +38 -0
  422. package/dist/features/inapp/blocks/heavy/video.js.map +1 -0
  423. package/dist/features/inapp/blocks/styles.d.ts +7 -0
  424. package/dist/features/inapp/blocks/styles.d.ts.map +1 -0
  425. package/dist/features/inapp/blocks/styles.js +198 -0
  426. package/dist/features/inapp/blocks/styles.js.map +1 -0
  427. package/dist/features/inapp/center/bridge.d.ts +12 -0
  428. package/dist/features/inapp/center/bridge.d.ts.map +1 -0
  429. package/dist/features/inapp/center/bridge.js +59 -0
  430. package/dist/features/inapp/center/bridge.js.map +1 -0
  431. package/dist/features/inapp/center/panel.d.ts +20 -0
  432. package/dist/features/inapp/center/panel.d.ts.map +1 -0
  433. package/dist/features/inapp/center/panel.js +194 -0
  434. package/dist/features/inapp/center/panel.js.map +1 -0
  435. package/dist/features/inapp/center/store.d.ts +50 -0
  436. package/dist/features/inapp/center/store.d.ts.map +1 -0
  437. package/dist/features/inapp/center/store.js +188 -0
  438. package/dist/features/inapp/center/store.js.map +1 -0
  439. package/dist/features/inapp/center/sync.d.ts +32 -0
  440. package/dist/features/inapp/center/sync.d.ts.map +1 -0
  441. package/dist/features/inapp/center/sync.js +60 -0
  442. package/dist/features/inapp/center/sync.js.map +1 -0
  443. package/dist/features/inapp/center/types.d.ts +46 -0
  444. package/dist/features/inapp/center/types.d.ts.map +1 -0
  445. package/dist/features/inapp/center/types.js +5 -0
  446. package/dist/features/inapp/center/types.js.map +1 -0
  447. package/dist/features/inapp/core/analytics.d.ts +35 -0
  448. package/dist/features/inapp/core/analytics.d.ts.map +1 -0
  449. package/dist/features/inapp/core/analytics.js +70 -0
  450. package/dist/features/inapp/core/analytics.js.map +1 -0
  451. package/dist/features/inapp/core/compat.d.ts +28 -0
  452. package/dist/features/inapp/core/compat.d.ts.map +1 -0
  453. package/dist/features/inapp/core/compat.js +104 -0
  454. package/dist/features/inapp/core/compat.js.map +1 -0
  455. package/dist/features/inapp/core/debugOverlay.d.ts +5 -0
  456. package/dist/features/inapp/core/debugOverlay.d.ts.map +1 -0
  457. package/dist/features/inapp/core/debugOverlay.js +79 -0
  458. package/dist/features/inapp/core/debugOverlay.js.map +1 -0
  459. package/dist/features/inapp/core/engine.d.ts +70 -0
  460. package/dist/features/inapp/core/engine.d.ts.map +1 -0
  461. package/dist/features/inapp/core/engine.js +248 -0
  462. package/dist/features/inapp/core/engine.js.map +1 -0
  463. package/dist/features/inapp/core/environment.d.ts +21 -0
  464. package/dist/features/inapp/core/environment.d.ts.map +1 -0
  465. package/dist/features/inapp/core/environment.js +57 -0
  466. package/dist/features/inapp/core/environment.js.map +1 -0
  467. package/dist/features/inapp/core/host.d.ts +53 -0
  468. package/dist/features/inapp/core/host.d.ts.map +1 -0
  469. package/dist/features/inapp/core/host.js +239 -0
  470. package/dist/features/inapp/core/host.js.map +1 -0
  471. package/dist/features/inapp/core/keyboard.d.ts +27 -0
  472. package/dist/features/inapp/core/keyboard.d.ts.map +1 -0
  473. package/dist/features/inapp/core/keyboard.js +69 -0
  474. package/dist/features/inapp/core/keyboard.js.map +1 -0
  475. package/dist/features/inapp/core/metrics.d.ts +73 -0
  476. package/dist/features/inapp/core/metrics.d.ts.map +1 -0
  477. package/dist/features/inapp/core/metrics.js +125 -0
  478. package/dist/features/inapp/core/metrics.js.map +1 -0
  479. package/dist/features/inapp/core/migration.d.ts +32 -0
  480. package/dist/features/inapp/core/migration.d.ts.map +1 -0
  481. package/dist/features/inapp/core/migration.js +28 -0
  482. package/dist/features/inapp/core/migration.js.map +1 -0
  483. package/dist/features/inapp/core/orchestrator.d.ts +77 -0
  484. package/dist/features/inapp/core/orchestrator.d.ts.map +1 -0
  485. package/dist/features/inapp/core/orchestrator.js +144 -0
  486. package/dist/features/inapp/core/orchestrator.js.map +1 -0
  487. package/dist/features/inapp/core/respect.d.ts +51 -0
  488. package/dist/features/inapp/core/respect.d.ts.map +1 -0
  489. package/dist/features/inapp/core/respect.js +78 -0
  490. package/dist/features/inapp/core/respect.js.map +1 -0
  491. package/dist/features/inapp/core/slots.d.ts +19 -0
  492. package/dist/features/inapp/core/slots.d.ts.map +1 -0
  493. package/dist/features/inapp/core/slots.js +53 -0
  494. package/dist/features/inapp/core/slots.js.map +1 -0
  495. package/dist/features/inapp/core/targeting.d.ts +58 -0
  496. package/dist/features/inapp/core/targeting.d.ts.map +1 -0
  497. package/dist/features/inapp/core/targeting.js +181 -0
  498. package/dist/features/inapp/core/targeting.js.map +1 -0
  499. package/dist/features/inapp/core/transport.d.ts +66 -0
  500. package/dist/features/inapp/core/transport.d.ts.map +1 -0
  501. package/dist/features/inapp/core/transport.js +154 -0
  502. package/dist/features/inapp/core/transport.js.map +1 -0
  503. package/dist/features/inapp/core/triggers.d.ts +94 -0
  504. package/dist/features/inapp/core/triggers.d.ts.map +1 -0
  505. package/dist/features/inapp/core/triggers.js +368 -0
  506. package/dist/features/inapp/core/triggers.js.map +1 -0
  507. package/dist/features/inapp/inappContract.web.d.ts +47 -0
  508. package/dist/features/inapp/inappContract.web.d.ts.map +1 -0
  509. package/dist/features/inapp/inappContract.web.js +219 -0
  510. package/dist/features/inapp/inappContract.web.js.map +1 -0
  511. package/dist/features/inapp/index.d.ts +23 -0
  512. package/dist/features/inapp/index.d.ts.map +1 -0
  513. package/dist/features/inapp/index.js +23 -0
  514. package/dist/features/inapp/index.js.map +1 -0
  515. package/dist/features/inapp/registry.canonical.hash.d.ts +7 -0
  516. package/dist/features/inapp/registry.canonical.hash.d.ts.map +1 -0
  517. package/dist/features/inapp/registry.canonical.hash.js +7 -0
  518. package/dist/features/inapp/registry.canonical.hash.js.map +1 -0
  519. package/dist/features/inapp/registry.web.canonical.d.ts +21 -0
  520. package/dist/features/inapp/registry.web.canonical.d.ts.map +1 -0
  521. package/dist/features/inapp/registry.web.canonical.js +136 -0
  522. package/dist/features/inapp/registry.web.canonical.js.map +1 -0
  523. package/dist/features/inapp/registry.web.catalog.d.ts +12 -0
  524. package/dist/features/inapp/registry.web.catalog.d.ts.map +1 -0
  525. package/dist/features/inapp/registry.web.catalog.js +208 -0
  526. package/dist/features/inapp/registry.web.catalog.js.map +1 -0
  527. package/dist/features/inapp/surfaces/banner.d.ts +7 -0
  528. package/dist/features/inapp/surfaces/banner.d.ts.map +1 -0
  529. package/dist/features/inapp/surfaces/banner.js +30 -0
  530. package/dist/features/inapp/surfaces/banner.js.map +1 -0
  531. package/dist/features/inapp/surfaces/checklist.d.ts +13 -0
  532. package/dist/features/inapp/surfaces/checklist.d.ts.map +1 -0
  533. package/dist/features/inapp/surfaces/checklist.js +127 -0
  534. package/dist/features/inapp/surfaces/checklist.js.map +1 -0
  535. package/dist/features/inapp/surfaces/coachmark.d.ts +10 -0
  536. package/dist/features/inapp/surfaces/coachmark.d.ts.map +1 -0
  537. package/dist/features/inapp/surfaces/coachmark.js +92 -0
  538. package/dist/features/inapp/surfaces/coachmark.js.map +1 -0
  539. package/dist/features/inapp/surfaces/hotspot.d.ts +8 -0
  540. package/dist/features/inapp/surfaces/hotspot.d.ts.map +1 -0
  541. package/dist/features/inapp/surfaces/hotspot.js +88 -0
  542. package/dist/features/inapp/surfaces/hotspot.js.map +1 -0
  543. package/dist/features/inapp/surfaces/inline.d.ts +13 -0
  544. package/dist/features/inapp/surfaces/inline.d.ts.map +1 -0
  545. package/dist/features/inapp/surfaces/inline.js +72 -0
  546. package/dist/features/inapp/surfaces/inline.js.map +1 -0
  547. package/dist/features/inapp/surfaces/launcher.d.ts +9 -0
  548. package/dist/features/inapp/surfaces/launcher.d.ts.map +1 -0
  549. package/dist/features/inapp/surfaces/launcher.js +54 -0
  550. package/dist/features/inapp/surfaces/launcher.js.map +1 -0
  551. package/dist/features/inapp/surfaces/modal.d.ts +8 -0
  552. package/dist/features/inapp/surfaces/modal.d.ts.map +1 -0
  553. package/dist/features/inapp/surfaces/modal.js +70 -0
  554. package/dist/features/inapp/surfaces/modal.js.map +1 -0
  555. package/dist/features/inapp/surfaces/mount.d.ts +19 -0
  556. package/dist/features/inapp/surfaces/mount.d.ts.map +1 -0
  557. package/dist/features/inapp/surfaces/mount.js +29 -0
  558. package/dist/features/inapp/surfaces/mount.js.map +1 -0
  559. package/dist/features/inapp/surfaces/palette.d.ts +9 -0
  560. package/dist/features/inapp/surfaces/palette.d.ts.map +1 -0
  561. package/dist/features/inapp/surfaces/palette.js +127 -0
  562. package/dist/features/inapp/surfaces/palette.js.map +1 -0
  563. package/dist/features/inapp/surfaces/panel.d.ts +14 -0
  564. package/dist/features/inapp/surfaces/panel.d.ts.map +1 -0
  565. package/dist/features/inapp/surfaces/panel.js +91 -0
  566. package/dist/features/inapp/surfaces/panel.js.map +1 -0
  567. package/dist/features/inapp/surfaces/popover.d.ts +10 -0
  568. package/dist/features/inapp/surfaces/popover.d.ts.map +1 -0
  569. package/dist/features/inapp/surfaces/popover.js +66 -0
  570. package/dist/features/inapp/surfaces/popover.js.map +1 -0
  571. package/dist/features/inapp/surfaces/render.d.ts +34 -0
  572. package/dist/features/inapp/surfaces/render.d.ts.map +1 -0
  573. package/dist/features/inapp/surfaces/render.js +52 -0
  574. package/dist/features/inapp/surfaces/render.js.map +1 -0
  575. package/dist/features/inapp/surfaces/slideover.d.ts +9 -0
  576. package/dist/features/inapp/surfaces/slideover.d.ts.map +1 -0
  577. package/dist/features/inapp/surfaces/slideover.js +144 -0
  578. package/dist/features/inapp/surfaces/slideover.js.map +1 -0
  579. package/dist/features/inapp/surfaces/styles.d.ts +7 -0
  580. package/dist/features/inapp/surfaces/styles.d.ts.map +1 -0
  581. package/dist/features/inapp/surfaces/styles.js +186 -0
  582. package/dist/features/inapp/surfaces/styles.js.map +1 -0
  583. package/dist/features/inapp/surfaces/surface.d.ts +69 -0
  584. package/dist/features/inapp/surfaces/surface.d.ts.map +1 -0
  585. package/dist/features/inapp/surfaces/surface.js +80 -0
  586. package/dist/features/inapp/surfaces/surface.js.map +1 -0
  587. package/dist/features/inapp/surfaces/takeover.d.ts +9 -0
  588. package/dist/features/inapp/surfaces/takeover.d.ts.map +1 -0
  589. package/dist/features/inapp/surfaces/takeover.js +60 -0
  590. package/dist/features/inapp/surfaces/takeover.js.map +1 -0
  591. package/dist/features/inapp/surfaces/toast.d.ts +7 -0
  592. package/dist/features/inapp/surfaces/toast.d.ts.map +1 -0
  593. package/dist/features/inapp/surfaces/toast.js +48 -0
  594. package/dist/features/inapp/surfaces/toast.js.map +1 -0
  595. package/dist/features/inapp/surfaces/toolbar.d.ts +8 -0
  596. package/dist/features/inapp/surfaces/toolbar.d.ts.map +1 -0
  597. package/dist/features/inapp/surfaces/toolbar.js +62 -0
  598. package/dist/features/inapp/surfaces/toolbar.js.map +1 -0
  599. package/dist/features/inapp/surfaces/tour.d.ts +14 -0
  600. package/dist/features/inapp/surfaces/tour.d.ts.map +1 -0
  601. package/dist/features/inapp/surfaces/tour.js +199 -0
  602. package/dist/features/inapp/surfaces/tour.js.map +1 -0
  603. package/dist/features/inapp/types.d.ts +163 -0
  604. package/dist/features/inapp/types.d.ts.map +1 -0
  605. package/dist/features/inapp/types.js +12 -0
  606. package/dist/features/inapp/types.js.map +1 -0
  607. package/dist/features/inbox/InboxFeature.d.ts +57 -0
  608. package/dist/features/inbox/InboxFeature.d.ts.map +1 -0
  609. package/dist/features/inbox/InboxFeature.js +225 -0
  610. package/dist/features/inbox/InboxFeature.js.map +1 -0
  611. package/dist/features/inbox/runtime.d.ts +67 -0
  612. package/dist/features/inbox/runtime.d.ts.map +1 -0
  613. package/dist/features/inbox/runtime.js +376 -0
  614. package/dist/features/inbox/runtime.js.map +1 -0
  615. package/dist/features/inbox/store.d.ts +37 -0
  616. package/dist/features/inbox/store.d.ts.map +1 -0
  617. package/dist/features/inbox/store.js +149 -0
  618. package/dist/features/inbox/store.js.map +1 -0
  619. package/dist/features/inbox/sync.d.ts +49 -0
  620. package/dist/features/inbox/sync.d.ts.map +1 -0
  621. package/dist/features/inbox/sync.js +131 -0
  622. package/dist/features/inbox/sync.js.map +1 -0
  623. package/dist/features/inbox/types.d.ts +275 -0
  624. package/dist/features/inbox/types.d.ts.map +1 -0
  625. package/dist/features/inbox/types.js +42 -0
  626. package/dist/features/inbox/types.js.map +1 -0
  627. package/dist/features/inbox/widget/InboxWidget.d.ts +16 -0
  628. package/dist/features/inbox/widget/InboxWidget.d.ts.map +1 -0
  629. package/dist/features/inbox/widget/InboxWidget.js +608 -0
  630. package/dist/features/inbox/widget/InboxWidget.js.map +1 -0
  631. package/dist/features/index.d.ts +21 -0
  632. package/dist/features/index.d.ts.map +1 -0
  633. package/dist/features/index.js +2 -0
  634. package/dist/features/index.js.map +1 -0
  635. package/dist/features/journey/InteractionTracker.d.ts +34 -0
  636. package/dist/features/journey/InteractionTracker.d.ts.map +1 -0
  637. package/dist/features/journey/InteractionTracker.js +125 -0
  638. package/dist/features/journey/InteractionTracker.js.map +1 -0
  639. package/dist/features/journey/JourneyFeature.d.ts +18 -0
  640. package/dist/features/journey/JourneyFeature.d.ts.map +1 -0
  641. package/dist/features/journey/JourneyFeature.js +57 -0
  642. package/dist/features/journey/JourneyFeature.js.map +1 -0
  643. package/dist/features/journey/NavigationTracker.d.ts +16 -0
  644. package/dist/features/journey/NavigationTracker.d.ts.map +1 -0
  645. package/dist/features/journey/NavigationTracker.js +92 -0
  646. package/dist/features/journey/NavigationTracker.js.map +1 -0
  647. package/dist/features/journey/friction.d.ts +29 -0
  648. package/dist/features/journey/friction.d.ts.map +1 -0
  649. package/dist/features/journey/friction.js +65 -0
  650. package/dist/features/journey/friction.js.map +1 -0
  651. package/dist/features/manifest.d.ts +20 -0
  652. package/dist/features/manifest.d.ts.map +1 -0
  653. package/dist/features/manifest.js +76 -0
  654. package/dist/features/manifest.js.map +1 -0
  655. package/dist/features/network/NetworkFeature.d.ts +56 -0
  656. package/dist/features/network/NetworkFeature.d.ts.map +1 -0
  657. package/dist/features/network/NetworkFeature.js +235 -0
  658. package/dist/features/network/NetworkFeature.js.map +1 -0
  659. package/dist/features/network/capture/body.d.ts +31 -0
  660. package/dist/features/network/capture/body.d.ts.map +1 -0
  661. package/dist/features/network/capture/body.js +81 -0
  662. package/dist/features/network/capture/body.js.map +1 -0
  663. package/dist/features/network/classify.d.ts +21 -0
  664. package/dist/features/network/classify.d.ts.map +1 -0
  665. package/dist/features/network/classify.js +50 -0
  666. package/dist/features/network/classify.js.map +1 -0
  667. package/dist/features/network/dedup.d.ts +36 -0
  668. package/dist/features/network/dedup.d.ts.map +1 -0
  669. package/dist/features/network/dedup.js +68 -0
  670. package/dist/features/network/dedup.js.map +1 -0
  671. package/dist/features/network/fetchInterceptor.d.ts +20 -0
  672. package/dist/features/network/fetchInterceptor.d.ts.map +1 -0
  673. package/dist/features/network/fetchInterceptor.js +158 -0
  674. package/dist/features/network/fetchInterceptor.js.map +1 -0
  675. package/dist/features/network/intercept/beacon.d.ts +14 -0
  676. package/dist/features/network/intercept/beacon.d.ts.map +1 -0
  677. package/dist/features/network/intercept/beacon.js +56 -0
  678. package/dist/features/network/intercept/beacon.js.map +1 -0
  679. package/dist/features/network/intercept/sse.d.ts +16 -0
  680. package/dist/features/network/intercept/sse.d.ts.map +1 -0
  681. package/dist/features/network/intercept/sse.js +74 -0
  682. package/dist/features/network/intercept/sse.js.map +1 -0
  683. package/dist/features/network/intercept/streams.d.ts +23 -0
  684. package/dist/features/network/intercept/streams.d.ts.map +1 -0
  685. package/dist/features/network/intercept/streams.js +25 -0
  686. package/dist/features/network/intercept/streams.js.map +1 -0
  687. package/dist/features/network/intercept/websocket.d.ts +14 -0
  688. package/dist/features/network/intercept/websocket.d.ts.map +1 -0
  689. package/dist/features/network/intercept/websocket.js +97 -0
  690. package/dist/features/network/intercept/websocket.js.map +1 -0
  691. package/dist/features/network/lazy.d.ts +23 -0
  692. package/dist/features/network/lazy.d.ts.map +1 -0
  693. package/dist/features/network/lazy.js +65 -0
  694. package/dist/features/network/lazy.js.map +1 -0
  695. package/dist/features/network/normalize.d.ts +9 -0
  696. package/dist/features/network/normalize.d.ts.map +1 -0
  697. package/dist/features/network/normalize.js +49 -0
  698. package/dist/features/network/normalize.js.map +1 -0
  699. package/dist/features/network/parse/graphql.d.ts +17 -0
  700. package/dist/features/network/parse/graphql.d.ts.map +1 -0
  701. package/dist/features/network/parse/graphql.js +106 -0
  702. package/dist/features/network/parse/graphql.js.map +1 -0
  703. package/dist/features/network/parse/url.d.ts +12 -0
  704. package/dist/features/network/parse/url.d.ts.map +1 -0
  705. package/dist/features/network/parse/url.js +52 -0
  706. package/dist/features/network/parse/url.js.map +1 -0
  707. package/dist/features/network/sampler.d.ts +21 -0
  708. package/dist/features/network/sampler.d.ts.map +1 -0
  709. package/dist/features/network/sampler.js +25 -0
  710. package/dist/features/network/sampler.js.map +1 -0
  711. package/dist/features/network/size.d.ts +21 -0
  712. package/dist/features/network/size.d.ts.map +1 -0
  713. package/dist/features/network/size.js +63 -0
  714. package/dist/features/network/size.js.map +1 -0
  715. package/dist/features/network/timing.d.ts +41 -0
  716. package/dist/features/network/timing.d.ts.map +1 -0
  717. package/dist/features/network/timing.js +134 -0
  718. package/dist/features/network/timing.js.map +1 -0
  719. package/dist/features/network/tracing.d.ts +18 -0
  720. package/dist/features/network/tracing.d.ts.map +1 -0
  721. package/dist/features/network/tracing.js +46 -0
  722. package/dist/features/network/tracing.js.map +1 -0
  723. package/dist/features/network/types.d.ts +75 -0
  724. package/dist/features/network/types.d.ts.map +1 -0
  725. package/dist/features/network/types.js +2 -0
  726. package/dist/features/network/types.js.map +1 -0
  727. package/dist/features/network/xhrInterceptor.d.ts +12 -0
  728. package/dist/features/network/xhrInterceptor.d.ts.map +1 -0
  729. package/dist/features/network/xhrInterceptor.js +108 -0
  730. package/dist/features/network/xhrInterceptor.js.map +1 -0
  731. package/dist/features/performance/PerformanceFeature.d.ts +76 -0
  732. package/dist/features/performance/PerformanceFeature.d.ts.map +1 -0
  733. package/dist/features/performance/PerformanceFeature.js +265 -0
  734. package/dist/features/performance/PerformanceFeature.js.map +1 -0
  735. package/dist/features/performance/jankTap.d.ts +23 -0
  736. package/dist/features/performance/jankTap.d.ts.map +1 -0
  737. package/dist/features/performance/jankTap.js +20 -0
  738. package/dist/features/performance/jankTap.js.map +1 -0
  739. package/dist/features/performance/longTasks.d.ts +14 -0
  740. package/dist/features/performance/longTasks.d.ts.map +1 -0
  741. package/dist/features/performance/longTasks.js +55 -0
  742. package/dist/features/performance/longTasks.js.map +1 -0
  743. package/dist/features/performance/normalize.d.ts +15 -0
  744. package/dist/features/performance/normalize.d.ts.map +1 -0
  745. package/dist/features/performance/normalize.js +30 -0
  746. package/dist/features/performance/normalize.js.map +1 -0
  747. package/dist/features/performance/resources.d.ts +19 -0
  748. package/dist/features/performance/resources.d.ts.map +1 -0
  749. package/dist/features/performance/resources.js +78 -0
  750. package/dist/features/performance/resources.js.map +1 -0
  751. package/dist/features/performance/sampler.d.ts +10 -0
  752. package/dist/features/performance/sampler.d.ts.map +1 -0
  753. package/dist/features/performance/sampler.js +23 -0
  754. package/dist/features/performance/sampler.js.map +1 -0
  755. package/dist/features/performance/spa.d.ts +2 -0
  756. package/dist/features/performance/spa.d.ts.map +1 -0
  757. package/dist/features/performance/spa.js +40 -0
  758. package/dist/features/performance/spa.js.map +1 -0
  759. package/dist/features/performance/throttle.d.ts +21 -0
  760. package/dist/features/performance/throttle.d.ts.map +1 -0
  761. package/dist/features/performance/throttle.js +26 -0
  762. package/dist/features/performance/throttle.js.map +1 -0
  763. package/dist/features/performance/trace/context.d.ts +17 -0
  764. package/dist/features/performance/trace/context.d.ts.map +1 -0
  765. package/dist/features/performance/trace/context.js +33 -0
  766. package/dist/features/performance/trace/context.js.map +1 -0
  767. package/dist/features/performance/trace/index.d.ts +7 -0
  768. package/dist/features/performance/trace/index.d.ts.map +1 -0
  769. package/dist/features/performance/trace/index.js +6 -0
  770. package/dist/features/performance/trace/index.js.map +1 -0
  771. package/dist/features/performance/trace/pageload.d.ts +3 -0
  772. package/dist/features/performance/trace/pageload.d.ts.map +1 -0
  773. package/dist/features/performance/trace/pageload.js +34 -0
  774. package/dist/features/performance/trace/pageload.js.map +1 -0
  775. package/dist/features/performance/trace/transaction.d.ts +61 -0
  776. package/dist/features/performance/trace/transaction.d.ts.map +1 -0
  777. package/dist/features/performance/trace/transaction.js +90 -0
  778. package/dist/features/performance/trace/transaction.js.map +1 -0
  779. package/dist/features/performance/trace/types.d.ts +23 -0
  780. package/dist/features/performance/trace/types.d.ts.map +1 -0
  781. package/dist/features/performance/trace/types.js +10 -0
  782. package/dist/features/performance/trace/types.js.map +1 -0
  783. package/dist/features/performance/traces.d.ts +36 -0
  784. package/dist/features/performance/traces.d.ts.map +1 -0
  785. package/dist/features/performance/traces.js +50 -0
  786. package/dist/features/performance/traces.js.map +1 -0
  787. package/dist/features/profiler/ProfilerFeature.d.ts +28 -0
  788. package/dist/features/profiler/ProfilerFeature.d.ts.map +1 -0
  789. package/dist/features/profiler/ProfilerFeature.js +82 -0
  790. package/dist/features/profiler/ProfilerFeature.js.map +1 -0
  791. package/dist/features/profiler/capture.d.ts +8 -0
  792. package/dist/features/profiler/capture.d.ts.map +1 -0
  793. package/dist/features/profiler/capture.js +21 -0
  794. package/dist/features/profiler/capture.js.map +1 -0
  795. package/dist/features/push/PushFeature.d.ts +120 -0
  796. package/dist/features/push/PushFeature.d.ts.map +1 -0
  797. package/dist/features/push/PushFeature.js +319 -0
  798. package/dist/features/push/PushFeature.js.map +1 -0
  799. package/dist/features/push/diagnostics.d.ts +55 -0
  800. package/dist/features/push/diagnostics.d.ts.map +1 -0
  801. package/dist/features/push/diagnostics.js +383 -0
  802. package/dist/features/push/diagnostics.js.map +1 -0
  803. package/dist/features/push/pushState.d.ts +58 -0
  804. package/dist/features/push/pushState.d.ts.map +1 -0
  805. package/dist/features/push/pushState.js +75 -0
  806. package/dist/features/push/pushState.js.map +1 -0
  807. package/dist/features/push/softAsk.d.ts +68 -0
  808. package/dist/features/push/softAsk.d.ts.map +1 -0
  809. package/dist/features/push/softAsk.js +141 -0
  810. package/dist/features/push/softAsk.js.map +1 -0
  811. package/dist/features/replay/ReplayFeature.d.ts +32 -0
  812. package/dist/features/replay/ReplayFeature.d.ts.map +1 -0
  813. package/dist/features/replay/ReplayFeature.js +132 -0
  814. package/dist/features/replay/ReplayFeature.js.map +1 -0
  815. package/dist/features/replay/engine/canvas.d.ts +45 -0
  816. package/dist/features/replay/engine/canvas.d.ts.map +1 -0
  817. package/dist/features/replay/engine/canvas.js +122 -0
  818. package/dist/features/replay/engine/canvas.js.map +1 -0
  819. package/dist/features/replay/engine/crossOrigin.d.ts +23 -0
  820. package/dist/features/replay/engine/crossOrigin.d.ts.map +1 -0
  821. package/dist/features/replay/engine/crossOrigin.js +108 -0
  822. package/dist/features/replay/engine/crossOrigin.js.map +1 -0
  823. package/dist/features/replay/engine/cssom.d.ts +31 -0
  824. package/dist/features/replay/engine/cssom.d.ts.map +1 -0
  825. package/dist/features/replay/engine/cssom.js +128 -0
  826. package/dist/features/replay/engine/cssom.js.map +1 -0
  827. package/dist/features/replay/engine/iframe.d.ts +65 -0
  828. package/dist/features/replay/engine/iframe.d.ts.map +1 -0
  829. package/dist/features/replay/engine/iframe.js +186 -0
  830. package/dist/features/replay/engine/iframe.js.map +1 -0
  831. package/dist/features/replay/engine/interactions.d.ts +142 -0
  832. package/dist/features/replay/engine/interactions.d.ts.map +1 -0
  833. package/dist/features/replay/engine/interactions.js +371 -0
  834. package/dist/features/replay/engine/interactions.js.map +1 -0
  835. package/dist/features/replay/engine/mutations.d.ts +49 -0
  836. package/dist/features/replay/engine/mutations.d.ts.map +1 -0
  837. package/dist/features/replay/engine/mutations.js +261 -0
  838. package/dist/features/replay/engine/mutations.js.map +1 -0
  839. package/dist/features/replay/engine/nodeRegistry.d.ts +23 -0
  840. package/dist/features/replay/engine/nodeRegistry.d.ts.map +1 -0
  841. package/dist/features/replay/engine/nodeRegistry.js +51 -0
  842. package/dist/features/replay/engine/nodeRegistry.js.map +1 -0
  843. package/dist/features/replay/engine/player.d.ts +11 -0
  844. package/dist/features/replay/engine/player.d.ts.map +1 -0
  845. package/dist/features/replay/engine/player.js +284 -0
  846. package/dist/features/replay/engine/player.js.map +1 -0
  847. package/dist/features/replay/engine/rebuild.d.ts +8 -0
  848. package/dist/features/replay/engine/rebuild.d.ts.map +1 -0
  849. package/dist/features/replay/engine/rebuild.js +46 -0
  850. package/dist/features/replay/engine/rebuild.js.map +1 -0
  851. package/dist/features/replay/engine/replayWorker.d.ts +33 -0
  852. package/dist/features/replay/engine/replayWorker.d.ts.map +1 -0
  853. package/dist/features/replay/engine/replayWorker.js +175 -0
  854. package/dist/features/replay/engine/replayWorker.js.map +1 -0
  855. package/dist/features/replay/engine/resources.d.ts +52 -0
  856. package/dist/features/replay/engine/resources.d.ts.map +1 -0
  857. package/dist/features/replay/engine/resources.js +132 -0
  858. package/dist/features/replay/engine/resources.js.map +1 -0
  859. package/dist/features/replay/engine/snapshot.d.ts +103 -0
  860. package/dist/features/replay/engine/snapshot.d.ts.map +1 -0
  861. package/dist/features/replay/engine/snapshot.js +409 -0
  862. package/dist/features/replay/engine/snapshot.js.map +1 -0
  863. package/dist/features/replay/engine/traverse.d.ts +19 -0
  864. package/dist/features/replay/engine/traverse.d.ts.map +1 -0
  865. package/dist/features/replay/engine/traverse.js +39 -0
  866. package/dist/features/replay/engine/traverse.js.map +1 -0
  867. package/dist/features/replay/engine/types.d.ts +137 -0
  868. package/dist/features/replay/engine/types.d.ts.map +1 -0
  869. package/dist/features/replay/engine/types.js +6 -0
  870. package/dist/features/replay/engine/types.js.map +1 -0
  871. package/dist/features/replay/engine/webglPatch.d.ts +26 -0
  872. package/dist/features/replay/engine/webglPatch.d.ts.map +1 -0
  873. package/dist/features/replay/engine/webglPatch.js +83 -0
  874. package/dist/features/replay/engine/webglPatch.js.map +1 -0
  875. package/dist/features/replay/lifecycle/adaptive.d.ts +38 -0
  876. package/dist/features/replay/lifecycle/adaptive.d.ts.map +1 -0
  877. package/dist/features/replay/lifecycle/adaptive.js +90 -0
  878. package/dist/features/replay/lifecycle/adaptive.js.map +1 -0
  879. package/dist/features/replay/lifecycle/cadence.d.ts +20 -0
  880. package/dist/features/replay/lifecycle/cadence.d.ts.map +1 -0
  881. package/dist/features/replay/lifecycle/cadence.js +62 -0
  882. package/dist/features/replay/lifecycle/cadence.js.map +1 -0
  883. package/dist/features/replay/lifecycle/deviceSignals.d.ts +35 -0
  884. package/dist/features/replay/lifecycle/deviceSignals.d.ts.map +1 -0
  885. package/dist/features/replay/lifecycle/deviceSignals.js +61 -0
  886. package/dist/features/replay/lifecycle/deviceSignals.js.map +1 -0
  887. package/dist/features/replay/lifecycle/pii.d.ts +14 -0
  888. package/dist/features/replay/lifecycle/pii.d.ts.map +1 -0
  889. package/dist/features/replay/lifecycle/pii.js +52 -0
  890. package/dist/features/replay/lifecycle/pii.js.map +1 -0
  891. package/dist/features/replay/lifecycle/recorder.d.ts +129 -0
  892. package/dist/features/replay/lifecycle/recorder.d.ts.map +1 -0
  893. package/dist/features/replay/lifecycle/recorder.js +509 -0
  894. package/dist/features/replay/lifecycle/recorder.js.map +1 -0
  895. package/dist/features/replay/lifecycle/sampling.d.ts +28 -0
  896. package/dist/features/replay/lifecycle/sampling.d.ts.map +1 -0
  897. package/dist/features/replay/lifecycle/sampling.js +31 -0
  898. package/dist/features/replay/lifecycle/sampling.js.map +1 -0
  899. package/dist/features/replay/lifecycle/segmentBuffer.d.ts +75 -0
  900. package/dist/features/replay/lifecycle/segmentBuffer.d.ts.map +1 -0
  901. package/dist/features/replay/lifecycle/segmentBuffer.js +130 -0
  902. package/dist/features/replay/lifecycle/segmentBuffer.js.map +1 -0
  903. package/dist/features/replay/lifecycle/viewContext.d.ts +7 -0
  904. package/dist/features/replay/lifecycle/viewContext.d.ts.map +1 -0
  905. package/dist/features/replay/lifecycle/viewContext.js +51 -0
  906. package/dist/features/replay/lifecycle/viewContext.js.map +1 -0
  907. package/dist/features/scroll/index.d.ts +31 -0
  908. package/dist/features/scroll/index.d.ts.map +1 -0
  909. package/dist/features/scroll/index.js +102 -0
  910. package/dist/features/scroll/index.js.map +1 -0
  911. package/dist/features/session/sessionManager.d.ts +25 -0
  912. package/dist/features/session/sessionManager.d.ts.map +1 -0
  913. package/dist/features/session/sessionManager.js +36 -0
  914. package/dist/features/session/sessionManager.js.map +1 -0
  915. package/dist/features/session/sessionStore.d.ts +106 -0
  916. package/dist/features/session/sessionStore.d.ts.map +1 -0
  917. package/dist/features/session/sessionStore.js +265 -0
  918. package/dist/features/session/sessionStore.js.map +1 -0
  919. package/dist/features/watchdog/WatchdogFeature.d.ts +23 -0
  920. package/dist/features/watchdog/WatchdogFeature.d.ts.map +1 -0
  921. package/dist/features/watchdog/WatchdogFeature.js +29 -0
  922. package/dist/features/watchdog/WatchdogFeature.js.map +1 -0
  923. package/dist/features/watchdog/collectors.d.ts +18 -0
  924. package/dist/features/watchdog/collectors.d.ts.map +1 -0
  925. package/dist/features/watchdog/collectors.js +107 -0
  926. package/dist/features/watchdog/collectors.js.map +1 -0
  927. package/dist/features/watchdog/config.d.ts +51 -0
  928. package/dist/features/watchdog/config.d.ts.map +1 -0
  929. package/dist/features/watchdog/config.js +28 -0
  930. package/dist/features/watchdog/config.js.map +1 -0
  931. package/dist/features/watchdog/engine.d.ts +22 -0
  932. package/dist/features/watchdog/engine.d.ts.map +1 -0
  933. package/dist/features/watchdog/engine.js +123 -0
  934. package/dist/features/watchdog/engine.js.map +1 -0
  935. package/dist/features/watchdog/incidents.d.ts +79 -0
  936. package/dist/features/watchdog/incidents.d.ts.map +1 -0
  937. package/dist/features/watchdog/incidents.js +204 -0
  938. package/dist/features/watchdog/incidents.js.map +1 -0
  939. package/dist/features/watchdog/rollup.d.ts +41 -0
  940. package/dist/features/watchdog/rollup.d.ts.map +1 -0
  941. package/dist/features/watchdog/rollup.js +76 -0
  942. package/dist/features/watchdog/rollup.js.map +1 -0
  943. package/dist/features/webVitals/WebVitalsFeature.d.ts +46 -0
  944. package/dist/features/webVitals/WebVitalsFeature.d.ts.map +1 -0
  945. package/dist/features/webVitals/WebVitalsFeature.js +252 -0
  946. package/dist/features/webVitals/WebVitalsFeature.js.map +1 -0
  947. package/dist/features/webVitals/attribution.d.ts +50 -0
  948. package/dist/features/webVitals/attribution.d.ts.map +1 -0
  949. package/dist/features/webVitals/attribution.js +186 -0
  950. package/dist/features/webVitals/attribution.js.map +1 -0
  951. package/dist/features/webVitals/observe.d.ts +6 -0
  952. package/dist/features/webVitals/observe.d.ts.map +1 -0
  953. package/dist/features/webVitals/observe.js +6 -0
  954. package/dist/features/webVitals/observe.js.map +1 -0
  955. package/dist/features/webVitals/vitals.d.ts +99 -0
  956. package/dist/features/webVitals/vitals.d.ts.map +1 -0
  957. package/dist/features/webVitals/vitals.js +166 -0
  958. package/dist/features/webVitals/vitals.js.map +1 -0
  959. package/dist/features/webperf/WebPerfFeature.d.ts +19 -0
  960. package/dist/features/webperf/WebPerfFeature.d.ts.map +1 -0
  961. package/dist/features/webperf/WebPerfFeature.js +48 -0
  962. package/dist/features/webperf/WebPerfFeature.js.map +1 -0
  963. package/dist/features/webperf/collectors.d.ts +3 -0
  964. package/dist/features/webperf/collectors.d.ts.map +1 -0
  965. package/dist/features/webperf/collectors.js +118 -0
  966. package/dist/features/webperf/collectors.js.map +1 -0
  967. package/dist/features/webperf/math.d.ts +12 -0
  968. package/dist/features/webperf/math.d.ts.map +1 -0
  969. package/dist/features/webperf/math.js +26 -0
  970. package/dist/features/webperf/math.js.map +1 -0
  971. package/dist/inapp.d.ts +6 -0
  972. package/dist/inapp.d.ts.map +1 -0
  973. package/dist/inapp.js +6 -0
  974. package/dist/inapp.js.map +1 -0
  975. package/dist/index.d.ts +31 -0
  976. package/dist/index.d.ts.map +1 -0
  977. package/dist/index.js +12 -0
  978. package/dist/index.js.map +1 -0
  979. package/dist/integrations/index.d.ts +7 -0
  980. package/dist/integrations/index.d.ts.map +1 -0
  981. package/dist/integrations/index.js +2 -0
  982. package/dist/integrations/index.js.map +1 -0
  983. package/dist/pipeline/index.d.ts +3 -0
  984. package/dist/pipeline/index.d.ts.map +1 -0
  985. package/dist/pipeline/index.js +3 -0
  986. package/dist/pipeline/index.js.map +1 -0
  987. package/dist/pipeline/pipeline.d.ts +84 -0
  988. package/dist/pipeline/pipeline.d.ts.map +1 -0
  989. package/dist/pipeline/pipeline.js +284 -0
  990. package/dist/pipeline/pipeline.js.map +1 -0
  991. package/dist/public/ScaleBunFacade.d.ts +382 -0
  992. package/dist/public/ScaleBunFacade.d.ts.map +1 -0
  993. package/dist/public/ScaleBunFacade.js +787 -0
  994. package/dist/public/ScaleBunFacade.js.map +1 -0
  995. package/dist/public/index.d.ts +5 -0
  996. package/dist/public/index.d.ts.map +1 -0
  997. package/dist/public/index.js +4 -0
  998. package/dist/public/index.js.map +1 -0
  999. package/dist/public/typedTracker.d.ts +91 -0
  1000. package/dist/public/typedTracker.d.ts.map +1 -0
  1001. package/dist/public/typedTracker.js +60 -0
  1002. package/dist/public/typedTracker.js.map +1 -0
  1003. package/dist/scalebun-push-sw.js +236 -0
  1004. package/dist/scalebun.min.js +635 -0
  1005. package/dist/scalebun.min.js.map +7 -0
  1006. package/dist/storage/idb.d.ts +16 -0
  1007. package/dist/storage/idb.d.ts.map +1 -0
  1008. package/dist/storage/idb.js +76 -0
  1009. package/dist/storage/idb.js.map +1 -0
  1010. package/dist/storage/index.d.ts +3 -0
  1011. package/dist/storage/index.d.ts.map +1 -0
  1012. package/dist/storage/index.js +3 -0
  1013. package/dist/storage/index.js.map +1 -0
  1014. package/dist/transport/gzip.d.ts +2 -0
  1015. package/dist/transport/gzip.d.ts.map +1 -0
  1016. package/dist/transport/gzip.js +20 -0
  1017. package/dist/transport/gzip.js.map +1 -0
  1018. package/dist/transport/httpClient.d.ts +60 -0
  1019. package/dist/transport/httpClient.d.ts.map +1 -0
  1020. package/dist/transport/httpClient.js +154 -0
  1021. package/dist/transport/httpClient.js.map +1 -0
  1022. package/dist/transport/index.d.ts +3 -0
  1023. package/dist/transport/index.d.ts.map +1 -0
  1024. package/dist/transport/index.js +3 -0
  1025. package/dist/transport/index.js.map +1 -0
  1026. package/dist/transport/sign.d.ts +25 -0
  1027. package/dist/transport/sign.d.ts.map +1 -0
  1028. package/dist/transport/sign.js +58 -0
  1029. package/dist/transport/sign.js.map +1 -0
  1030. package/package.json +60 -0
@@ -0,0 +1,757 @@
1
+ import { uuid, now, getReplayCoord, scrubProps, SDK_VERSION } from '../../core';
2
+ import { evaluateEvent } from './governance';
3
+ import { normalizeRevenue } from './revenue';
4
+ import { normalizeSubscription } from './subscription';
5
+ import { keepEvent } from './sampler';
6
+ import { PersistentBuffer } from '../../storage/idb';
7
+ import { Backoff, isOnline, onOnline } from '../../core/retry';
8
+ import { capBytes, freshOnly } from '../../core/prune';
9
+ const BATCH_MAX = 50;
10
+ const FLUSH_MS = 5000;
11
+ const QUEUE_CAP = 2000; // bound memory; drop oldest beyond this
12
+ const K_ANON = 'scalebun_anonymous_id';
13
+ /**
14
+ * The IDENTIFIED user, persisted beside the anonymous id. (SESSIONS-REAL-DATA-PLAN §2b)
15
+ *
16
+ * `userId` used to be an in-memory field only, so the identity died with the document: an app that
17
+ * called identify() at login went back to Anonymous on the next page load, and every session after
18
+ * the first was unattributed. The anonymous id was already persisted — this is the half that was
19
+ * missing. Cleared by reset() so the next user is never attributed to the previous one.
20
+ */
21
+ const K_UID = 'scalebun_user_id';
22
+ const K_SUPER = 'scalebun_super_props'; // A1 — registered global properties, merged into every event
23
+ const K_GROUPS = 'scalebun_groups'; // A1 — B2B group memberships { groupType: groupKey }
24
+ // W1b — install attribution (RN storage-key parity).
25
+ const K_INSTALL = 'scalebun_installation_id';
26
+ const K_FIRSTOPEN = 'scalebun_first_open_done';
27
+ const K_CLICK = 'scalebun_attribution_click_id';
28
+ const K_ATTR = 'scalebun_attribution'; // W6.0 — persisted FIRST-TOUCH web acquisition (referrer/utm/landing)
29
+ const CLICK_RE = /^[0-9a-f]{16,64}$/i; // our redirect issues a 32-hex click id; stay tolerant
30
+ const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
31
+ /**
32
+ * W6.0 — capture FIRST-TOUCH web acquisition once and persist it (referrer + UTM + landing page + ad
33
+ * click ids), mirroring the "initial UTM as super-property" pattern. Merged into every event's props so
34
+ * any session groups by source/medium/campaign/channel server-side. Never overwrites an existing first
35
+ * touch (a later direct visit must not erase the acquiring campaign). Referrer query is stripped (PII).
36
+ */
37
+ function captureWebAttribution() {
38
+ try {
39
+ if (typeof localStorage !== 'undefined') {
40
+ const raw = localStorage.getItem(K_ATTR);
41
+ if (raw) {
42
+ const v = JSON.parse(raw);
43
+ if (v && typeof v === 'object')
44
+ return { props: v, isNew: false };
45
+ }
46
+ }
47
+ }
48
+ catch {
49
+ /* storage disabled / corrupt → recapture */
50
+ }
51
+ const out = {};
52
+ try {
53
+ if (typeof location !== 'undefined') {
54
+ const url = new URL(location.href);
55
+ for (const k of UTM_KEYS) {
56
+ const v = url.searchParams.get(k);
57
+ if (v)
58
+ out[k] = v.slice(0, 200);
59
+ }
60
+ for (const k of ['fbclid', 'gclid']) {
61
+ const v = url.searchParams.get(k);
62
+ if (v)
63
+ out[k] = v.slice(0, 512);
64
+ }
65
+ }
66
+ if (typeof document !== 'undefined' && document.referrer) {
67
+ try {
68
+ const ref = new URL(document.referrer);
69
+ out.referrer = (ref.origin + ref.pathname).slice(0, 512); // strip query/hash → no referrer PII
70
+ out.referrer_domain = ref.hostname;
71
+ }
72
+ catch {
73
+ out.referrer = document.referrer.split('?')[0].slice(0, 512);
74
+ }
75
+ }
76
+ }
77
+ catch {
78
+ /* malformed URL */
79
+ }
80
+ // Attribution = the ACQUISITION touch. A direct visit (no referrer/utm/click) has none, so we stamp
81
+ // nothing (entry/landing for every session is derived from $pageview downstream). Only when there IS a
82
+ // signal do we add the campaign's landing page + persist it as the durable first touch.
83
+ if (!out.referrer && !out.utm_source && !out.fbclid && !out.gclid)
84
+ return { props: {}, isNew: false };
85
+ try {
86
+ if (typeof location !== 'undefined')
87
+ out.landing_url = location.pathname.slice(0, 512);
88
+ if (typeof localStorage !== 'undefined')
89
+ localStorage.setItem(K_ATTR, JSON.stringify(out));
90
+ }
91
+ catch {
92
+ /* storage disabled — rides this session only */
93
+ }
94
+ return { props: out, isNew: true }; // freshly acquired → the caller records the touchpoint once
95
+ }
96
+ // Distinct IndexedDB record so unsent /batch events survive a reload/crash — independent of the
97
+ // session pipeline's 'pending' record. Backend dedups by (appId, event_id), so reload re-sends are safe.
98
+ const IDB_KEY = 'pending-analytics';
99
+ /** Persisted identified-user id; undefined when anonymous or storage is unavailable. */
100
+ function loadUid() {
101
+ try {
102
+ if (typeof localStorage !== 'undefined')
103
+ return localStorage.getItem(K_UID) || undefined;
104
+ }
105
+ catch {
106
+ /* storage disabled → identity lasts this document only */
107
+ }
108
+ return undefined;
109
+ }
110
+ function saveUid(uid) {
111
+ try {
112
+ if (typeof localStorage === 'undefined')
113
+ return;
114
+ if (uid)
115
+ localStorage.setItem(K_UID, uid);
116
+ else
117
+ localStorage.removeItem(K_UID);
118
+ }
119
+ catch {
120
+ /* storage disabled */
121
+ }
122
+ }
123
+ function newAnonId() {
124
+ return `anon_${uuid()}`;
125
+ }
126
+ /** Read a persisted JSON record (super-props / groups); returns {} on any failure. */
127
+ function loadJson(key) {
128
+ try {
129
+ if (typeof localStorage !== 'undefined') {
130
+ const raw = localStorage.getItem(key);
131
+ if (raw) {
132
+ const v = JSON.parse(raw);
133
+ if (v && typeof v === 'object')
134
+ return v;
135
+ }
136
+ }
137
+ }
138
+ catch {
139
+ /* storage disabled / corrupt */
140
+ }
141
+ return {};
142
+ }
143
+ function saveJson(key, value) {
144
+ try {
145
+ if (typeof localStorage === 'undefined')
146
+ return;
147
+ if (Object.keys(value).length)
148
+ localStorage.setItem(key, JSON.stringify(value));
149
+ else
150
+ localStorage.removeItem(key);
151
+ }
152
+ catch {
153
+ /* storage disabled — in-memory copy still applies this session */
154
+ }
155
+ }
156
+ // A6 — cross-subdomain sharing: a cookie scoped to `cookieDomain` (e.g. '.example.com') lets
157
+ // app./www./shop. resolve to ONE anonymous id. localStorage stays the per-origin fallback.
158
+ function readCookie(name) {
159
+ try {
160
+ if (typeof document === 'undefined')
161
+ return null;
162
+ const m = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
163
+ const v = m?.[1];
164
+ return v != null ? decodeURIComponent(v) : null;
165
+ }
166
+ catch {
167
+ return null;
168
+ }
169
+ }
170
+ function writeCookie(name, value, domain) {
171
+ try {
172
+ if (typeof document === 'undefined')
173
+ return;
174
+ const parts = [`${name}=${encodeURIComponent(value)}`, 'path=/', 'max-age=31536000', 'SameSite=Lax'];
175
+ if (domain)
176
+ parts.push(`domain=${domain}`);
177
+ document.cookie = parts.join('; ');
178
+ }
179
+ catch {
180
+ /* cookies disabled */
181
+ }
182
+ }
183
+ /**
184
+ * W1b — resolve the stable INSTALL id (distinct from the device id, but seeded from it on first run so
185
+ * existing web users don't register as brand-new installs) and capture a deferred deep-link `scalebun_click_id`
186
+ * from the landing URL (persist + scrub it from the address bar → privacy + no re-capture on share/refresh).
187
+ * The backend attribution engine already consumes `installation_id` + `identifiers.click_id`.
188
+ */
189
+ function resolveAttribution(deviceId) {
190
+ let installationId = '';
191
+ let clickId;
192
+ try {
193
+ if (typeof localStorage !== 'undefined') {
194
+ installationId = localStorage.getItem(K_INSTALL) ?? '';
195
+ if (!installationId) {
196
+ installationId = deviceId || `web_${uuid()}`; // seed from the existing device id → no phantom install
197
+ localStorage.setItem(K_INSTALL, installationId);
198
+ }
199
+ clickId = localStorage.getItem(K_CLICK) ?? undefined;
200
+ }
201
+ }
202
+ catch {
203
+ /* storage disabled */
204
+ }
205
+ if (!installationId)
206
+ installationId = deviceId || `web_${uuid()}`; // never empty (server requires it)
207
+ try {
208
+ if (typeof location !== 'undefined' && location.search) {
209
+ const url = new URL(location.href);
210
+ const c = url.searchParams.get('scalebun_click_id');
211
+ if (c && CLICK_RE.test(c)) {
212
+ clickId = c;
213
+ try {
214
+ if (typeof localStorage !== 'undefined')
215
+ localStorage.setItem(K_CLICK, c);
216
+ }
217
+ catch {
218
+ /* storage disabled — click still rides this session's events */
219
+ }
220
+ url.searchParams.delete('scalebun_click_id');
221
+ try {
222
+ history.replaceState(history.state, '', url.pathname + url.search + url.hash);
223
+ }
224
+ catch {
225
+ /* history unavailable — leave the URL as-is */
226
+ }
227
+ }
228
+ }
229
+ }
230
+ catch {
231
+ /* malformed URL */
232
+ }
233
+ return clickId ? { installationId, clickId } : { installationId };
234
+ }
235
+ function loadAnonId(cookieDomain) {
236
+ // Cross-subdomain: the shared cookie is the source of truth so every sub-domain resolves to one id.
237
+ if (cookieDomain) {
238
+ const c = readCookie(K_ANON);
239
+ if (c) {
240
+ try {
241
+ if (typeof localStorage !== 'undefined')
242
+ localStorage.setItem(K_ANON, c);
243
+ }
244
+ catch {
245
+ /* storage disabled */
246
+ }
247
+ return c;
248
+ }
249
+ }
250
+ try {
251
+ if (typeof localStorage !== 'undefined') {
252
+ const existing = localStorage.getItem(K_ANON);
253
+ const id = existing ?? newAnonId();
254
+ if (!existing)
255
+ localStorage.setItem(K_ANON, id);
256
+ if (cookieDomain)
257
+ writeCookie(K_ANON, id, cookieDomain);
258
+ return id;
259
+ }
260
+ }
261
+ catch {
262
+ /* storage disabled */
263
+ }
264
+ const id = newAnonId();
265
+ if (cookieDomain)
266
+ writeCookie(K_ANON, id, cookieDomain);
267
+ return id;
268
+ }
269
+ export class AnalyticsFeature {
270
+ constructor() {
271
+ this.name = 'analytics';
272
+ this.ctx = null;
273
+ this.active = false;
274
+ this.clientKey = '';
275
+ this.apiBaseUrl = '';
276
+ this.deviceId = '';
277
+ this.installationId = ''; // W1b — stable install id (seeded from deviceId; distinct thereafter)
278
+ this.attributionProps = {}; // W6.0 — first-touch web acquisition, merged into every event
279
+ this.anonymousId = '';
280
+ this.userId = loadUid();
281
+ this.superProps = {}; // A1 — merged into every event's properties
282
+ this.groups = {}; // A1 — B2B group memberships stamped on every event
283
+ this.queue = [];
284
+ this.buffer = new PersistentBuffer(IDB_KEY);
285
+ this.persisted = false; // whether IDB currently holds a non-empty snapshot (avoids redundant writes)
286
+ this.backoff = new Backoff();
287
+ this.sampleRate = 1; // A6 — per-user analytics sampling (1 = keep all)
288
+ this.droppedCount = 0;
289
+ this.sampledOutCount = 0; // A7 — events thinned by per-user sampling
290
+ this.flushCount = 0; // A7 — successful /batch sends
291
+ }
292
+ /** Egress telemetry (Dev Panel / debug): events waiting to send + events dropped (queue overflow
293
+ * or stale-on-reload). */
294
+ get pending() {
295
+ return this.queue.length;
296
+ }
297
+ get dropped() {
298
+ return this.droppedCount;
299
+ }
300
+ /** A7 — analytics-lane observability (parity with perfStats/egressStats). */
301
+ get stats() {
302
+ return {
303
+ pending: this.queue.length,
304
+ dropped: this.droppedCount,
305
+ sampledOut: this.sampledOutCount,
306
+ flushes: this.flushCount,
307
+ sampleRate: this.sampleRate,
308
+ };
309
+ }
310
+ get isActive() {
311
+ return this.active;
312
+ }
313
+ setup(ctx) {
314
+ this.ctx = ctx;
315
+ this.clientKey = ctx.clientKey ?? '';
316
+ this.apiBaseUrl = ctx.apiBaseUrl ?? '';
317
+ this.deviceId = ctx.deviceId ?? '';
318
+ // W1b — resolve the stable install id + capture a deferred deep-link click token BEFORE any event is
319
+ // built, so every event carries a consistent installation_id (no split-install race).
320
+ const attr = resolveAttribution(this.deviceId);
321
+ this.installationId = attr.installationId;
322
+ this.clickId = attr.clickId;
323
+ const attrib = captureWebAttribution(); // W6.0 — first-touch referrer/utm/landing
324
+ this.attributionProps = attrib.props;
325
+ this.cookieDomain = ctx.analyticsOptions?.cookieDomain; // A6
326
+ this.anonymousId = loadAnonId(this.cookieDomain);
327
+ this.superProps = loadJson(K_SUPER);
328
+ this.groups = loadJson(K_GROUPS);
329
+ this.plan = ctx.analyticsOptions?.plan; // A3
330
+ const sr = ctx.analyticsOptions?.sampleRate; // A6
331
+ if (typeof sr === 'number' && sr >= 0 && sr <= 1)
332
+ this.sampleRate = sr;
333
+ if (!this.clientKey || !this.apiBaseUrl)
334
+ return;
335
+ // W6.1 — record the acquisition touchpoint once (server classifies the channel). After the identity
336
+ // is resolved so the touchpoint stitches to the right session/subject.
337
+ if (attrib.isNew)
338
+ void this.recordTouchpoint();
339
+ this.timer = setInterval(() => this.autoFlush(), FLUSH_MS);
340
+ if (typeof window !== 'undefined') {
341
+ // On page close: snapshot the queue to IDB FIRST (survives if the keepalive send dies mid-flight),
342
+ // then keepalive-flush. A successful send clears the snapshot; a reload re-sends (server dedups).
343
+ this.onHide = () => {
344
+ void this.persist();
345
+ void this.flush(true);
346
+ };
347
+ window.addEventListener('pagehide', this.onHide);
348
+ }
349
+ // On reconnect: clear the backoff window and flush immediately (don't wait for the next tick).
350
+ this.offOnline = onOnline(() => {
351
+ this.backoff.reset();
352
+ this.autoFlush();
353
+ });
354
+ this.active = true;
355
+ // W1b — emit `first_open` exactly once per install (RN parity) → triggers the backend attribution
356
+ // matcher (click_id → deterministic install attribution). Idempotent server-side too.
357
+ this.maybeFirstOpen();
358
+ // A2 — promote friction (rage/dead click) from the capture-signal bus to first-class product
359
+ // events, so frustration funnels ("who rage-clicked before churning") work with zero setup.
360
+ this.offSignal = ctx.onSignal?.((reason, detail) => {
361
+ if (!this.active)
362
+ return;
363
+ if (reason === 'rage')
364
+ this.track('$rageclick');
365
+ else if (reason === 'dead')
366
+ this.track('$deadclick');
367
+ else if (reason === 'shake')
368
+ this.track('$shake'); // W5.1 — implicit frustration signal
369
+ // Errors → a product event, so "users who hit an error" is a cohort and a funnel step rather
370
+ // than something only visible in the errors lane. The errors lane still owns the full report
371
+ // (stack, frames, causes); this is the aggregate-analytics shadow of it, keyed by fingerprint
372
+ // so the two can be joined.
373
+ else if (reason === 'error')
374
+ this.track('$exception', detail);
375
+ // Vitals were performance-lane-only, so "conversion for sessions whose LCP was poor" could not be
376
+ // asked. The rating travels with the value so a funnel filter means the same thing the dashboard
377
+ // colouring does.
378
+ else if (reason === 'web_vital')
379
+ this.track('$web_vital', detail);
380
+ /**
381
+ * Exit intent was session-lane-only, which meant it was captured and unreadable at the same time.
382
+ *
383
+ * ExitIntentFeature calls `ctx.trackEvent`, and that writes to the SESSION lane — the right place
384
+ * for the replay timeline, the wrong place for aggregation. Every read that asks "which routes do
385
+ * people try to leave" comes off the analytics lane, so the exit-intent dashboard reported zero
386
+ * while 125 genuine detections sat in the session lane across 8 days. Promoting it here is the
387
+ * same move already made for errors and vitals, and it makes exit intent a funnel step and a
388
+ * cohort ("visitors who tried to leave the pricing page") rather than a replay-only curiosity.
389
+ */
390
+ else if (reason === 'exit_intent')
391
+ this.track('$exit_intent', detail);
392
+ });
393
+ // Drain anything persisted from a previous load (offline/crash before flush) → at-least-once,
394
+ // dropping events older than the max age so a reload doesn't replay stale analytics.
395
+ void this.buffer.load().then((prev) => {
396
+ const arr = Array.isArray(prev) ? prev : [];
397
+ const fresh = freshOnly(arr, (e) => e.event_time, now());
398
+ this.droppedCount += arr.length - fresh.length; // stale events dropped on drain
399
+ if (this.active && fresh.length) {
400
+ this.queue.unshift(...fresh);
401
+ this.trim();
402
+ this.persisted = true;
403
+ this.autoFlush();
404
+ }
405
+ else if (fresh.length < arr.length) {
406
+ void this.buffer.clear(); // snapshot held only stale events → purge it
407
+ }
408
+ });
409
+ // Autocapture (default on) → $autocapture/$submit/$pageview straight onto the analytics lane.
410
+ // Lazy-loaded (event-driven, not latency-critical) so it stays out of the core bundle.
411
+ if (ctx.autocapture !== false) {
412
+ void import('./autocapture')
413
+ .then(({ installAutocapture }) => {
414
+ if (this.active) {
415
+ this.stopAutocapture = installAutocapture({
416
+ // `capture_source: 'automatic'` marks zero-instrumentation capture, matching the RN
417
+ // bus's compactProperties(). The backend event catalog files a definition's `source`
418
+ // off this field, so without it every autocaptured web event was recorded as
419
+ // hand-instrumented `sdk` while the identical mobile event was `automatic`.
420
+ // Stamped here (one site) rather than in each of autocapture's emit points.
421
+ onEvent: (e) => this.track(e.name, { ...e.props, capture_source: 'automatic' }),
422
+ // Opt-in label masking (`privacy.maskEventText`); off by default.
423
+ maskText: ctx.maskEventText === true,
424
+ });
425
+ }
426
+ })
427
+ .catch(() => {
428
+ /* chunk load failed — analytics lane still works without autocapture */
429
+ });
430
+ }
431
+ }
432
+ get usable() {
433
+ return this.active && !!this.clientKey && !!this.apiBaseUrl && typeof fetch !== 'undefined';
434
+ }
435
+ get sessionId() {
436
+ return this.ctx?.sessionId;
437
+ }
438
+ /** W6.1 — record the acquisition touchpoint once (fire-and-forget). The backend classifies the channel
439
+ * from these signals (org rules), stitches to the session/subject, and lights up the Traffic Sources
440
+ * report. Fail-soft: the same signals also ride Event.properties, so nothing is lost if this drops. */
441
+ async recordTouchpoint() {
442
+ if (!this.clientKey || !this.apiBaseUrl || typeof fetch === 'undefined')
443
+ return;
444
+ const p = this.attributionProps;
445
+ try {
446
+ await fetch(`${this.apiBaseUrl}/ingestion/attribution`, {
447
+ method: 'POST',
448
+ headers: { 'content-type': 'application/json', 'x-scalebun-client-key': this.clientKey },
449
+ keepalive: true,
450
+ body: JSON.stringify({
451
+ sessionId: this.sessionId,
452
+ anonymousId: this.anonymousId || undefined,
453
+ source: p.utm_source,
454
+ medium: p.utm_medium,
455
+ campaign: p.utm_campaign,
456
+ content: p.utm_content,
457
+ term: p.utm_term,
458
+ landingUrl: p.landing_url,
459
+ referrer: p.referrer,
460
+ referrerDomain: p.referrer_domain,
461
+ clickToken: this.clickId,
462
+ }),
463
+ });
464
+ }
465
+ catch {
466
+ /* fail-soft — Event.properties still carries the same attribution */
467
+ }
468
+ }
469
+ /** W1b — emit `first_open` once per install. Guarded by localStorage; if storage is unavailable it may
470
+ * re-emit across loads, which the backend once-guard (Installation.firstOpenAt) absorbs. */
471
+ maybeFirstOpen() {
472
+ let done = false;
473
+ try {
474
+ done = typeof localStorage !== 'undefined' && localStorage.getItem(K_FIRSTOPEN) === '1';
475
+ }
476
+ catch {
477
+ /* storage disabled */
478
+ }
479
+ if (done)
480
+ return;
481
+ try {
482
+ if (typeof localStorage !== 'undefined')
483
+ localStorage.setItem(K_FIRSTOPEN, '1');
484
+ }
485
+ catch {
486
+ /* storage disabled */
487
+ }
488
+ this.track('first_open');
489
+ }
490
+ /** W1b — the current install id (for the host / attribution API). */
491
+ getInstallationId() {
492
+ return this.installationId;
493
+ }
494
+ /** W1b — set the deferred deep-link attribution token manually (for hosts running their own redirect).
495
+ * Rides `identifiers.click_id` on every subsequent event; the backend matches it to a Click row. */
496
+ setClickId(id) {
497
+ if (!id || !CLICK_RE.test(id))
498
+ return;
499
+ this.clickId = id;
500
+ try {
501
+ if (typeof localStorage !== 'undefined')
502
+ localStorage.setItem(K_CLICK, id);
503
+ }
504
+ catch {
505
+ /* storage disabled */
506
+ }
507
+ }
508
+ build(name, props) {
509
+ const replay = getReplayCoord(); // A0 — deep-link the event to the live replay frame
510
+ // A1 — super-properties merge under explicit props (call-site props always win). W6.0 — first-touch
511
+ // web attribution (referrer/utm/landing) sits at the lowest precedence, so it rides every event but
512
+ // never clobbers a super-prop or a call-site prop of the same key.
513
+ const base = Object.keys(this.attributionProps).length ? { ...this.attributionProps, ...this.superProps } : this.superProps;
514
+ const merged = Object.keys(base).length ? { ...base, ...props } : props;
515
+ // A3 — PII scrub every event's props (emails/secrets/cards) + normalize the event name.
516
+ const cleaned = merged && Object.keys(merged).length ? scrubProps(merged) : undefined;
517
+ const hasGroups = Object.keys(this.groups).length > 0;
518
+ return {
519
+ event_id: uuid(),
520
+ event_name: name.trim(),
521
+ event_time: now(),
522
+ platform: 'web',
523
+ installation_id: this.installationId,
524
+ ...(this.deviceId ? { device_id: this.deviceId } : {}),
525
+ anonymous_id: this.anonymousId,
526
+ ...(this.sessionId ? { session_id: this.sessionId } : {}),
527
+ ...(this.userId ? { user_id: this.userId } : {}),
528
+ ...(this.clickId ? { identifiers: { click_id: this.clickId } } : {}),
529
+ ...(cleaned ? { properties: cleaned } : {}),
530
+ ...(hasGroups ? { groups: { ...this.groups } } : {}),
531
+ ...(replay ? { replay } : {}),
532
+ context: { sdk_version: SDK_VERSION },
533
+ };
534
+ }
535
+ /** A0/A1 — the current analytics identity + global context, shared with the session lane so both
536
+ * transports stamp the same anon/user id, super-properties and groups onto every event. */
537
+ get identity() {
538
+ return {
539
+ anonymousId: this.anonymousId,
540
+ userId: this.userId,
541
+ groups: this.groups,
542
+ superProps: this.superProps,
543
+ };
544
+ }
545
+ /** A3 — evaluate a user event against the tracking plan (if configured). Warns on violations and
546
+ * returns whether to DROP it (strict mode). The facade calls this once to gate BOTH lanes. */
547
+ evaluate(name, props) {
548
+ if (!this.plan)
549
+ return { drop: false };
550
+ const v = evaluateEvent(this.plan, name, props);
551
+ if (v.warnings.length) {
552
+ try {
553
+ for (const w of v.warnings)
554
+ console.warn(`[scalebun] tracking-plan: ${w}`);
555
+ }
556
+ catch {
557
+ /* console unavailable */
558
+ }
559
+ }
560
+ return { drop: v.drop };
561
+ }
562
+ /** A1 — register global "super" properties merged into every subsequent event (persisted). */
563
+ register(props) {
564
+ if (!props || typeof props !== 'object')
565
+ return;
566
+ this.superProps = { ...this.superProps, ...props };
567
+ saveJson(K_SUPER, this.superProps);
568
+ }
569
+ /** A1 — remove a previously-registered super-property. */
570
+ unregister(key) {
571
+ if (!(key in this.superProps))
572
+ return;
573
+ const { [key]: _drop, ...rest } = this.superProps;
574
+ this.superProps = rest;
575
+ saveJson(K_SUPER, this.superProps);
576
+ }
577
+ /** A1 — associate the user with a B2B group; stamps `groups` on every event + emits one `$group`
578
+ * carrying the group traits (server upserts the group profile, like `$identify` for users). */
579
+ group(groupType, groupKey, traits) {
580
+ if (!groupType || !groupKey)
581
+ return;
582
+ this.groups = { ...this.groups, [groupType]: groupKey };
583
+ saveJson(K_GROUPS, this.groups);
584
+ if (this.usable) {
585
+ this.enqueue(this.build('$group', { group_type: groupType, group_key: groupKey, ...(traits ?? {}) }));
586
+ }
587
+ }
588
+ /** A1 — link the current identity to a prior id (anon→known or cross-device). Sets user_id + emits
589
+ * an `$alias` carrying the previous id so the backend graph links them deterministically. */
590
+ alias(newUserId, previousId) {
591
+ if (!newUserId)
592
+ return;
593
+ const prev = previousId ?? this.userId ?? this.anonymousId;
594
+ this.userId = newUserId;
595
+ saveUid(newUserId);
596
+ if (this.usable)
597
+ this.enqueue(this.build('$alias', { previous_id: prev }));
598
+ }
599
+ /** A1 — logout: mint a fresh anonymous id and clear user/super-props/groups so the next user's
600
+ * events aren't attributed to the previous one. */
601
+ reset() {
602
+ this.userId = undefined;
603
+ saveUid(undefined);
604
+ this.anonymousId = newAnonId();
605
+ try {
606
+ if (typeof localStorage !== 'undefined')
607
+ localStorage.setItem(K_ANON, this.anonymousId);
608
+ }
609
+ catch {
610
+ /* storage disabled */
611
+ }
612
+ if (this.cookieDomain)
613
+ writeCookie(K_ANON, this.anonymousId, this.cookieDomain); // A6 — keep the shared cookie in sync
614
+ this.superProps = {};
615
+ this.groups = {};
616
+ saveJson(K_SUPER, this.superProps);
617
+ saveJson(K_GROUPS, this.groups);
618
+ }
619
+ track(name, props) {
620
+ if (!this.usable || !name)
621
+ return;
622
+ if (!keepEvent(name, this.anonymousId, this.sampleRate)) {
623
+ this.sampledOutCount++; // A6/A7 — thinned by per-user sampling
624
+ return;
625
+ }
626
+ this.enqueue(this.build(name, props));
627
+ }
628
+ /** A4 — revenue event (one-time / subscription / refund). revenue/currency top-level (normalized),
629
+ * revenue_type + LTV fields (product/quantity/recurrence) in properties; server-deduped by
630
+ * transaction_id. Group attribution is automatic via the stamped `groups`. */
631
+ trackPurchase(input) {
632
+ if (!this.usable)
633
+ return;
634
+ const norm = normalizeRevenue(input);
635
+ if (!norm)
636
+ return; // missing/invalid revenue|currency|transactionId
637
+ const env = this.build('purchase', norm.props);
638
+ env.revenue = norm.revenue;
639
+ env.currency = norm.currency;
640
+ this.enqueue(env);
641
+ }
642
+ /** W2 — record a subscription lifecycle change. Emits a `$subscription` event whose properties carry
643
+ * the subscription payload (+ the replay coord, so the backend ledger can deep-link the session of the
644
+ * change). Validate-or-drop, like trackPurchase. */
645
+ trackSubscription(input) {
646
+ if (!this.usable)
647
+ return;
648
+ const props = normalizeSubscription(input);
649
+ if (!props)
650
+ return; // missing subscriptionId/status, or a price-setting status without a valid plan
651
+ const replay = getReplayCoord();
652
+ this.enqueue(this.build('$subscription', replay ? { ...props, replay } : props));
653
+ }
654
+ /** Stamp user_id onto subsequent events + emit one $identify so the backend links the profile now. */
655
+ identify(userId, traits) {
656
+ if (!userId)
657
+ return;
658
+ this.userId = userId;
659
+ saveUid(userId);
660
+ if (this.usable)
661
+ this.enqueue(this.build('$identify', traits));
662
+ }
663
+ enqueue(env) {
664
+ this.queue.push(env);
665
+ this.trim();
666
+ if (this.queue.length >= BATCH_MAX)
667
+ this.autoFlush();
668
+ }
669
+ /** Bound the in-memory queue to QUEUE_CAP, counting the oldest dropped events for telemetry. */
670
+ trim() {
671
+ const over = this.queue.length - QUEUE_CAP;
672
+ if (over > 0) {
673
+ this.queue.splice(0, over);
674
+ this.droppedCount += over;
675
+ }
676
+ }
677
+ /** Timer/threshold/reconnect-driven flush: skip while offline or inside the backoff window so a
678
+ * struggling/offline server isn't hit every tick. Explicit flush()/keepalive sends bypass this. */
679
+ autoFlush() {
680
+ if (!isOnline() || !this.backoff.ready(now()))
681
+ return;
682
+ void this.flush();
683
+ }
684
+ async flush(keepalive = false) {
685
+ if (!this.usable || !this.queue.length)
686
+ return;
687
+ const batch = this.queue.splice(0, this.queue.length);
688
+ // W1a — HMAC-sign the EXACT body bytes for tamper-evident ingestion (byte-identical to RN + the
689
+ // backend verify). Lazy signer; fail-open → an unsigned batch is accepted as an old SDK (no penalty).
690
+ // The batch is already mirrored to IDB below, so a page that dies mid-sign re-sends it (signed) next
691
+ // load — delivery is never blocked on signing.
692
+ const body = JSON.stringify({ events: batch });
693
+ try {
694
+ const { signatureHeaders } = await import('../../transport/sign');
695
+ const sig = await signatureHeaders(this.clientKey, body);
696
+ const res = await fetch(`${this.apiBaseUrl}/batch`, {
697
+ method: 'POST',
698
+ headers: { 'content-type': 'application/json', 'x-scalebun-client-key': this.clientKey, ...sig },
699
+ body,
700
+ keepalive,
701
+ });
702
+ if (res.ok) {
703
+ this.backoff.reset();
704
+ this.flushCount++; // A7
705
+ }
706
+ else {
707
+ this.backoff.fail(now()); // transient server error → widen the retry window
708
+ this.requeue(batch);
709
+ }
710
+ }
711
+ catch {
712
+ this.backoff.fail(now()); // offline / network error → back off + keep for retry
713
+ this.requeue(batch);
714
+ }
715
+ // Mirror the (now drained or requeued) queue to IDB: persist leftovers, clear on full success.
716
+ void this.persist();
717
+ }
718
+ requeue(batch) {
719
+ this.queue.unshift(...batch);
720
+ this.trim();
721
+ }
722
+ /** Keep the IDB snapshot in sync with the in-memory queue. Writes only when state changes:
723
+ * saves a non-empty queue (so it survives reload/crash), clears once everything has flushed. */
724
+ async persist() {
725
+ if (this.queue.length) {
726
+ this.persisted = true;
727
+ await this.buffer.save(capBytes(this.queue)); // bound persisted bytes (drops oldest if over)
728
+ }
729
+ else if (this.persisted) {
730
+ this.persisted = false;
731
+ await this.buffer.clear();
732
+ }
733
+ }
734
+ teardown() {
735
+ this.stopAutocapture?.();
736
+ this.stopAutocapture = undefined;
737
+ if (this.timer)
738
+ clearInterval(this.timer);
739
+ this.timer = undefined;
740
+ if (this.onHide && typeof window !== 'undefined')
741
+ window.removeEventListener('pagehide', this.onHide);
742
+ this.onHide = undefined;
743
+ this.offOnline?.();
744
+ this.offSignal?.();
745
+ this.offSignal = undefined;
746
+ this.offOnline = undefined;
747
+ // Consent-revoke path (bootstrap teardownAll) → DROP unsent analytics (privacy). Normal page
748
+ // close already flushed via pagehide. teardown() is an EXPLICIT shutdown (close()/consent-deny),
749
+ // so purge the persisted snapshot too — a reload/crash never calls teardown, so durability holds
750
+ // there (the data-loss case we close); only an intentional teardown discards.
751
+ this.queue = [];
752
+ this.persisted = false;
753
+ void this.buffer.clear();
754
+ this.active = false;
755
+ }
756
+ }
757
+ //# sourceMappingURL=AnalyticsFeature.js.map