@openobserve/browser-core 0.3.4 → 0.4.0-beta.2

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 (934) hide show
  1. package/README.md +1 -1
  2. package/cjs/boot/displayAlreadyInitializedError.js +6 -7
  3. package/cjs/boot/displayAlreadyInitializedError.js.map +1 -1
  4. package/cjs/boot/init.js +26 -34
  5. package/cjs/boot/init.js.map +1 -1
  6. package/cjs/browser/addEventListener.d.ts +10 -8
  7. package/cjs/browser/addEventListener.js +107 -50
  8. package/cjs/browser/addEventListener.js.map +1 -1
  9. package/cjs/browser/browser.types.d.ts +91 -4
  10. package/cjs/browser/cookie.d.ts +0 -1
  11. package/cjs/browser/cookie.js +65 -92
  12. package/cjs/browser/cookie.js.map +1 -1
  13. package/cjs/browser/cookieAccess.d.ts +16 -0
  14. package/cjs/browser/cookieAccess.js +114 -0
  15. package/cjs/browser/cookieAccess.js.map +1 -0
  16. package/cjs/browser/fetch.d.ts +9 -0
  17. package/cjs/browser/fetch.js +18 -0
  18. package/cjs/browser/fetch.js.map +1 -0
  19. package/cjs/browser/fetchObservable.d.ts +3 -3
  20. package/cjs/browser/fetchObservable.js +80 -92
  21. package/cjs/browser/fetchObservable.js.map +1 -1
  22. package/cjs/browser/pageMayExitObservable.d.ts +1 -2
  23. package/cjs/browser/pageMayExitObservable.js +41 -40
  24. package/cjs/browser/pageMayExitObservable.js.map +1 -1
  25. package/cjs/browser/runOnReadyState.d.ts +2 -3
  26. package/cjs/browser/runOnReadyState.js +18 -17
  27. package/cjs/browser/runOnReadyState.js.map +1 -1
  28. package/cjs/browser/xhrObservable.d.ts +8 -3
  29. package/cjs/browser/xhrObservable.js +65 -77
  30. package/cjs/browser/xhrObservable.js.map +1 -1
  31. package/cjs/domain/allowedTrackingOrigins.d.ts +1 -1
  32. package/cjs/domain/allowedTrackingOrigins.js +25 -23
  33. package/cjs/domain/allowedTrackingOrigins.js.map +1 -1
  34. package/cjs/domain/bufferedData.d.ts +20 -6
  35. package/cjs/domain/bufferedData.js +41 -19
  36. package/cjs/domain/bufferedData.js.map +1 -1
  37. package/cjs/domain/configuration/configuration.d.ts +44 -43
  38. package/cjs/domain/configuration/configuration.js +122 -125
  39. package/cjs/domain/configuration/configuration.js.map +1 -1
  40. package/cjs/domain/configuration/endpointBuilder.d.ts +42 -7
  41. package/cjs/domain/configuration/endpointBuilder.js +67 -74
  42. package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
  43. package/cjs/domain/configuration/index.d.ts +2 -3
  44. package/cjs/domain/connectivity/connectivity.d.ts +1 -7
  45. package/cjs/domain/connectivity/connectivity.js +11 -11
  46. package/cjs/domain/connectivity/connectivity.js.map +1 -1
  47. package/cjs/domain/console/consoleObservable.d.ts +1 -1
  48. package/cjs/domain/console/consoleObservable.js +59 -74
  49. package/cjs/domain/console/consoleObservable.js.map +1 -1
  50. package/cjs/domain/context/contextConstants.js +24 -15
  51. package/cjs/domain/context/contextConstants.js.map +1 -1
  52. package/cjs/domain/context/contextManager.js +49 -54
  53. package/cjs/domain/context/contextManager.js.map +1 -1
  54. package/cjs/domain/context/contextUtils.js +11 -12
  55. package/cjs/domain/context/contextUtils.js.map +1 -1
  56. package/cjs/domain/context/defineContextMethod.d.ts +2 -2
  57. package/cjs/domain/context/defineContextMethod.js +15 -16
  58. package/cjs/domain/context/defineContextMethod.js.map +1 -1
  59. package/cjs/domain/context/storeContextManager.d.ts +1 -2
  60. package/cjs/domain/context/storeContextManager.js +30 -33
  61. package/cjs/domain/context/storeContextManager.js.map +1 -1
  62. package/cjs/domain/contexts/accountContext.d.ts +2 -2
  63. package/cjs/domain/contexts/accountContext.js +26 -29
  64. package/cjs/domain/contexts/accountContext.js.map +1 -1
  65. package/cjs/domain/contexts/globalContext.d.ts +2 -2
  66. package/cjs/domain/contexts/globalContext.js +17 -17
  67. package/cjs/domain/contexts/globalContext.js.map +1 -1
  68. package/cjs/domain/contexts/tabContext.d.ts +4 -0
  69. package/cjs/domain/contexts/tabContext.js +27 -0
  70. package/cjs/domain/contexts/tabContext.js.map +1 -0
  71. package/cjs/domain/contexts/telemetrySessionContext.d.ts +4 -0
  72. package/cjs/domain/contexts/telemetrySessionContext.js +17 -0
  73. package/cjs/domain/contexts/telemetrySessionContext.js.map +1 -0
  74. package/cjs/domain/contexts/userContext.d.ts +8 -3
  75. package/cjs/domain/contexts/userContext.js +29 -41
  76. package/cjs/domain/contexts/userContext.js.map +1 -1
  77. package/cjs/domain/deflate/deflate.types.js +11 -2
  78. package/cjs/domain/deflate/deflate.types.js.map +1 -1
  79. package/cjs/domain/error/error.d.ts +1 -1
  80. package/cjs/domain/error/error.js +62 -60
  81. package/cjs/domain/error/error.js.map +1 -1
  82. package/cjs/domain/error/error.types.d.ts +1 -1
  83. package/cjs/domain/error/error.types.js +24 -11
  84. package/cjs/domain/error/error.types.js.map +1 -1
  85. package/cjs/domain/error/trackRuntimeError.d.ts +3 -2
  86. package/cjs/domain/error/trackRuntimeError.js +41 -41
  87. package/cjs/domain/error/trackRuntimeError.js.map +1 -1
  88. package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +33 -38
  89. package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
  90. package/cjs/domain/extension/extensionUtils.js +18 -25
  91. package/cjs/domain/extension/extensionUtils.js.map +1 -1
  92. package/cjs/domain/intakeSites.d.ts +3 -3
  93. package/cjs/domain/intakeSites.js +23 -10
  94. package/cjs/domain/intakeSites.js.map +1 -1
  95. package/cjs/domain/report/reportObservable.d.ts +1 -2
  96. package/cjs/domain/report/reportObservable.js +73 -85
  97. package/cjs/domain/report/reportObservable.js.map +1 -1
  98. package/cjs/domain/resourceUtils.js +19 -17
  99. package/cjs/domain/resourceUtils.js.map +1 -1
  100. package/cjs/domain/sampler.d.ts +11 -0
  101. package/cjs/domain/sampler.js +40 -0
  102. package/cjs/domain/sampler.js.map +1 -0
  103. package/cjs/domain/session/sessionConstants.d.ts +1 -0
  104. package/cjs/domain/session/sessionConstants.js +19 -13
  105. package/cjs/domain/session/sessionConstants.js.map +1 -1
  106. package/cjs/domain/session/sessionManager.d.ts +13 -13
  107. package/cjs/domain/session/sessionManager.js +219 -193
  108. package/cjs/domain/session/sessionManager.js.map +1 -1
  109. package/cjs/domain/session/sessionState.d.ts +10 -1
  110. package/cjs/domain/session/sessionState.js +70 -55
  111. package/cjs/domain/session/sessionState.js.map +1 -1
  112. package/cjs/domain/session/sessionStateValidation.js +7 -8
  113. package/cjs/domain/session/sessionStateValidation.js.map +1 -1
  114. package/cjs/domain/session/sessionStore.d.ts +4 -33
  115. package/cjs/domain/session/sessionStore.js +42 -180
  116. package/cjs/domain/session/sessionStore.js.map +1 -1
  117. package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +7 -11
  118. package/cjs/domain/session/storeStrategies/sessionInCookie.js +89 -95
  119. package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
  120. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +1 -4
  121. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +39 -38
  122. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
  123. package/cjs/domain/session/storeStrategies/sessionInMemory.d.ts +12 -0
  124. package/cjs/domain/session/storeStrategies/sessionInMemory.js +35 -0
  125. package/cjs/domain/session/storeStrategies/sessionInMemory.js.map +1 -0
  126. package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -7
  127. package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +7 -4
  128. package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -1
  129. package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +9 -3
  130. package/cjs/domain/synthetics/syntheticsWorkerValues.js +33 -25
  131. package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
  132. package/cjs/domain/tags.d.ts +0 -1
  133. package/cjs/domain/tags.js +22 -58
  134. package/cjs/domain/tags.js.map +1 -1
  135. package/cjs/domain/telemetry/rawTelemetryEvent.types.js +8 -7
  136. package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -1
  137. package/cjs/domain/telemetry/telemetry.d.ts +8 -8
  138. package/cjs/domain/telemetry/telemetry.js +196 -211
  139. package/cjs/domain/telemetry/telemetry.js.map +1 -1
  140. package/cjs/domain/telemetry/telemetryEvent.types.d.ts +97 -17
  141. package/cjs/domain/trackingConsent.d.ts +1 -0
  142. package/cjs/domain/trackingConsent.js +35 -24
  143. package/cjs/domain/trackingConsent.js.map +1 -1
  144. package/cjs/index.d.ts +25 -22
  145. package/cjs/index.js +281 -194
  146. package/cjs/tools/abstractLifeCycle.js +19 -26
  147. package/cjs/tools/abstractLifeCycle.js.map +1 -1
  148. package/cjs/tools/catchUserErrors.js +12 -12
  149. package/cjs/tools/catchUserErrors.js.map +1 -1
  150. package/cjs/tools/display.d.ts +1 -35
  151. package/cjs/tools/display.js +11 -43
  152. package/cjs/tools/display.js.map +1 -1
  153. package/cjs/tools/encoder.js +36 -37
  154. package/cjs/tools/encoder.js.map +1 -1
  155. package/cjs/tools/experimentalFeatures.d.ts +1 -4
  156. package/cjs/tools/experimentalFeatures.js +29 -40
  157. package/cjs/tools/experimentalFeatures.js.map +1 -1
  158. package/cjs/tools/getZoneJsOriginalValue.d.ts +1 -1
  159. package/cjs/tools/getZoneJsOriginalValue.js +22 -25
  160. package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
  161. package/cjs/tools/globalObject.d.ts +16 -15
  162. package/cjs/tools/globalObject.js +7 -43
  163. package/cjs/tools/globalObject.js.map +1 -1
  164. package/cjs/tools/instrumentMethod.d.ts +58 -1
  165. package/cjs/tools/instrumentMethod.js +174 -112
  166. package/cjs/tools/instrumentMethod.js.map +1 -1
  167. package/cjs/tools/matchOption.js +25 -29
  168. package/cjs/tools/matchOption.js.map +1 -1
  169. package/cjs/tools/mockable.d.ts +22 -0
  170. package/cjs/tools/mockable.js +28 -0
  171. package/cjs/tools/mockable.js.map +1 -0
  172. package/cjs/tools/monitor.d.ts +5 -7
  173. package/cjs/tools/monitor.js +13 -58
  174. package/cjs/tools/monitor.js.map +1 -1
  175. package/cjs/tools/observable.d.ts +3 -1
  176. package/cjs/tools/observable.js +75 -85
  177. package/cjs/tools/observable.js.map +1 -1
  178. package/cjs/tools/queueMicrotask.js +9 -14
  179. package/cjs/tools/queueMicrotask.js.map +1 -1
  180. package/cjs/tools/readBytesFromStream.d.ts +1 -6
  181. package/cjs/tools/readBytesFromStream.js +18 -25
  182. package/cjs/tools/readBytesFromStream.js.map +1 -1
  183. package/cjs/tools/requestIdleCallback.js +22 -29
  184. package/cjs/tools/requestIdleCallback.js.map +1 -1
  185. package/cjs/tools/sendToExtension.js +10 -8
  186. package/cjs/tools/sendToExtension.js.map +1 -1
  187. package/cjs/tools/serialisation/jsonStringify.js +37 -42
  188. package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
  189. package/cjs/tools/serialisation/sanitize.d.ts +1 -0
  190. package/cjs/tools/serialisation/sanitize.js +111 -167
  191. package/cjs/tools/serialisation/sanitize.js.map +1 -1
  192. package/cjs/tools/serialisation/stringify.d.ts +2 -0
  193. package/cjs/tools/serialisation/stringify.js +18 -0
  194. package/cjs/tools/serialisation/stringify.js.map +1 -0
  195. package/cjs/tools/stackTrace/computeStackTrace.js +121 -159
  196. package/cjs/tools/stackTrace/computeStackTrace.js.map +1 -1
  197. package/cjs/tools/stackTrace/handlingStack.d.ts +1 -1
  198. package/cjs/tools/stackTrace/handlingStack.js +39 -38
  199. package/cjs/tools/stackTrace/handlingStack.js.map +1 -1
  200. package/cjs/tools/taskQueue.js +40 -49
  201. package/cjs/tools/taskQueue.js.map +1 -1
  202. package/cjs/tools/timer.d.ts +2 -1
  203. package/cjs/tools/timer.js +14 -13
  204. package/cjs/tools/timer.js.map +1 -1
  205. package/cjs/tools/utils/arrayUtils.d.ts +1 -0
  206. package/cjs/tools/utils/arrayUtils.js +17 -13
  207. package/cjs/tools/utils/arrayUtils.js.map +1 -1
  208. package/cjs/tools/utils/browserDetection.d.ts +1 -0
  209. package/cjs/tools/utils/browserDetection.js +25 -23
  210. package/cjs/tools/utils/browserDetection.js.map +1 -1
  211. package/cjs/tools/utils/byteUtils.js +20 -28
  212. package/cjs/tools/utils/byteUtils.js.map +1 -1
  213. package/cjs/tools/utils/functionUtils.js +33 -40
  214. package/cjs/tools/utils/functionUtils.js.map +1 -1
  215. package/cjs/tools/utils/numberUtils.js +15 -14
  216. package/cjs/tools/utils/numberUtils.js.map +1 -1
  217. package/cjs/tools/utils/objectUtils.d.ts +2 -0
  218. package/cjs/tools/utils/objectUtils.js +27 -14
  219. package/cjs/tools/utils/objectUtils.js.map +1 -1
  220. package/cjs/tools/utils/polyfills.js +12 -16
  221. package/cjs/tools/utils/polyfills.js.map +1 -1
  222. package/cjs/tools/utils/responseUtils.js +11 -12
  223. package/cjs/tools/utils/responseUtils.js.map +1 -1
  224. package/cjs/tools/utils/stringUtils.js +56 -77
  225. package/cjs/tools/utils/stringUtils.js.map +1 -1
  226. package/cjs/tools/utils/timezone.js +9 -10
  227. package/cjs/tools/utils/timezone.js.map +1 -1
  228. package/cjs/tools/utils/urlPolyfill.js +42 -46
  229. package/cjs/tools/utils/urlPolyfill.js.map +1 -1
  230. package/cjs/tools/valueHistory.d.ts +9 -1
  231. package/cjs/tools/valueHistory.js +110 -99
  232. package/cjs/tools/valueHistory.js.map +1 -1
  233. package/cjs/transport/batch.js +73 -106
  234. package/cjs/transport/batch.js.map +1 -1
  235. package/cjs/transport/eventBridge.d.ts +6 -2
  236. package/cjs/transport/eventBridge.js +53 -38
  237. package/cjs/transport/eventBridge.js.map +1 -1
  238. package/cjs/transport/flushController.d.ts +2 -12
  239. package/cjs/transport/flushController.js +98 -117
  240. package/cjs/transport/flushController.js.map +1 -1
  241. package/cjs/transport/httpRequest.d.ts +0 -1
  242. package/cjs/transport/httpRequest.js +51 -85
  243. package/cjs/transport/httpRequest.js.map +1 -1
  244. package/cjs/transport/index.d.ts +1 -0
  245. package/cjs/transport/sendWithRetryStrategy.js +133 -146
  246. package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
  247. package/esm/boot/displayAlreadyInitializedError.mjs +9 -0
  248. package/esm/boot/displayAlreadyInitializedError.mjs.map +1 -0
  249. package/esm/boot/init.mjs +30 -0
  250. package/esm/boot/init.mjs.map +1 -0
  251. package/esm/browser/addEventListener.mjs +107 -0
  252. package/esm/browser/addEventListener.mjs.map +1 -0
  253. package/esm/browser/cookie.mjs +81 -0
  254. package/esm/browser/cookie.mjs.map +1 -0
  255. package/esm/browser/cookieAccess.mjs +111 -0
  256. package/esm/browser/cookieAccess.mjs.map +1 -0
  257. package/esm/browser/fetch.mjs +18 -0
  258. package/esm/browser/fetch.mjs.map +1 -0
  259. package/esm/browser/fetchObservable.mjs +90 -0
  260. package/esm/browser/fetchObservable.mjs.map +1 -0
  261. package/esm/browser/pageMayExitObservable.mjs +44 -0
  262. package/esm/browser/pageMayExitObservable.mjs.map +1 -0
  263. package/esm/browser/runOnReadyState.mjs +19 -0
  264. package/esm/browser/runOnReadyState.mjs.map +1 -0
  265. package/esm/browser/xhrObservable.mjs +74 -0
  266. package/esm/browser/xhrObservable.mjs.map +1 -0
  267. package/esm/domain/allowedTrackingOrigins.mjs +27 -0
  268. package/esm/domain/allowedTrackingOrigins.mjs.map +1 -0
  269. package/esm/domain/bufferedData.mjs +43 -0
  270. package/esm/domain/bufferedData.mjs.map +1 -0
  271. package/esm/domain/configuration/configuration.mjs +131 -0
  272. package/esm/domain/configuration/configuration.mjs.map +1 -0
  273. package/esm/domain/configuration/endpointBuilder.mjs +72 -0
  274. package/esm/domain/configuration/endpointBuilder.mjs.map +1 -0
  275. package/esm/domain/connectivity/connectivity.mjs +14 -0
  276. package/esm/domain/connectivity/connectivity.mjs.map +1 -0
  277. package/esm/domain/console/consoleObservable.mjs +69 -0
  278. package/esm/domain/console/consoleObservable.mjs.map +1 -0
  279. package/esm/domain/context/contextConstants.mjs +25 -0
  280. package/esm/domain/context/contextConstants.mjs.map +1 -0
  281. package/esm/domain/context/contextManager.mjs +55 -0
  282. package/esm/domain/context/contextManager.mjs.map +1 -0
  283. package/esm/domain/context/contextUtils.mjs +15 -0
  284. package/esm/domain/context/contextUtils.mjs.map +1 -0
  285. package/esm/domain/context/defineContextMethod.mjs +19 -0
  286. package/esm/domain/context/defineContextMethod.mjs.map +1 -0
  287. package/esm/domain/context/storeContextManager.mjs +36 -0
  288. package/esm/domain/context/storeContextManager.mjs.map +1 -0
  289. package/esm/domain/contexts/accountContext.mjs +29 -0
  290. package/esm/domain/contexts/accountContext.mjs.map +1 -0
  291. package/esm/domain/contexts/globalContext.mjs +20 -0
  292. package/esm/domain/contexts/globalContext.mjs.map +1 -0
  293. package/esm/domain/contexts/tabContext.mjs +27 -0
  294. package/esm/domain/contexts/tabContext.mjs.map +1 -0
  295. package/esm/domain/contexts/telemetrySessionContext.mjs +17 -0
  296. package/esm/domain/contexts/telemetrySessionContext.mjs.map +1 -0
  297. package/esm/domain/contexts/userContext.mjs +32 -0
  298. package/esm/domain/contexts/userContext.mjs.map +1 -0
  299. package/esm/domain/deflate/deflate.types.mjs +12 -0
  300. package/esm/domain/deflate/deflate.types.mjs.map +1 -0
  301. package/esm/domain/error/error.mjs +73 -0
  302. package/esm/domain/error/error.mjs.map +1 -0
  303. package/esm/domain/error/error.types.mjs +24 -0
  304. package/esm/domain/error/error.types.mjs.map +1 -0
  305. package/esm/domain/error/trackRuntimeError.mjs +48 -0
  306. package/esm/domain/error/trackRuntimeError.mjs.map +1 -0
  307. package/esm/domain/eventRateLimiter/createEventRateLimiter.mjs +36 -0
  308. package/esm/domain/eventRateLimiter/createEventRateLimiter.mjs.map +1 -0
  309. package/esm/domain/extension/extensionUtils.mjs +23 -0
  310. package/esm/domain/extension/extensionUtils.mjs.map +1 -0
  311. package/esm/domain/intakeSites.mjs +18 -0
  312. package/esm/domain/intakeSites.mjs.map +1 -0
  313. package/esm/domain/report/reportObservable.mjs +86 -0
  314. package/esm/domain/report/reportObservable.mjs.map +1 -0
  315. package/esm/domain/resourceUtils.mjs +21 -0
  316. package/esm/domain/resourceUtils.mjs.map +1 -0
  317. package/esm/domain/sampler.mjs +37 -0
  318. package/esm/domain/sampler.mjs.map +1 -0
  319. package/esm/domain/session/sessionConstants.mjs +18 -0
  320. package/esm/domain/session/sessionConstants.mjs.map +1 -0
  321. package/esm/domain/session/sessionManager.mjs +225 -0
  322. package/esm/domain/session/sessionManager.mjs.map +1 -0
  323. package/esm/domain/session/sessionState.mjs +76 -0
  324. package/esm/domain/session/sessionState.mjs.map +1 -0
  325. package/esm/domain/session/sessionStateValidation.mjs +9 -0
  326. package/esm/domain/session/sessionStateValidation.mjs.map +1 -0
  327. package/esm/domain/session/sessionStore.mjs +46 -0
  328. package/esm/domain/session/sessionStore.mjs.map +1 -0
  329. package/esm/domain/session/storeStrategies/sessionInCookie.mjs +97 -0
  330. package/esm/domain/session/storeStrategies/sessionInCookie.mjs.map +1 -0
  331. package/esm/domain/session/storeStrategies/sessionInLocalStorage.mjs +42 -0
  332. package/esm/domain/session/storeStrategies/sessionInLocalStorage.mjs.map +1 -0
  333. package/esm/domain/session/storeStrategies/sessionInMemory.mjs +33 -0
  334. package/esm/domain/session/storeStrategies/sessionInMemory.mjs.map +1 -0
  335. package/esm/domain/session/storeStrategies/sessionStoreStrategy.mjs +7 -0
  336. package/esm/domain/session/storeStrategies/sessionStoreStrategy.mjs.map +1 -0
  337. package/esm/domain/synthetics/syntheticsWorkerValues.mjs +37 -0
  338. package/esm/domain/synthetics/syntheticsWorkerValues.mjs.map +1 -0
  339. package/esm/domain/tags.mjs +28 -0
  340. package/esm/domain/tags.mjs.map +1 -0
  341. package/esm/domain/telemetry/rawTelemetryEvent.types.mjs +10 -0
  342. package/esm/domain/telemetry/rawTelemetryEvent.types.mjs.map +1 -0
  343. package/esm/domain/telemetry/telemetry.mjs +219 -0
  344. package/esm/domain/telemetry/telemetry.mjs.map +1 -0
  345. package/esm/domain/trackingConsent.mjs +38 -0
  346. package/esm/domain/trackingConsent.mjs.map +1 -0
  347. package/esm/index.mjs +81 -0
  348. package/esm/tools/abstractLifeCycle.mjs +21 -0
  349. package/esm/tools/abstractLifeCycle.mjs.map +1 -0
  350. package/esm/tools/catchUserErrors.mjs +15 -0
  351. package/esm/tools/catchUserErrors.mjs.map +1 -0
  352. package/esm/tools/display.mjs +10 -0
  353. package/esm/tools/display.mjs.map +1 -0
  354. package/esm/tools/encoder.mjs +39 -0
  355. package/esm/tools/encoder.mjs.map +1 -0
  356. package/esm/tools/experimentalFeatures.mjs +35 -0
  357. package/esm/tools/experimentalFeatures.mjs.map +1 -0
  358. package/esm/tools/getZoneJsOriginalValue.mjs +26 -0
  359. package/esm/tools/getZoneJsOriginalValue.mjs.map +1 -0
  360. package/esm/tools/globalObject.mjs +7 -0
  361. package/esm/tools/globalObject.mjs.map +1 -0
  362. package/esm/tools/instrumentMethod.mjs +178 -0
  363. package/esm/tools/instrumentMethod.mjs.map +1 -0
  364. package/esm/tools/matchOption.mjs +30 -0
  365. package/esm/tools/matchOption.mjs.map +1 -0
  366. package/esm/tools/mockable.mjs +28 -0
  367. package/esm/tools/mockable.mjs.map +1 -0
  368. package/esm/tools/monitor.mjs +13 -0
  369. package/esm/tools/monitor.mjs.map +1 -0
  370. package/esm/tools/observable.mjs +77 -0
  371. package/esm/tools/observable.mjs.map +1 -0
  372. package/esm/tools/queueMicrotask.mjs +12 -0
  373. package/esm/tools/queueMicrotask.mjs.map +1 -0
  374. package/esm/tools/readBytesFromStream.mjs +21 -0
  375. package/esm/tools/readBytesFromStream.mjs.map +1 -0
  376. package/esm/tools/requestIdleCallback.mjs +28 -0
  377. package/esm/tools/requestIdleCallback.mjs.map +1 -0
  378. package/esm/tools/sendToExtension.mjs +13 -0
  379. package/esm/tools/sendToExtension.mjs.map +1 -0
  380. package/esm/tools/serialisation/jsonStringify.mjs +42 -0
  381. package/esm/tools/serialisation/jsonStringify.mjs.map +1 -0
  382. package/esm/tools/serialisation/sanitize.mjs +131 -0
  383. package/esm/tools/serialisation/sanitize.mjs.map +1 -0
  384. package/esm/tools/serialisation/stringify.mjs +17 -0
  385. package/esm/tools/serialisation/stringify.mjs.map +1 -0
  386. package/esm/tools/stackTrace/computeStackTrace.mjs +148 -0
  387. package/esm/tools/stackTrace/computeStackTrace.mjs.map +1 -0
  388. package/esm/tools/stackTrace/handlingStack.mjs +45 -0
  389. package/esm/tools/stackTrace/handlingStack.mjs.map +1 -0
  390. package/esm/tools/taskQueue.mjs +45 -0
  391. package/esm/tools/taskQueue.mjs.map +1 -0
  392. package/esm/tools/timer.mjs +20 -0
  393. package/esm/tools/timer.mjs.map +1 -0
  394. package/esm/tools/utils/arrayUtils.mjs +21 -0
  395. package/esm/tools/utils/arrayUtils.mjs.map +1 -0
  396. package/esm/tools/utils/browserDetection.mjs +31 -0
  397. package/esm/tools/utils/browserDetection.mjs.map +1 -0
  398. package/esm/tools/utils/byteUtils.mjs +23 -0
  399. package/esm/tools/utils/byteUtils.mjs.map +1 -0
  400. package/esm/tools/utils/functionUtils.mjs +35 -0
  401. package/esm/tools/utils/functionUtils.mjs.map +1 -0
  402. package/esm/tools/utils/numberUtils.mjs +22 -0
  403. package/esm/tools/utils/numberUtils.mjs.map +1 -0
  404. package/esm/tools/utils/objectUtils.mjs +31 -0
  405. package/esm/tools/utils/objectUtils.mjs.map +1 -0
  406. package/esm/tools/utils/polyfills.mjs +17 -0
  407. package/esm/tools/utils/polyfills.mjs.map +1 -0
  408. package/esm/tools/utils/responseUtils.mjs +15 -0
  409. package/esm/tools/utils/responseUtils.mjs.map +1 -0
  410. package/esm/tools/utils/stringUtils.mjs +66 -0
  411. package/esm/tools/utils/stringUtils.mjs.map +1 -0
  412. package/esm/tools/utils/timezone.mjs +12 -0
  413. package/esm/tools/utils/timezone.mjs.map +1 -0
  414. package/esm/tools/utils/urlPolyfill.mjs +51 -0
  415. package/esm/tools/utils/urlPolyfill.mjs.map +1 -0
  416. package/esm/tools/valueHistory.mjs +114 -0
  417. package/esm/tools/valueHistory.mjs.map +1 -0
  418. package/esm/transport/batch.mjs +77 -0
  419. package/esm/transport/batch.mjs.map +1 -0
  420. package/esm/transport/eventBridge.mjs +58 -0
  421. package/esm/transport/eventBridge.mjs.map +1 -0
  422. package/esm/transport/flushController.mjs +104 -0
  423. package/esm/transport/flushController.mjs.map +1 -0
  424. package/esm/transport/httpRequest.mjs +60 -0
  425. package/esm/transport/httpRequest.mjs.map +1 -0
  426. package/esm/transport/sendWithRetryStrategy.mjs +149 -0
  427. package/esm/transport/sendWithRetryStrategy.mjs.map +1 -0
  428. package/package.json +15 -4
  429. package/src/boot/init.ts +2 -2
  430. package/src/browser/addEventListener.ts +37 -5
  431. package/src/browser/browser.types.ts +127 -13
  432. package/src/browser/cookie.ts +21 -27
  433. package/src/browser/cookieAccess.ts +150 -0
  434. package/src/browser/fetch.ts +14 -0
  435. package/src/browser/fetchObservable.ts +22 -22
  436. package/src/browser/pageMayExitObservable.ts +7 -4
  437. package/src/browser/runOnReadyState.ts +3 -8
  438. package/src/browser/xhrObservable.ts +22 -12
  439. package/src/domain/allowedTrackingOrigins.ts +5 -5
  440. package/src/domain/bufferedData.ts +41 -14
  441. package/src/domain/configuration/configuration.ts +87 -72
  442. package/src/domain/configuration/endpointBuilder.ts +82 -52
  443. package/src/domain/configuration/index.ts +2 -2
  444. package/src/domain/connectivity/connectivity.ts +3 -15
  445. package/src/domain/console/consoleObservable.ts +3 -3
  446. package/src/domain/context/contextManager.ts +1 -1
  447. package/src/domain/context/contextUtils.ts +1 -1
  448. package/src/domain/context/defineContextMethod.ts +3 -3
  449. package/src/domain/context/storeContextManager.ts +9 -6
  450. package/src/domain/contexts/accountContext.ts +5 -5
  451. package/src/domain/contexts/globalContext.ts +4 -5
  452. package/src/domain/contexts/tabContext.ts +43 -0
  453. package/src/domain/contexts/telemetrySessionContext.ts +26 -0
  454. package/src/domain/contexts/userContext.ts +7 -11
  455. package/src/domain/error/error.ts +53 -23
  456. package/src/domain/error/error.types.ts +1 -1
  457. package/src/domain/error/trackRuntimeError.ts +11 -4
  458. package/src/domain/eventRateLimiter/createEventRateLimiter.ts +1 -1
  459. package/src/domain/intakeSites.ts +8 -3
  460. package/src/domain/report/reportObservable.ts +11 -7
  461. package/src/domain/sampler.ts +64 -0
  462. package/src/domain/session/sessionConstants.ts +2 -1
  463. package/src/domain/session/sessionManager.ts +281 -176
  464. package/src/domain/session/sessionState.ts +64 -8
  465. package/src/domain/session/sessionStore.ts +57 -223
  466. package/src/domain/session/storeStrategies/sessionInCookie.ts +121 -107
  467. package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +33 -21
  468. package/src/domain/session/storeStrategies/sessionInMemory.ts +55 -0
  469. package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +28 -6
  470. package/src/domain/synthetics/syntheticsWorkerValues.ts +44 -13
  471. package/src/domain/tags.ts +0 -16
  472. package/src/domain/telemetry/telemetry.ts +38 -34
  473. package/src/domain/telemetry/telemetryEvent.types.ts +116 -20
  474. package/src/domain/trackingConsent.ts +18 -3
  475. package/src/index.ts +51 -31
  476. package/src/tools/display.ts +2 -50
  477. package/src/tools/experimentalFeatures.ts +1 -4
  478. package/src/tools/getZoneJsOriginalValue.ts +3 -3
  479. package/src/tools/globalObject.ts +27 -41
  480. package/src/tools/instrumentMethod.ts +230 -20
  481. package/src/tools/matchOption.ts +3 -1
  482. package/src/tools/mockable.ts +32 -0
  483. package/src/tools/monitor.ts +14 -62
  484. package/src/tools/observable.ts +9 -1
  485. package/src/tools/queueMicrotask.ts +6 -1
  486. package/src/tools/readBytesFromStream.ts +3 -12
  487. package/src/tools/requestIdleCallback.ts +1 -1
  488. package/src/tools/serialisation/sanitize.ts +67 -65
  489. package/src/tools/serialisation/stringify.ts +18 -0
  490. package/src/tools/stackTrace/computeStackTrace.ts +15 -13
  491. package/src/tools/stackTrace/handlingStack.ts +14 -1
  492. package/src/tools/taskQueue.ts +5 -3
  493. package/src/tools/timer.ts +7 -6
  494. package/src/tools/utils/arrayUtils.ts +7 -0
  495. package/src/tools/utils/browserDetection.ts +8 -0
  496. package/src/tools/utils/byteUtils.ts +1 -5
  497. package/src/tools/utils/functionUtils.ts +2 -2
  498. package/src/tools/utils/objectUtils.ts +20 -0
  499. package/src/tools/utils/stringUtils.ts +4 -1
  500. package/src/tools/utils/urlPolyfill.ts +5 -4
  501. package/src/tools/valueHistory.ts +39 -6
  502. package/src/transport/batch.ts +9 -18
  503. package/src/transport/eventBridge.ts +23 -10
  504. package/src/transport/flushController.ts +17 -24
  505. package/src/transport/httpRequest.ts +4 -36
  506. package/src/transport/index.ts +1 -0
  507. package/src/transport/sendWithRetryStrategy.ts +1 -1
  508. package/cjs/browser/browser.types.js +0 -6
  509. package/cjs/browser/browser.types.js.map +0 -1
  510. package/cjs/domain/configuration/index.js +0 -16
  511. package/cjs/domain/configuration/index.js.map +0 -1
  512. package/cjs/domain/configuration/transportConfiguration.d.ts +0 -20
  513. package/cjs/domain/configuration/transportConfiguration.js +0 -54
  514. package/cjs/domain/configuration/transportConfiguration.js.map +0 -1
  515. package/cjs/domain/connectivity/index.js +0 -18
  516. package/cjs/domain/connectivity/index.js.map +0 -1
  517. package/cjs/domain/contexts/rumInternalContext.type.js +0 -3
  518. package/cjs/domain/contexts/rumInternalContext.type.js.map +0 -1
  519. package/cjs/domain/deflate/index.js +0 -18
  520. package/cjs/domain/deflate/index.js.map +0 -1
  521. package/cjs/domain/report/browser.types.js +0 -3
  522. package/cjs/domain/report/browser.types.js.map +0 -1
  523. package/cjs/domain/session/oldCookiesMigration.d.ts +0 -11
  524. package/cjs/domain/session/oldCookiesMigration.js +0 -40
  525. package/cjs/domain/session/oldCookiesMigration.js.map +0 -1
  526. package/cjs/domain/session/sessionStoreOperations.d.ts +0 -12
  527. package/cjs/domain/session/sessionStoreOperations.js +0 -119
  528. package/cjs/domain/session/sessionStoreOperations.js.map +0 -1
  529. package/cjs/domain/telemetry/index.js +0 -28
  530. package/cjs/domain/telemetry/index.js.map +0 -1
  531. package/cjs/domain/telemetry/telemetryEvent.types.js +0 -7
  532. package/cjs/domain/telemetry/telemetryEvent.types.js.map +0 -1
  533. package/cjs/index.js.map +0 -1
  534. package/cjs/tools/abstractHooks.d.ts +0 -24
  535. package/cjs/tools/abstractHooks.js +0 -41
  536. package/cjs/tools/abstractHooks.js.map +0 -1
  537. package/cjs/tools/boundedBuffer.d.ts +0 -16
  538. package/cjs/tools/boundedBuffer.js +0 -32
  539. package/cjs/tools/boundedBuffer.js.map +0 -1
  540. package/cjs/tools/mergeInto.d.ts +0 -25
  541. package/cjs/tools/mergeInto.js +0 -98
  542. package/cjs/tools/mergeInto.js.map +0 -1
  543. package/cjs/tools/serialisation/context.js +0 -3
  544. package/cjs/tools/serialisation/context.js.map +0 -1
  545. package/cjs/tools/utils/timeUtils.d.ts +0 -53
  546. package/cjs/tools/utils/timeUtils.js +0 -101
  547. package/cjs/tools/utils/timeUtils.js.map +0 -1
  548. package/cjs/tools/utils/typeUtils.d.ts +0 -4
  549. package/cjs/tools/utils/typeUtils.js +0 -16
  550. package/cjs/tools/utils/typeUtils.js.map +0 -1
  551. package/cjs/transport/index.js +0 -15
  552. package/cjs/transport/index.js.map +0 -1
  553. package/esm/boot/displayAlreadyInitializedError.d.ts +0 -2
  554. package/esm/boot/displayAlreadyInitializedError.js +0 -7
  555. package/esm/boot/displayAlreadyInitializedError.js.map +0 -1
  556. package/esm/boot/init.d.ts +0 -14
  557. package/esm/boot/init.js +0 -35
  558. package/esm/boot/init.js.map +0 -1
  559. package/esm/browser/addEventListener.d.ts +0 -87
  560. package/esm/browser/addEventListener.js +0 -51
  561. package/esm/browser/addEventListener.js.map +0 -1
  562. package/esm/browser/browser.types.d.ts +0 -51
  563. package/esm/browser/browser.types.js +0 -5
  564. package/esm/browser/browser.types.js.map +0 -1
  565. package/esm/browser/cookie.d.ts +0 -28
  566. package/esm/browser/cookie.js +0 -103
  567. package/esm/browser/cookie.js.map +0 -1
  568. package/esm/browser/fetchObservable.d.ts +0 -38
  569. package/esm/browser/fetchObservable.js +0 -99
  570. package/esm/browser/fetchObservable.js.map +0 -1
  571. package/esm/browser/pageMayExitObservable.d.ts +0 -14
  572. package/esm/browser/pageMayExitObservable.js +0 -40
  573. package/esm/browser/pageMayExitObservable.js.map +0 -1
  574. package/esm/browser/runOnReadyState.d.ts +0 -5
  575. package/esm/browser/runOnReadyState.js +0 -16
  576. package/esm/browser/runOnReadyState.js.map +0 -1
  577. package/esm/browser/xhrObservable.d.ts +0 -24
  578. package/esm/browser/xhrObservable.js +0 -83
  579. package/esm/browser/xhrObservable.js.map +0 -1
  580. package/esm/domain/allowedTrackingOrigins.d.ts +0 -4
  581. package/esm/domain/allowedTrackingOrigins.js +0 -21
  582. package/esm/domain/allowedTrackingOrigins.js.map +0 -1
  583. package/esm/domain/bufferedData.d.ts +0 -14
  584. package/esm/domain/bufferedData.js +0 -19
  585. package/esm/domain/bufferedData.js.map +0 -1
  586. package/esm/domain/configuration/configuration.d.ts +0 -312
  587. package/esm/domain/configuration/configuration.js +0 -132
  588. package/esm/domain/configuration/configuration.js.map +0 -1
  589. package/esm/domain/configuration/endpointBuilder.d.ts +0 -12
  590. package/esm/domain/configuration/endpointBuilder.js +0 -77
  591. package/esm/domain/configuration/endpointBuilder.js.map +0 -1
  592. package/esm/domain/configuration/index.d.ts +0 -5
  593. package/esm/domain/configuration/index.js +0 -4
  594. package/esm/domain/configuration/index.js.map +0 -1
  595. package/esm/domain/configuration/transportConfiguration.d.ts +0 -20
  596. package/esm/domain/configuration/transportConfiguration.js +0 -50
  597. package/esm/domain/configuration/transportConfiguration.js.map +0 -1
  598. package/esm/domain/connectivity/connectivity.d.ts +0 -14
  599. package/esm/domain/connectivity/connectivity.js +0 -11
  600. package/esm/domain/connectivity/connectivity.js.map +0 -1
  601. package/esm/domain/connectivity/index.d.ts +0 -1
  602. package/esm/domain/connectivity/index.js +0 -2
  603. package/esm/domain/connectivity/index.js.map +0 -1
  604. package/esm/domain/console/consoleObservable.d.ts +0 -21
  605. package/esm/domain/console/consoleObservable.js +0 -80
  606. package/esm/domain/console/consoleObservable.js.map +0 -1
  607. package/esm/domain/context/contextConstants.d.ts +0 -21
  608. package/esm/domain/context/contextConstants.js +0 -15
  609. package/esm/domain/context/contextConstants.js.map +0 -1
  610. package/esm/domain/context/contextManager.d.ts +0 -19
  611. package/esm/domain/context/contextManager.js +0 -57
  612. package/esm/domain/context/contextManager.js.map +0 -1
  613. package/esm/domain/context/contextUtils.d.ts +0 -5
  614. package/esm/domain/context/contextUtils.js +0 -13
  615. package/esm/domain/context/contextUtils.js.map +0 -1
  616. package/esm/domain/context/defineContextMethod.d.ts +0 -6
  617. package/esm/domain/context/defineContextMethod.js +0 -17
  618. package/esm/domain/context/defineContextMethod.js.map +0 -1
  619. package/esm/domain/context/storeContextManager.d.ts +0 -6
  620. package/esm/domain/context/storeContextManager.js +0 -35
  621. package/esm/domain/context/storeContextManager.js.map +0 -1
  622. package/esm/domain/contexts/accountContext.d.ts +0 -26
  623. package/esm/domain/contexts/accountContext.js +0 -29
  624. package/esm/domain/contexts/accountContext.js.map +0 -1
  625. package/esm/domain/contexts/globalContext.d.ts +0 -18
  626. package/esm/domain/contexts/globalContext.js +0 -17
  627. package/esm/domain/contexts/globalContext.js.map +0 -1
  628. package/esm/domain/contexts/rumInternalContext.type.d.ts +0 -14
  629. package/esm/domain/contexts/rumInternalContext.type.js +0 -2
  630. package/esm/domain/contexts/rumInternalContext.type.js.map +0 -1
  631. package/esm/domain/contexts/userContext.d.ts +0 -29
  632. package/esm/domain/contexts/userContext.js +0 -41
  633. package/esm/domain/contexts/userContext.js.map +0 -1
  634. package/esm/domain/deflate/deflate.types.d.ts +0 -40
  635. package/esm/domain/deflate/deflate.types.js +0 -2
  636. package/esm/domain/deflate/deflate.types.js.map +0 -1
  637. package/esm/domain/deflate/index.d.ts +0 -1
  638. package/esm/domain/deflate/index.js +0 -2
  639. package/esm/domain/deflate/index.js.map +0 -1
  640. package/esm/domain/error/error.d.ts +0 -23
  641. package/esm/domain/error/error.js +0 -65
  642. package/esm/domain/error/error.js.map +0 -1
  643. package/esm/domain/error/error.types.d.ts +0 -47
  644. package/esm/domain/error/error.types.js +0 -10
  645. package/esm/domain/error/error.types.js.map +0 -1
  646. package/esm/domain/error/trackRuntimeError.d.ts +0 -11
  647. package/esm/domain/error/trackRuntimeError.js +0 -43
  648. package/esm/domain/error/trackRuntimeError.js.map +0 -1
  649. package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
  650. package/esm/domain/eventRateLimiter/createEventRateLimiter.js +0 -38
  651. package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
  652. package/esm/domain/extension/extensionUtils.d.ts +0 -10
  653. package/esm/domain/extension/extensionUtils.js +0 -25
  654. package/esm/domain/extension/extensionUtils.js.map +0 -1
  655. package/esm/domain/intakeSites.d.ts +0 -8
  656. package/esm/domain/intakeSites.js +0 -8
  657. package/esm/domain/intakeSites.js.map +0 -1
  658. package/esm/domain/report/browser.types.d.ts +0 -34
  659. package/esm/domain/report/browser.types.js +0 -2
  660. package/esm/domain/report/browser.types.js.map +0 -1
  661. package/esm/domain/report/reportObservable.d.ts +0 -14
  662. package/esm/domain/report/reportObservable.js +0 -95
  663. package/esm/domain/report/reportObservable.js.map +0 -1
  664. package/esm/domain/resourceUtils.d.ts +0 -18
  665. package/esm/domain/resourceUtils.js +0 -17
  666. package/esm/domain/resourceUtils.js.map +0 -1
  667. package/esm/domain/session/oldCookiesMigration.d.ts +0 -11
  668. package/esm/domain/session/oldCookiesMigration.js +0 -36
  669. package/esm/domain/session/oldCookiesMigration.js.map +0 -1
  670. package/esm/domain/session/sessionConstants.d.ts +0 -15
  671. package/esm/domain/session/sessionConstants.js +0 -13
  672. package/esm/domain/session/sessionConstants.js.map +0 -1
  673. package/esm/domain/session/sessionManager.d.ts +0 -28
  674. package/esm/domain/session/sessionManager.js +0 -196
  675. package/esm/domain/session/sessionManager.js.map +0 -1
  676. package/esm/domain/session/sessionState.d.ts +0 -16
  677. package/esm/domain/session/sessionState.js +0 -60
  678. package/esm/domain/session/sessionState.js.map +0 -1
  679. package/esm/domain/session/sessionStateValidation.d.ts +0 -3
  680. package/esm/domain/session/sessionStateValidation.js +0 -7
  681. package/esm/domain/session/sessionStateValidation.js.map +0 -1
  682. package/esm/domain/session/sessionStore.d.ts +0 -38
  683. package/esm/domain/session/sessionStore.js +0 -179
  684. package/esm/domain/session/sessionStore.js.map +0 -1
  685. package/esm/domain/session/sessionStoreOperations.d.ts +0 -12
  686. package/esm/domain/session/sessionStoreOperations.js +0 -114
  687. package/esm/domain/session/sessionStoreOperations.js.map +0 -1
  688. package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +0 -12
  689. package/esm/domain/session/storeStrategies/sessionInCookie.js +0 -98
  690. package/esm/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
  691. package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -6
  692. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -37
  693. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
  694. package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -16
  695. package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +0 -2
  696. package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
  697. package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +0 -12
  698. package/esm/domain/synthetics/syntheticsWorkerValues.js +0 -24
  699. package/esm/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
  700. package/esm/domain/tags.d.ts +0 -6
  701. package/esm/domain/tags.js +0 -60
  702. package/esm/domain/tags.js.map +0 -1
  703. package/esm/domain/telemetry/index.d.ts +0 -4
  704. package/esm/domain/telemetry/index.js +0 -3
  705. package/esm/domain/telemetry/index.js.map +0 -1
  706. package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -18
  707. package/esm/domain/telemetry/rawTelemetryEvent.types.js +0 -6
  708. package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
  709. package/esm/domain/telemetry/telemetry.d.ts +0 -56
  710. package/esm/domain/telemetry/telemetry.js +0 -228
  711. package/esm/domain/telemetry/telemetry.js.map +0 -1
  712. package/esm/domain/telemetry/telemetryEvent.types.d.ts +0 -866
  713. package/esm/domain/telemetry/telemetryEvent.types.js +0 -6
  714. package/esm/domain/telemetry/telemetryEvent.types.js.map +0 -1
  715. package/esm/domain/trackingConsent.d.ts +0 -13
  716. package/esm/domain/trackingConsent.js +0 -24
  717. package/esm/domain/trackingConsent.js.map +0 -1
  718. package/esm/index.d.ts +0 -100
  719. package/esm/index.js +0 -76
  720. package/esm/index.js.map +0 -1
  721. package/esm/tools/abstractHooks.d.ts +0 -24
  722. package/esm/tools/abstractHooks.js +0 -37
  723. package/esm/tools/abstractHooks.js.map +0 -1
  724. package/esm/tools/abstractLifeCycle.d.ts +0 -23
  725. package/esm/tools/abstractLifeCycle.js +0 -24
  726. package/esm/tools/abstractLifeCycle.js.map +0 -1
  727. package/esm/tools/boundedBuffer.d.ts +0 -16
  728. package/esm/tools/boundedBuffer.js +0 -29
  729. package/esm/tools/boundedBuffer.js.map +0 -1
  730. package/esm/tools/catchUserErrors.d.ts +0 -1
  731. package/esm/tools/catchUserErrors.js +0 -12
  732. package/esm/tools/catchUserErrors.js.map +0 -1
  733. package/esm/tools/display.d.ts +0 -38
  734. package/esm/tools/display.js +0 -41
  735. package/esm/tools/display.js.map +0 -1
  736. package/esm/tools/encoder.d.ts +0 -54
  737. package/esm/tools/encoder.js +0 -37
  738. package/esm/tools/encoder.js.map +0 -1
  739. package/esm/tools/experimentalFeatures.d.ts +0 -21
  740. package/esm/tools/experimentalFeatures.js +0 -42
  741. package/esm/tools/experimentalFeatures.js.map +0 -1
  742. package/esm/tools/getZoneJsOriginalValue.d.ts +0 -19
  743. package/esm/tools/getZoneJsOriginalValue.js +0 -26
  744. package/esm/tools/getZoneJsOriginalValue.js.map +0 -1
  745. package/esm/tools/globalObject.d.ts +0 -19
  746. package/esm/tools/globalObject.js +0 -40
  747. package/esm/tools/globalObject.js.map +0 -1
  748. package/esm/tools/instrumentMethod.d.ts +0 -75
  749. package/esm/tools/instrumentMethod.js +0 -114
  750. package/esm/tools/instrumentMethod.js.map +0 -1
  751. package/esm/tools/matchOption.d.ts +0 -8
  752. package/esm/tools/matchOption.js +0 -31
  753. package/esm/tools/matchOption.js.map +0 -1
  754. package/esm/tools/mergeInto.d.ts +0 -25
  755. package/esm/tools/mergeInto.js +0 -93
  756. package/esm/tools/mergeInto.js.map +0 -1
  757. package/esm/tools/monitor.d.ts +0 -9
  758. package/esm/tools/monitor.js +0 -52
  759. package/esm/tools/monitor.js.map +0 -1
  760. package/esm/tools/observable.d.ts +0 -30
  761. package/esm/tools/observable.js +0 -83
  762. package/esm/tools/observable.js.map +0 -1
  763. package/esm/tools/queueMicrotask.d.ts +0 -1
  764. package/esm/tools/queueMicrotask.js +0 -14
  765. package/esm/tools/queueMicrotask.js.map +0 -1
  766. package/esm/tools/readBytesFromStream.d.ts +0 -10
  767. package/esm/tools/readBytesFromStream.js +0 -25
  768. package/esm/tools/readBytesFromStream.js.map +0 -1
  769. package/esm/tools/requestIdleCallback.d.ts +0 -12
  770. package/esm/tools/requestIdleCallback.js +0 -30
  771. package/esm/tools/requestIdleCallback.js.map +0 -1
  772. package/esm/tools/sendToExtension.d.ts +0 -3
  773. package/esm/tools/sendToExtension.js +0 -8
  774. package/esm/tools/sendToExtension.js.map +0 -1
  775. package/esm/tools/serialisation/context.d.ts +0 -9
  776. package/esm/tools/serialisation/context.js +0 -2
  777. package/esm/tools/serialisation/context.js.map +0 -1
  778. package/esm/tools/serialisation/jsonStringify.d.ts +0 -13
  779. package/esm/tools/serialisation/jsonStringify.js +0 -44
  780. package/esm/tools/serialisation/jsonStringify.js.map +0 -1
  781. package/esm/tools/serialisation/sanitize.d.ts +0 -18
  782. package/esm/tools/serialisation/sanitize.js +0 -185
  783. package/esm/tools/serialisation/sanitize.js.map +0 -1
  784. package/esm/tools/stackTrace/computeStackTrace.d.ts +0 -25
  785. package/esm/tools/stackTrace/computeStackTrace.js +0 -183
  786. package/esm/tools/stackTrace/computeStackTrace.js.map +0 -1
  787. package/esm/tools/stackTrace/handlingStack.d.ts +0 -10
  788. package/esm/tools/stackTrace/handlingStack.js +0 -41
  789. package/esm/tools/stackTrace/handlingStack.js.map +0 -1
  790. package/esm/tools/taskQueue.d.ts +0 -15
  791. package/esm/tools/taskQueue.js +0 -50
  792. package/esm/tools/taskQueue.js.map +0 -1
  793. package/esm/tools/timer.d.ts +0 -5
  794. package/esm/tools/timer.js +0 -16
  795. package/esm/tools/timer.js.map +0 -1
  796. package/esm/tools/utils/arrayUtils.d.ts +0 -3
  797. package/esm/tools/utils/arrayUtils.js +0 -15
  798. package/esm/tools/utils/arrayUtils.js.map +0 -1
  799. package/esm/tools/utils/browserDetection.d.ts +0 -8
  800. package/esm/tools/utils/browserDetection.js +0 -28
  801. package/esm/tools/utils/browserDetection.js.map +0 -1
  802. package/esm/tools/utils/byteUtils.d.ts +0 -8
  803. package/esm/tools/utils/byteUtils.js +0 -29
  804. package/esm/tools/utils/byteUtils.js.map +0 -1
  805. package/esm/tools/utils/functionUtils.d.ts +0 -8
  806. package/esm/tools/utils/functionUtils.js +0 -39
  807. package/esm/tools/utils/functionUtils.js.map +0 -1
  808. package/esm/tools/utils/numberUtils.d.ts +0 -9
  809. package/esm/tools/utils/numberUtils.js +0 -18
  810. package/esm/tools/utils/numberUtils.js.map +0 -1
  811. package/esm/tools/utils/objectUtils.d.ts +0 -10
  812. package/esm/tools/utils/objectUtils.js +0 -17
  813. package/esm/tools/utils/objectUtils.js.map +0 -1
  814. package/esm/tools/utils/polyfills.d.ts +0 -7
  815. package/esm/tools/utils/polyfills.js +0 -18
  816. package/esm/tools/utils/polyfills.js.map +0 -1
  817. package/esm/tools/utils/responseUtils.d.ts +0 -2
  818. package/esm/tools/utils/responseUtils.js +0 -13
  819. package/esm/tools/utils/responseUtils.js.map +0 -1
  820. package/esm/tools/utils/stringUtils.d.ts +0 -23
  821. package/esm/tools/utils/stringUtils.js +0 -84
  822. package/esm/tools/utils/stringUtils.js.map +0 -1
  823. package/esm/tools/utils/timeUtils.d.ts +0 -53
  824. package/esm/tools/utils/timeUtils.js +0 -84
  825. package/esm/tools/utils/timeUtils.js.map +0 -1
  826. package/esm/tools/utils/timezone.d.ts +0 -1
  827. package/esm/tools/utils/timezone.js +0 -10
  828. package/esm/tools/utils/timezone.js.map +0 -1
  829. package/esm/tools/utils/typeUtils.d.ts +0 -4
  830. package/esm/tools/utils/typeUtils.js +0 -13
  831. package/esm/tools/utils/typeUtils.js.map +0 -1
  832. package/esm/tools/utils/urlPolyfill.d.ts +0 -5
  833. package/esm/tools/utils/urlPolyfill.js +0 -52
  834. package/esm/tools/utils/urlPolyfill.js.map +0 -1
  835. package/esm/tools/valueHistory.d.ts +0 -27
  836. package/esm/tools/valueHistory.js +0 -100
  837. package/esm/tools/valueHistory.js.map +0 -1
  838. package/esm/transport/batch.d.ts +0 -16
  839. package/esm/transport/batch.js +0 -106
  840. package/esm/transport/batch.js.map +0 -1
  841. package/esm/transport/eventBridge.d.ts +0 -21
  842. package/esm/transport/eventBridge.js +0 -41
  843. package/esm/transport/eventBridge.js.map +0 -1
  844. package/esm/transport/flushController.d.ts +0 -65
  845. package/esm/transport/flushController.js +0 -119
  846. package/esm/transport/flushController.js.map +0 -1
  847. package/esm/transport/httpRequest.d.ts +0 -56
  848. package/esm/transport/httpRequest.js +0 -89
  849. package/esm/transport/httpRequest.js.map +0 -1
  850. package/esm/transport/index.d.ts +0 -7
  851. package/esm/transport/index.js +0 -5
  852. package/esm/transport/index.js.map +0 -1
  853. package/esm/transport/sendWithRetryStrategy.d.ts +0 -41
  854. package/esm/transport/sendWithRetryStrategy.js +0 -158
  855. package/esm/transport/sendWithRetryStrategy.js.map +0 -1
  856. package/src/boot/displayAlreadyInitializedError.spec.ts +0 -18
  857. package/src/boot/init.spec.ts +0 -50
  858. package/src/browser/addEventListener.spec.ts +0 -141
  859. package/src/browser/cookie.spec.ts +0 -53
  860. package/src/browser/fetchObservable.spec.ts +0 -334
  861. package/src/browser/pageMayExitObservable.spec.ts +0 -56
  862. package/src/browser/xhrObservable.spec.ts +0 -405
  863. package/src/domain/allowedTrackingOrigins.spec.ts +0 -210
  864. package/src/domain/bufferedData.spec.ts +0 -34
  865. package/src/domain/configuration/configuration.spec.ts +0 -236
  866. package/src/domain/configuration/endpointBuilder.spec.ts +0 -173
  867. package/src/domain/configuration/transportConfiguration.spec.ts +0 -130
  868. package/src/domain/configuration/transportConfiguration.ts +0 -78
  869. package/src/domain/connectivity/connectivity.spec.ts +0 -50
  870. package/src/domain/console/consoleObservable.spec.ts +0 -151
  871. package/src/domain/context/contextManager.spec.ts +0 -152
  872. package/src/domain/context/contextUtils.spec.ts +0 -26
  873. package/src/domain/context/storeContextManager.spec.ts +0 -103
  874. package/src/domain/contexts/accountContext.spec.ts +0 -99
  875. package/src/domain/contexts/globalContext.spec.ts +0 -88
  876. package/src/domain/contexts/userContext.spec.ts +0 -156
  877. package/src/domain/error/error.spec.ts +0 -294
  878. package/src/domain/error/trackRuntimeError.spec.ts +0 -343
  879. package/src/domain/eventRateLimiter/createEventRateLimiter.spec.ts +0 -119
  880. package/src/domain/extension/extensionUtils.spec.ts +0 -47
  881. package/src/domain/report/reportObservable.spec.ts +0 -71
  882. package/src/domain/session/oldCookiesMigration.spec.ts +0 -76
  883. package/src/domain/session/oldCookiesMigration.ts +0 -42
  884. package/src/domain/session/sessionManager.spec.ts +0 -684
  885. package/src/domain/session/sessionState.spec.ts +0 -88
  886. package/src/domain/session/sessionStore.spec.ts +0 -647
  887. package/src/domain/session/sessionStoreOperations.spec.ts +0 -234
  888. package/src/domain/session/sessionStoreOperations.ts +0 -131
  889. package/src/domain/session/storeStrategies/sessionInCookie.spec.ts +0 -228
  890. package/src/domain/session/storeStrategies/sessionInLocalStorage.spec.ts +0 -75
  891. package/src/domain/synthetics/syntheticsWorkerValues.spec.ts +0 -82
  892. package/src/domain/tags.spec.ts +0 -74
  893. package/src/domain/telemetry/telemetry.spec.ts +0 -494
  894. package/src/domain/trackingConsent.spec.ts +0 -44
  895. package/src/tools/abstractHooks.spec.ts +0 -76
  896. package/src/tools/abstractHooks.ts +0 -72
  897. package/src/tools/abstractLifeCycle.spec.ts +0 -46
  898. package/src/tools/boundedBuffer.spec.ts +0 -40
  899. package/src/tools/boundedBuffer.ts +0 -45
  900. package/src/tools/catchUserErrors.spec.ts +0 -20
  901. package/src/tools/encoder.spec.ts +0 -112
  902. package/src/tools/experimentalFeatures.spec.ts +0 -60
  903. package/src/tools/getZoneJsOriginalValue.spec.ts +0 -36
  904. package/src/tools/instrumentMethod.spec.ts +0 -381
  905. package/src/tools/matchOption.spec.ts +0 -41
  906. package/src/tools/mergeInto.spec.ts +0 -198
  907. package/src/tools/mergeInto.ts +0 -177
  908. package/src/tools/monitor.spec.ts +0 -172
  909. package/src/tools/observable.spec.ts +0 -259
  910. package/src/tools/queueMicrotask.spec.ts +0 -24
  911. package/src/tools/readBytesFromStream.spec.ts +0 -62
  912. package/src/tools/requestIdleCallback.spec.ts +0 -65
  913. package/src/tools/serialisation/jsonStringify.spec.ts +0 -76
  914. package/src/tools/serialisation/sanitize.spec.ts +0 -284
  915. package/src/tools/stackTrace/capturedExceptions.specHelper.ts +0 -316
  916. package/src/tools/stackTrace/computeStackTrace.spec.ts +0 -1007
  917. package/src/tools/stackTrace/handlingStack.spec.ts +0 -20
  918. package/src/tools/taskQueue.spec.ts +0 -60
  919. package/src/tools/timer.spec.ts +0 -76
  920. package/src/tools/utils/browserDetection.spec.ts +0 -120
  921. package/src/tools/utils/byteUtils.spec.ts +0 -29
  922. package/src/tools/utils/functionUtils.spec.ts +0 -229
  923. package/src/tools/utils/numberUtils.spec.ts +0 -27
  924. package/src/tools/utils/stringUtils.spec.ts +0 -74
  925. package/src/tools/utils/timeUtils.ts +0 -117
  926. package/src/tools/utils/typeUtils.spec.ts +0 -25
  927. package/src/tools/utils/typeUtils.ts +0 -12
  928. package/src/tools/utils/urlPolyfill.spec.ts +0 -55
  929. package/src/tools/valueHistory.spec.ts +0 -180
  930. package/src/transport/batch.spec.ts +0 -261
  931. package/src/transport/eventBridge.spec.ts +0 -90
  932. package/src/transport/flushController.spec.ts +0 -267
  933. package/src/transport/httpRequest.spec.ts +0 -400
  934. package/src/transport/sendWithRetryStrategy.spec.ts +0 -393
@@ -1,647 +0,0 @@
1
- import type { Clock } from '../../../test'
2
- import { mockClock, createFakeSessionStoreStrategy } from '../../../test'
3
- import type { InitConfiguration, Configuration } from '../configuration'
4
- import { display } from '../../tools/display'
5
- import type { SessionStore } from './sessionStore'
6
- import { STORAGE_POLL_DELAY, startSessionStore, selectSessionStoreStrategyType } from './sessionStore'
7
- import {
8
- SESSION_EXPIRATION_DELAY,
9
- SESSION_NOT_TRACKED,
10
- SESSION_TIME_OUT_DELAY,
11
- SessionPersistence,
12
- } from './sessionConstants'
13
- import type { SessionState } from './sessionState'
14
-
15
- const enum FakeTrackingType {
16
- TRACKED = 'tracked',
17
- NOT_TRACKED = SESSION_NOT_TRACKED,
18
- }
19
-
20
- const PRODUCT_KEY = 'product'
21
- const FIRST_ID = 'first'
22
- const SECOND_ID = 'second'
23
- const IS_EXPIRED = '1'
24
- const DEFAULT_INIT_CONFIGURATION: InitConfiguration = { clientToken: 'abc' }
25
- const DEFAULT_CONFIGURATION = { trackAnonymousUser: true } as Configuration
26
-
27
- const EMPTY_SESSION_STATE: SessionState = {}
28
-
29
- function createSessionState(
30
- trackingType: FakeTrackingType = FakeTrackingType.TRACKED,
31
- id?: string,
32
- expire?: number
33
- ): SessionState {
34
- return {
35
- [PRODUCT_KEY]: trackingType,
36
- created: `${Date.now()}`,
37
- expire: `${expire || Date.now() + SESSION_EXPIRATION_DELAY}`,
38
- ...(id ? { id } : {}),
39
- }
40
- }
41
-
42
- let sessionStoreStrategy: ReturnType<typeof createFakeSessionStoreStrategy>
43
-
44
- function getSessionStoreState(): SessionState {
45
- return sessionStoreStrategy.retrieveSession()
46
- }
47
-
48
- function expectTrackedSessionToBeInStore(id?: string) {
49
- expect(getSessionStoreState().id).toEqual(id ? id : jasmine.any(String))
50
- expect(getSessionStoreState().isExpired).toBeUndefined()
51
- expect(getSessionStoreState()[PRODUCT_KEY]).toEqual(FakeTrackingType.TRACKED)
52
- }
53
-
54
- function expectNotTrackedSessionToBeInStore() {
55
- expect(getSessionStoreState().id).toBeUndefined()
56
- expect(getSessionStoreState().isExpired).toBeUndefined()
57
- expect(getSessionStoreState()[PRODUCT_KEY]).toEqual(FakeTrackingType.NOT_TRACKED)
58
- }
59
-
60
- function expectSessionToBeExpiredInStore() {
61
- expect(getSessionStoreState().isExpired).toEqual(IS_EXPIRED)
62
- expect(getSessionStoreState().id).toBeUndefined()
63
- expect(getSessionStoreState()[PRODUCT_KEY]).toBeUndefined()
64
- }
65
-
66
- function getStoreExpiration() {
67
- return getSessionStoreState().expire
68
- }
69
-
70
- function resetSessionInStore() {
71
- sessionStoreStrategy.expireSession()
72
- sessionStoreStrategy.expireSession.calls.reset()
73
- }
74
-
75
- function setSessionInStore(sessionState: SessionState) {
76
- sessionStoreStrategy.persistSession(sessionState)
77
- sessionStoreStrategy.persistSession.calls.reset()
78
- }
79
-
80
- describe('session store', () => {
81
- describe('selectSessionStoreStrategyType', () => {
82
- describe('sessionPersistence: cookie (default)', () => {
83
- it('returns cookie strategy when cookies are available', () => {
84
- const sessionStoreStrategyType = selectSessionStoreStrategyType(DEFAULT_INIT_CONFIGURATION)
85
- expect(sessionStoreStrategyType).toEqual(jasmine.objectContaining({ type: SessionPersistence.COOKIE }))
86
- })
87
-
88
- it('returns undefined when cookies are not available', () => {
89
- disableCookies()
90
- const sessionStoreStrategyType = selectSessionStoreStrategyType(DEFAULT_INIT_CONFIGURATION)
91
- expect(sessionStoreStrategyType).toBeUndefined()
92
- })
93
-
94
- it('returns cookie strategy when sessionPersistence is cookie', () => {
95
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
96
- ...DEFAULT_INIT_CONFIGURATION,
97
- sessionPersistence: SessionPersistence.COOKIE,
98
- })
99
- expect(sessionStoreStrategyType).toEqual(jasmine.objectContaining({ type: SessionPersistence.COOKIE }))
100
- })
101
- })
102
-
103
- describe('sessionPersistence: local-storage', () => {
104
- it('returns local storage strategy when sessionPersistence is local storage', () => {
105
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
106
- ...DEFAULT_INIT_CONFIGURATION,
107
- sessionPersistence: SessionPersistence.LOCAL_STORAGE,
108
- })
109
- expect(sessionStoreStrategyType).toEqual(jasmine.objectContaining({ type: SessionPersistence.LOCAL_STORAGE }))
110
- })
111
-
112
- it('returns undefined when local storage is not available', () => {
113
- disableLocalStorage()
114
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
115
- ...DEFAULT_INIT_CONFIGURATION,
116
- sessionPersistence: SessionPersistence.LOCAL_STORAGE,
117
- })
118
- expect(sessionStoreStrategyType).toBeUndefined()
119
- })
120
- })
121
-
122
- it('returns undefined when sessionPersistence is invalid', () => {
123
- const displayErrorSpy = spyOn(display, 'error')
124
-
125
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
126
- ...DEFAULT_INIT_CONFIGURATION,
127
- sessionPersistence: 'invalid' as SessionPersistence,
128
- })
129
- expect(sessionStoreStrategyType).toBeUndefined()
130
- expect(displayErrorSpy).toHaveBeenCalledOnceWith("Invalid session persistence 'invalid'")
131
- })
132
-
133
- describe('allowFallbackToLocalStorage (deprecated)', () => {
134
- it('should return a type cookie when cookies are available', () => {
135
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
136
- ...DEFAULT_INIT_CONFIGURATION,
137
- allowFallbackToLocalStorage: true,
138
- })
139
- expect(sessionStoreStrategyType).toEqual(jasmine.objectContaining({ type: SessionPersistence.COOKIE }))
140
- })
141
-
142
- it('should report undefined when cookies are not available, and fallback is not allowed', () => {
143
- disableCookies()
144
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
145
- ...DEFAULT_INIT_CONFIGURATION,
146
- allowFallbackToLocalStorage: false,
147
- })
148
- expect(sessionStoreStrategyType).toBeUndefined()
149
- })
150
-
151
- it('should fallback to localStorage when cookies are not available', () => {
152
- disableCookies()
153
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
154
- ...DEFAULT_INIT_CONFIGURATION,
155
- allowFallbackToLocalStorage: true,
156
- })
157
- expect(sessionStoreStrategyType).toEqual({ type: SessionPersistence.LOCAL_STORAGE })
158
- })
159
-
160
- it('should report undefined when no storage is available', () => {
161
- disableLocalStorage()
162
- disableCookies()
163
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
164
- ...DEFAULT_INIT_CONFIGURATION,
165
- allowFallbackToLocalStorage: true,
166
- })
167
- expect(sessionStoreStrategyType).toBeUndefined()
168
- })
169
-
170
- it('does not fallback to localStorage when sessionPersistence is set to cookie', () => {
171
- disableCookies()
172
- const sessionStoreStrategyType = selectSessionStoreStrategyType({
173
- ...DEFAULT_INIT_CONFIGURATION,
174
- sessionPersistence: SessionPersistence.COOKIE,
175
- allowFallbackToLocalStorage: true,
176
- })
177
- expect(sessionStoreStrategyType).toBeUndefined()
178
- })
179
- })
180
-
181
- function disableCookies() {
182
- spyOnProperty(document, 'cookie', 'get').and.returnValue('')
183
- }
184
- function disableLocalStorage() {
185
- spyOn(Storage.prototype, 'getItem').and.throwError('unavailable')
186
- }
187
- })
188
-
189
- describe('session lifecyle mechanism', () => {
190
- let expireSpy: () => void
191
- let renewSpy: () => void
192
- let sessionStoreManager: SessionStore
193
- let clock: Clock
194
-
195
- function setupSessionStore(
196
- initialState: SessionState = {},
197
- computeTrackingType: (rawTrackingType?: string) => FakeTrackingType = () => FakeTrackingType.TRACKED
198
- ) {
199
- const sessionStoreStrategyType = selectSessionStoreStrategyType(DEFAULT_INIT_CONFIGURATION)
200
- if (sessionStoreStrategyType?.type !== SessionPersistence.COOKIE) {
201
- fail('Unable to initialize cookie storage')
202
- return
203
- }
204
-
205
- sessionStoreStrategy = createFakeSessionStoreStrategy({ isLockEnabled: true, initialSession: initialState })
206
-
207
- sessionStoreManager = startSessionStore(
208
- sessionStoreStrategyType,
209
- DEFAULT_CONFIGURATION,
210
- PRODUCT_KEY,
211
- computeTrackingType,
212
- sessionStoreStrategy
213
- )
214
- sessionStoreStrategy.persistSession.calls.reset()
215
- sessionStoreManager.expireObservable.subscribe(expireSpy)
216
- sessionStoreManager.renewObservable.subscribe(renewSpy)
217
- }
218
-
219
- beforeEach(() => {
220
- expireSpy = jasmine.createSpy('expire session')
221
- renewSpy = jasmine.createSpy('renew session')
222
- clock = mockClock()
223
- })
224
-
225
- afterEach(() => {
226
- resetSessionInStore()
227
- sessionStoreManager.stop()
228
- })
229
-
230
- describe('initialize session', () => {
231
- it('when session not in store, should initialize a new session', () => {
232
- setupSessionStore()
233
- expect(sessionStoreManager.getSession().isExpired).toEqual(IS_EXPIRED)
234
- expect(sessionStoreManager.getSession().anonymousId).toEqual(jasmine.any(String))
235
- })
236
-
237
- it('when tracked session in store, should do nothing ', () => {
238
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
239
-
240
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
241
- expect(sessionStoreManager.getSession().isExpired).toBeUndefined()
242
- expect(sessionStoreManager.getSession()[PRODUCT_KEY]).toBeDefined()
243
- })
244
-
245
- it('when not tracked session in store, should do nothing ', () => {
246
- setupSessionStore(createSessionState(FakeTrackingType.NOT_TRACKED))
247
-
248
- expect(sessionStoreManager.getSession().id).toBeUndefined()
249
- expect(sessionStoreManager.getSession().isExpired).toBeUndefined()
250
- expect(sessionStoreManager.getSession()[PRODUCT_KEY]).toBeDefined()
251
- })
252
-
253
- it('should generate an anonymousId if not present', () => {
254
- setupSessionStore()
255
- expect(sessionStoreManager.getSession().anonymousId).toBeDefined()
256
- })
257
- })
258
-
259
- describe('expand or renew session', () => {
260
- it(
261
- 'when session not in cache, session not in store and new session tracked, ' +
262
- 'should create new session and trigger renew session ',
263
- () => {
264
- setupSessionStore()
265
-
266
- sessionStoreManager.expandOrRenewSession()
267
-
268
- expect(sessionStoreManager.getSession().id).toBeDefined()
269
- expectTrackedSessionToBeInStore()
270
- expect(expireSpy).not.toHaveBeenCalled()
271
- expect(renewSpy).toHaveBeenCalledTimes(1)
272
- }
273
- )
274
-
275
- it(
276
- 'when session not in cache, session not in store and new session not tracked, ' +
277
- 'should store not tracked session and trigger renew session',
278
- () => {
279
- setupSessionStore(EMPTY_SESSION_STATE, () => FakeTrackingType.NOT_TRACKED)
280
-
281
- sessionStoreManager.expandOrRenewSession()
282
-
283
- expect(sessionStoreManager.getSession().id).toBeUndefined()
284
- expectNotTrackedSessionToBeInStore()
285
- expect(expireSpy).not.toHaveBeenCalled()
286
- expect(renewSpy).toHaveBeenCalledTimes(1)
287
- }
288
- )
289
-
290
- it('when session not in cache and session in store, should expand session and trigger renew session', () => {
291
- setupSessionStore()
292
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
293
-
294
- sessionStoreManager.expandOrRenewSession()
295
-
296
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
297
- expectTrackedSessionToBeInStore(FIRST_ID)
298
- expect(expireSpy).not.toHaveBeenCalled()
299
- expect(renewSpy).toHaveBeenCalledTimes(1)
300
- })
301
-
302
- it(
303
- 'when session in cache, session not in store and new session tracked, ' +
304
- 'should expire session, create a new one and trigger renew session',
305
- () => {
306
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
307
- resetSessionInStore()
308
-
309
- sessionStoreManager.expandOrRenewSession()
310
-
311
- const sessionId = sessionStoreManager.getSession().id
312
- expect(sessionId).toBeDefined()
313
- expect(sessionId).not.toBe(FIRST_ID)
314
- expectTrackedSessionToBeInStore(sessionId)
315
- expect(expireSpy).toHaveBeenCalled()
316
- expect(renewSpy).toHaveBeenCalledTimes(1)
317
- }
318
- )
319
-
320
- it(
321
- 'when session in cache, session not in store and new session not tracked, ' +
322
- 'should expire session, store not tracked session and trigger renew session',
323
- () => {
324
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID), () => FakeTrackingType.NOT_TRACKED)
325
- resetSessionInStore()
326
-
327
- sessionStoreManager.expandOrRenewSession()
328
-
329
- expect(sessionStoreManager.getSession().id).toBeUndefined()
330
- expect(sessionStoreManager.getSession()[PRODUCT_KEY]).toBeDefined()
331
- expectNotTrackedSessionToBeInStore()
332
- expect(expireSpy).toHaveBeenCalled()
333
- expect(renewSpy).toHaveBeenCalledTimes(1)
334
- }
335
- )
336
-
337
- it(
338
- 'when session not tracked in cache, session not in store and new session not tracked, ' +
339
- 'should expire session, store not tracked session and trigger renew session',
340
- () => {
341
- setupSessionStore(createSessionState(FakeTrackingType.NOT_TRACKED), () => FakeTrackingType.NOT_TRACKED)
342
- resetSessionInStore()
343
-
344
- sessionStoreManager.expandOrRenewSession()
345
-
346
- expect(sessionStoreManager.getSession().id).toBeUndefined()
347
- expect(sessionStoreManager.getSession()[PRODUCT_KEY]).toBeDefined()
348
- expectNotTrackedSessionToBeInStore()
349
- expect(expireSpy).toHaveBeenCalled()
350
- expect(renewSpy).toHaveBeenCalledTimes(1)
351
- }
352
- )
353
-
354
- it('when session in cache is same session than in store, should expand session', () => {
355
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
356
-
357
- clock.tick(10)
358
- sessionStoreManager.expandOrRenewSession()
359
-
360
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
361
- expect(sessionStoreManager.getSession().expire).toBe(getStoreExpiration())
362
- expectTrackedSessionToBeInStore(FIRST_ID)
363
- expect(expireSpy).not.toHaveBeenCalled()
364
- expect(renewSpy).not.toHaveBeenCalled()
365
- })
366
-
367
- it(
368
- 'when session in cache is different session than in store and store session is tracked, ' +
369
- 'should expire session, expand store session and trigger renew',
370
- () => {
371
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
372
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, SECOND_ID))
373
-
374
- sessionStoreManager.expandOrRenewSession()
375
-
376
- expect(sessionStoreManager.getSession().id).toBe(SECOND_ID)
377
- expectTrackedSessionToBeInStore(SECOND_ID)
378
- expect(expireSpy).toHaveBeenCalled()
379
- expect(renewSpy).toHaveBeenCalledTimes(1)
380
- }
381
- )
382
-
383
- it(
384
- 'when session in cache is different session than in store and store session is not tracked, ' +
385
- 'should expire session, store not tracked session and trigger renew',
386
- () => {
387
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID), (rawTrackingType) =>
388
- rawTrackingType === FakeTrackingType.TRACKED ? FakeTrackingType.TRACKED : FakeTrackingType.NOT_TRACKED
389
- )
390
- setSessionInStore(createSessionState(FakeTrackingType.NOT_TRACKED, ''))
391
-
392
- sessionStoreManager.expandOrRenewSession()
393
-
394
- expect(sessionStoreManager.getSession().id).toBeUndefined()
395
- expectNotTrackedSessionToBeInStore()
396
- expect(expireSpy).toHaveBeenCalled()
397
- expect(renewSpy).toHaveBeenCalledTimes(1)
398
- }
399
- )
400
-
401
- it('when throttled, expandOrRenewSession() should not renew the session if expire() is called right after', () => {
402
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
403
-
404
- // The first call is not throttled (leading execution)
405
- sessionStoreManager.expandOrRenewSession()
406
-
407
- sessionStoreManager.expandOrRenewSession()
408
- sessionStoreManager.expire()
409
-
410
- clock.tick(STORAGE_POLL_DELAY)
411
-
412
- expectSessionToBeExpiredInStore()
413
- expect(sessionStoreManager.getSession().id).toBeUndefined()
414
- expect(renewSpy).not.toHaveBeenCalled()
415
- })
416
- })
417
-
418
- describe('expand session', () => {
419
- it('when session not in cache and session not in store, should do nothing', () => {
420
- setupSessionStore()
421
-
422
- sessionStoreManager.expandSession()
423
-
424
- expect(sessionStoreManager.getSession().id).toBeUndefined()
425
- expect(expireSpy).not.toHaveBeenCalled()
426
- })
427
-
428
- it('when session not in cache and session in store, should do nothing', () => {
429
- setupSessionStore()
430
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
431
-
432
- sessionStoreManager.expandSession()
433
-
434
- expect(sessionStoreManager.getSession().id).toBeUndefined()
435
- expect(expireSpy).not.toHaveBeenCalled()
436
- })
437
-
438
- it('when session in cache and session not in store, should expire session', () => {
439
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
440
- resetSessionInStore()
441
-
442
- sessionStoreManager.expandSession()
443
-
444
- expectSessionToBeExpiredInStore()
445
- expect(sessionStoreManager.getSession().id).toBeUndefined()
446
- expect(expireSpy).toHaveBeenCalled()
447
- })
448
-
449
- it('when session in cache is same session than in store, should expand session', () => {
450
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
451
-
452
- clock.tick(10)
453
- sessionStoreManager.expandSession()
454
-
455
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
456
- expect(sessionStoreManager.getSession().expire).toBe(getStoreExpiration())
457
- expect(expireSpy).not.toHaveBeenCalled()
458
- })
459
-
460
- it('when session in cache is different session than in store, should expire session', () => {
461
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
462
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, SECOND_ID))
463
-
464
- sessionStoreManager.expandSession()
465
-
466
- expect(sessionStoreManager.getSession().id).toBeUndefined()
467
- expectTrackedSessionToBeInStore(SECOND_ID)
468
- expect(expireSpy).toHaveBeenCalled()
469
- })
470
- })
471
-
472
- describe('regular watch', () => {
473
- it('when session not in cache and session not in store, should store the expired session', () => {
474
- setupSessionStore()
475
-
476
- clock.tick(STORAGE_POLL_DELAY)
477
-
478
- expectSessionToBeExpiredInStore()
479
- expect(sessionStoreManager.getSession().id).toBeUndefined()
480
- expect(expireSpy).not.toHaveBeenCalled()
481
- expect(sessionStoreStrategy.persistSession).toHaveBeenCalled()
482
- })
483
-
484
- it('when session in cache and session not in store, should expire session', () => {
485
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
486
- resetSessionInStore()
487
-
488
- clock.tick(STORAGE_POLL_DELAY)
489
-
490
- expect(sessionStoreManager.getSession().id).toBeUndefined()
491
- expectSessionToBeExpiredInStore()
492
- expect(expireSpy).toHaveBeenCalled()
493
- expect(sessionStoreStrategy.persistSession).toHaveBeenCalled()
494
- })
495
-
496
- it('when session not in cache and session in store, should do nothing', () => {
497
- setupSessionStore()
498
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
499
-
500
- clock.tick(STORAGE_POLL_DELAY)
501
-
502
- expect(sessionStoreManager.getSession().id).toBeUndefined()
503
- expect(expireSpy).not.toHaveBeenCalled()
504
- expect(sessionStoreStrategy.persistSession).not.toHaveBeenCalled()
505
- })
506
-
507
- it('when session in cache is same session than in store, should synchronize session', () => {
508
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
509
- setSessionInStore(
510
- createSessionState(FakeTrackingType.TRACKED, FIRST_ID, Date.now() + SESSION_TIME_OUT_DELAY + 10)
511
- )
512
-
513
- clock.tick(STORAGE_POLL_DELAY)
514
-
515
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
516
- expect(sessionStoreManager.getSession().expire).toBe(getStoreExpiration())
517
- expect(expireSpy).not.toHaveBeenCalled()
518
- expect(sessionStoreStrategy.persistSession).not.toHaveBeenCalled()
519
- })
520
-
521
- it('when session id in cache is different than session id in store, should expire session and not touch the store', () => {
522
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
523
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, SECOND_ID))
524
-
525
- clock.tick(STORAGE_POLL_DELAY)
526
-
527
- expect(sessionStoreManager.getSession().id).toBeUndefined()
528
- expect(expireSpy).toHaveBeenCalled()
529
- expect(sessionStoreStrategy.persistSession).not.toHaveBeenCalled()
530
- })
531
-
532
- it('when session in store is expired first and then get updated by another tab, should expire session in cache and not touch the store', () => {
533
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
534
- resetSessionInStore()
535
-
536
- // Simulate a new session being written to the store by another tab during the watch.
537
- // Watch is reading the cookie twice so we need to plan the write of the cookie at the right index
538
- sessionStoreStrategy.planRetrieveSession(1, createSessionState(FakeTrackingType.TRACKED, SECOND_ID))
539
-
540
- clock.tick(STORAGE_POLL_DELAY)
541
-
542
- // expires session in cache
543
- expect(sessionStoreManager.getSession().id).toBeUndefined()
544
- expect(expireSpy).toHaveBeenCalled()
545
-
546
- // Does not touch the store
547
- // The two calls to persist session are for the lock management, these can be ignored
548
- expect(sessionStoreStrategy.persistSession).toHaveBeenCalledTimes(2)
549
- expect(sessionStoreStrategy.expireSession).not.toHaveBeenCalled()
550
- })
551
-
552
- it('when session type in cache is different than session type in store, should expire session and not touch the store', () => {
553
- setupSessionStore(createSessionState(FakeTrackingType.NOT_TRACKED, FIRST_ID))
554
- setSessionInStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
555
-
556
- clock.tick(STORAGE_POLL_DELAY)
557
-
558
- expect(sessionStoreManager.getSession().id).toBeUndefined()
559
- expect(expireSpy).toHaveBeenCalled()
560
- expect(sessionStoreStrategy.persistSession).not.toHaveBeenCalled()
561
- })
562
- })
563
-
564
- describe('reinitialize session', () => {
565
- it('when session not in store, should reinitialize the store', () => {
566
- setupSessionStore()
567
-
568
- sessionStoreManager.restartSession()
569
-
570
- expect(sessionStoreManager.getSession().isExpired).toEqual(IS_EXPIRED)
571
- expect(sessionStoreManager.getSession().anonymousId).toEqual(jasmine.any(String))
572
- })
573
-
574
- it('when session in store, should do nothing', () => {
575
- setupSessionStore(createSessionState(FakeTrackingType.TRACKED, FIRST_ID))
576
-
577
- sessionStoreManager.restartSession()
578
-
579
- expect(sessionStoreManager.getSession().id).toBe(FIRST_ID)
580
- expect(sessionStoreManager.getSession().isExpired).toBeUndefined()
581
- })
582
-
583
- it('restart session should generate an anonymousId if not present', () => {
584
- setupSessionStore()
585
- sessionStoreManager.restartSession()
586
- expect(sessionStoreManager.getSession().anonymousId).toBeDefined()
587
- })
588
- })
589
- })
590
-
591
- describe('session update and synchronisation', () => {
592
- let updateSpy: jasmine.Spy<jasmine.Func>
593
- let otherUpdateSpy: jasmine.Spy<jasmine.Func>
594
- let clock: Clock
595
-
596
- function setupSessionStore(initialState: SessionState = {}, updateSpy: () => void) {
597
- const computeTrackingType: (rawTrackingType?: string) => FakeTrackingType = () => FakeTrackingType.TRACKED
598
- const sessionStoreStrategyType = selectSessionStoreStrategyType(DEFAULT_INIT_CONFIGURATION)
599
-
600
- sessionStoreStrategy = createFakeSessionStoreStrategy({ isLockEnabled: true, initialSession: initialState })
601
-
602
- const sessionStoreManager = startSessionStore(
603
- sessionStoreStrategyType!,
604
- DEFAULT_CONFIGURATION,
605
- PRODUCT_KEY,
606
- computeTrackingType,
607
- sessionStoreStrategy
608
- )
609
- sessionStoreManager.sessionStateUpdateObservable.subscribe(updateSpy)
610
-
611
- return sessionStoreManager
612
- }
613
-
614
- let sessionStoreManager: SessionStore
615
- let otherSessionStoreManager: SessionStore
616
-
617
- beforeEach(() => {
618
- updateSpy = jasmine.createSpy()
619
- otherUpdateSpy = jasmine.createSpy()
620
- clock = mockClock()
621
- })
622
-
623
- afterEach(() => {
624
- resetSessionInStore()
625
- sessionStoreManager.stop()
626
- otherSessionStoreManager.stop()
627
- })
628
-
629
- it('should synchronise all stores and notify update observables of all stores', () => {
630
- const initialState = createSessionState(FakeTrackingType.TRACKED, FIRST_ID)
631
- sessionStoreManager = setupSessionStore(initialState, updateSpy)
632
- otherSessionStoreManager = setupSessionStore(initialState, otherUpdateSpy)
633
-
634
- sessionStoreManager.updateSessionState({ extra: 'extra' })
635
-
636
- expect(updateSpy).toHaveBeenCalledTimes(1)
637
-
638
- const callArgs = updateSpy.calls.argsFor(0)[0]
639
- expect(callArgs!.previousState.extra).toBeUndefined()
640
- expect(callArgs.newState.extra).toBe('extra')
641
-
642
- // Need to wait until watch is triggered
643
- clock.tick(STORAGE_POLL_DELAY)
644
- expect(otherUpdateSpy).toHaveBeenCalled()
645
- })
646
- })
647
- })