@cloudcare/browser-rum 3.3.15 → 3.3.16

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 (71) hide show
  1. package/README.md +12 -0
  2. package/README.zh.md +13 -0
  3. package/bundle/dataflux-rum.js +1 -1
  4. package/cjs/boot/buildEnv.js +1 -1
  5. package/cjs/boot/startRecording.js +4 -4
  6. package/cjs/boot/startRecording.js.map +1 -1
  7. package/cjs/constants.js +8 -8
  8. package/cjs/constants.js.map +1 -1
  9. package/cjs/domain/assembly.js +7 -0
  10. package/cjs/domain/assembly.js.map +1 -1
  11. package/cjs/domain/deflate/deflateWorker.js +1 -1
  12. package/cjs/domain/encoderStreamId.js +2 -1
  13. package/cjs/domain/encoderStreamId.js.map +1 -1
  14. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  15. package/cjs/domain/replay/record/record.js +2 -3
  16. package/cjs/domain/replay/record/record.js.map +1 -1
  17. package/cjs/domain/replay/record/serializationUtils.js +8 -15
  18. package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
  19. package/cjs/domain/replay/record/serialize.js +14 -6
  20. package/cjs/domain/replay/record/serialize.js.map +1 -1
  21. package/cjs/domain/rumEventsCollection/error/errorCollection.js +6 -8
  22. package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  23. package/cjs/domain/rumSessionManager.js +3 -3
  24. package/cjs/domain/rumSessionManager.js.map +1 -1
  25. package/cjs/domain/visitorId/index.js +38 -0
  26. package/cjs/domain/visitorId/index.js.map +1 -1
  27. package/cjs/index.js +7 -0
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/transport/startRumBatch.js +44 -3
  30. package/cjs/transport/startRumBatch.js.map +1 -1
  31. package/esm/boot/buildEnv.js +1 -1
  32. package/esm/boot/startRecording.js +4 -4
  33. package/esm/boot/startRecording.js.map +1 -1
  34. package/esm/constants.js +1 -8
  35. package/esm/constants.js.map +1 -1
  36. package/esm/domain/assembly.js +8 -1
  37. package/esm/domain/assembly.js.map +1 -1
  38. package/esm/domain/deflate/deflateWorker.js +1 -1
  39. package/esm/domain/encoderStreamId.js +2 -1
  40. package/esm/domain/encoderStreamId.js.map +1 -1
  41. package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
  42. package/esm/domain/replay/record/record.js +1 -2
  43. package/esm/domain/replay/record/record.js.map +1 -1
  44. package/esm/domain/replay/record/serializationUtils.js +8 -15
  45. package/esm/domain/replay/record/serializationUtils.js.map +1 -1
  46. package/esm/domain/replay/record/serialize.js +13 -5
  47. package/esm/domain/replay/record/serialize.js.map +1 -1
  48. package/esm/domain/rumEventsCollection/error/errorCollection.js +6 -8
  49. package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  50. package/esm/domain/rumSessionManager.js +3 -3
  51. package/esm/domain/rumSessionManager.js.map +1 -1
  52. package/esm/domain/visitorId/index.js +39 -1
  53. package/esm/domain/visitorId/index.js.map +1 -1
  54. package/esm/index.js +1 -0
  55. package/esm/index.js.map +1 -1
  56. package/esm/transport/startRumBatch.js +45 -4
  57. package/esm/transport/startRumBatch.js.map +1 -1
  58. package/package.json +4 -4
  59. package/src/boot/startRecording.js +7 -3
  60. package/src/constants.js +1 -8
  61. package/src/domain/assembly.js +15 -1
  62. package/src/domain/encoderStreamId.js +2 -2
  63. package/src/domain/replay/record/record.js +1 -2
  64. package/src/domain/replay/record/serializationUtils.js +10 -24
  65. package/src/domain/replay/record/serialize.js +25 -5
  66. package/src/domain/rumEventsCollection/error/errorCollection.js +10 -8
  67. package/src/domain/rumSessionManager.js +8 -7
  68. package/src/domain/visitorId/index.js +49 -0
  69. package/src/index.js +1 -0
  70. package/src/transport/startRumBatch.js +61 -3
  71. package/types/index.d.ts +22 -2
package/README.md CHANGED
@@ -152,6 +152,18 @@ record is used so a refresh cannot restore the value from before a rotation. Cal
152
152
  Do not call it from repeatable 401 or unauthenticated-request branches, which
153
153
  would continually rotate the bucket and bypass the limit.
154
154
 
155
+ In an allowed WebView, the SDK prefers the synchronous return value of
156
+ `window.FTWebViewJavascriptBridge.getVisitorid()` for request headers and RUM
157
+ context. Use a native SDK version that exposes this optional method; older versions may
158
+ not support it. Return the current App ID as 1–256 non-whitespace printable ASCII
159
+ characters. The value is used unchanged and is never stored in Web storage.
160
+ Native IDs ignore the Web TTL, and `resetVisitorId()` is a no-op while the bridge
161
+ returns a valid ID: the App owns rotation. Each read picks up App-side changes;
162
+ in-flight Resource events retain their request-time ID. Missing, invalid or
163
+ throwing getters, or disallowed hosts, fall back to the Web behavior above.
164
+ A bridge that becomes ready later is used on subsequent reads. Async native
165
+ bridges must expose a synchronously readable JS cache, not a Promise.
166
+
155
167
  Cross-origin requests require the configured header in the API's CORS policy.
156
168
  The ID is only a rate-limit bucket and observability correlation key, not an
157
169
  authentication credential, tenant identity, or audit identity. Because clients
package/README.zh.md CHANGED
@@ -55,6 +55,19 @@ datafluxRum.init({
55
55
  - 访客标识可被客户端伪造,限流处罚时间应保持较短,避免攻击者冒用其他访客 ID
56
56
  造成长时间误封。
57
57
 
58
+ ### WebView 与 App 统一
59
+
60
+ 开启 `visitorId.enabled` 后,若当前域名允许使用观测云 bridge,SDK 优先读取
61
+ `window.FTWebViewJavascriptBridge.getVisitorid()` 的同步返回值,原样用于请求头和
62
+ `context.visitor_id`。需使用包含该接口的移动 SDK 版本,返回当前原生 ID(1–256 个非空白可打印
63
+ ASCII 字符);仅接入旧版 App SDK 不代表已有此能力。
64
+
65
+ App ID 不写入 Web 存储,不受 Web `ttlHours` 影响;此时 Web `resetVisitorId()` 无操作,
66
+ 退出或切换账户后应由 App 统一轮转。SDK 每次读取最新原生 ID,在途 Resource 仍保留
67
+ 请求发起时的 ID。无方法、未就绪、返回非法值、读取异常或域名未获准时自动回退到上述
68
+ Web 生成逻辑;bridge 后续可用时自动采用 App ID。异步消息桥需先将原生 ID 同步到 JS
69
+ 缓存,再由该方法同步返回,不能直接返回 Promise。
70
+
58
71
  ## Session Replay
59
72
 
60
73
  启用 Session Replay 至少需要: