@amplitude/session-replay-browser 1.46.0 → 1.47.0-sr-trc-debug-log.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/lib/cjs/config/joined-config.d.ts +6 -1
  2. package/lib/cjs/config/joined-config.d.ts.map +1 -1
  3. package/lib/cjs/config/joined-config.js +63 -19
  4. package/lib/cjs/config/joined-config.js.map +1 -1
  5. package/lib/cjs/config/local-config.d.ts +5 -1
  6. package/lib/cjs/config/local-config.d.ts.map +1 -1
  7. package/lib/cjs/config/local-config.js +19 -1
  8. package/lib/cjs/config/local-config.js.map +1 -1
  9. package/lib/cjs/config/types.d.ts +19 -1
  10. package/lib/cjs/config/types.d.ts.map +1 -1
  11. package/lib/cjs/config/types.js.map +1 -1
  12. package/lib/cjs/diagnostics.d.ts +43 -0
  13. package/lib/cjs/diagnostics.d.ts.map +1 -0
  14. package/lib/cjs/diagnostics.js +54 -0
  15. package/lib/cjs/diagnostics.js.map +1 -0
  16. package/lib/cjs/session-replay.d.ts +25 -0
  17. package/lib/cjs/session-replay.d.ts.map +1 -1
  18. package/lib/cjs/session-replay.js +250 -51
  19. package/lib/cjs/session-replay.js.map +1 -1
  20. package/lib/cjs/targeting/targeting-manager.d.ts +4 -1
  21. package/lib/cjs/targeting/targeting-manager.d.ts.map +1 -1
  22. package/lib/cjs/targeting/targeting-manager.js +47 -10
  23. package/lib/cjs/targeting/targeting-manager.js.map +1 -1
  24. package/lib/cjs/version.d.ts +1 -1
  25. package/lib/cjs/version.d.ts.map +1 -1
  26. package/lib/cjs/version.js +1 -1
  27. package/lib/cjs/version.js.map +1 -1
  28. package/lib/esm/config/joined-config.d.ts +6 -1
  29. package/lib/esm/config/joined-config.d.ts.map +1 -1
  30. package/lib/esm/config/joined-config.js +63 -19
  31. package/lib/esm/config/joined-config.js.map +1 -1
  32. package/lib/esm/config/local-config.d.ts +5 -1
  33. package/lib/esm/config/local-config.d.ts.map +1 -1
  34. package/lib/esm/config/local-config.js +20 -2
  35. package/lib/esm/config/local-config.js.map +1 -1
  36. package/lib/esm/config/types.d.ts +19 -1
  37. package/lib/esm/config/types.d.ts.map +1 -1
  38. package/lib/esm/config/types.js.map +1 -1
  39. package/lib/esm/diagnostics.d.ts +43 -0
  40. package/lib/esm/diagnostics.d.ts.map +1 -0
  41. package/lib/esm/diagnostics.js +51 -0
  42. package/lib/esm/diagnostics.js.map +1 -0
  43. package/lib/esm/session-replay.d.ts +25 -0
  44. package/lib/esm/session-replay.d.ts.map +1 -1
  45. package/lib/esm/session-replay.js +250 -51
  46. package/lib/esm/session-replay.js.map +1 -1
  47. package/lib/esm/targeting/targeting-manager.d.ts +4 -1
  48. package/lib/esm/targeting/targeting-manager.d.ts.map +1 -1
  49. package/lib/esm/targeting/targeting-manager.js +47 -10
  50. package/lib/esm/targeting/targeting-manager.js.map +1 -1
  51. package/lib/esm/version.d.ts +1 -1
  52. package/lib/esm/version.d.ts.map +1 -1
  53. package/lib/esm/version.js +1 -1
  54. package/lib/esm/version.js.map +1 -1
  55. package/lib/scripts/index-min.js +1 -1
  56. package/lib/scripts/index-min.js.gz +0 -0
  57. package/lib/scripts/index-min.js.map +1 -1
  58. package/lib/scripts/observers-min.js +1 -1
  59. package/lib/scripts/observers-min.js.gz +0 -0
  60. package/lib/scripts/session-replay-browser-min.js +1 -1
  61. package/lib/scripts/session-replay-browser-min.js.gz +0 -0
  62. package/lib/scripts/session-replay-browser-min.js.map +1 -1
  63. package/lib/scripts/targeting-min.js +1 -1
  64. package/lib/scripts/targeting-min.js.gz +0 -0
  65. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
- import{c as t}from"./targeting-min.js";import{g as e}from"./index-min.js";const n=["image/","audio/","video/","application/octet-stream","font/"];function o(t,e){if(new Blob([t]).size<=e)return{value:t,truncated:!1};let n=0,o=Math.min(t.length,e);for(;n<o;){const s=Math.ceil((n+o)/2);new Blob([t.slice(0,s)]).size<=e?n=s:o=s-1}return n>0&&t.charCodeAt(n-1)>=55296&&t.charCodeAt(n-1)<=56319&&(n-=1),{value:t.slice(0,n),truncated:!0}}class s{constructor(){this.fetchObserver=null}start(t,e){this.eventCallback=t,this.networkConfig=e,this.observeFetch()}stop(){var t;null===(t=this.fetchObserver)||void 0===t||t.call(this),this.fetchObserver=null,this.eventCallback=void 0,this.networkConfig=void 0}notifyEvent(t){var e;null===(e=this.eventCallback)||void 0===e||e.call(this,t)}observeFetch(){const s=e();if(!s)return;const r=s.fetch;r&&(s.fetch=(e,s)=>t(this,void 0,void 0,function*(){var t,i;const a=Date.now(),c={timestamp:a,type:"fetch",method:(null==s?void 0:s.method)||"GET",url:e.toString(),requestHeaders:null==s?void 0:s.headers},l=null===(t=this.networkConfig)||void 0===t?void 0:t.body;if(null==l?void 0:l.request){const t=function(t){if(null!=t){if("string"==typeof t)return t;if(t instanceof URLSearchParams)return t.toString();if(t instanceof FormData){const e=[];return t.forEach((t,n)=>{e.push(`${n}=${"string"==typeof t?t:"[File]"}`)}),e.join("&")}}}(null==s?void 0:s.body);if(void 0!==t){const e=null!==(i=l.maxBodySizeBytes)&&void 0!==i?i:10240;c.requestBody=o(t,e).value}}try{const t=yield r(e,s),i=Date.now();c.status=t.status,c.duration=i-a;const u={};if(t.headers.forEach((t,e)=>{u[e]=t}),c.responseHeaders=u,null==l?void 0:l.response){if(function(t){return!!t&&n.some(e=>t.toLowerCase().startsWith(e))}(u["content-type"]||null))c.responseBodyStatus="skipped_binary",this.notifyEvent(c);else{t.clone().text().then(t=>{var e;const n=null!==(e=l.maxBodySizeBytes)&&void 0!==e?e:10240,{value:s,truncated:r}=o(t,n);c.responseBody=s,c.responseBodyStatus=r?"truncated":"captured",this.notifyEvent(c)},()=>{c.responseBodyStatus="error",this.notifyEvent(c)})}}else this.notifyEvent(c);return t}catch(t){const e=Date.now();c.duration=e-a;const n=t;throw c.error={name:n.name||"UnknownError",message:n.message||"An unknown error occurred"},this.notifyEvent(c),t}}),this.fetchObserver=()=>{s.fetch=r})}}export{s as NetworkObservers};
1
+ import{b as t}from"./targeting-min.js";import{g as e}from"./index-min.js";const n=["image/","audio/","video/","application/octet-stream","font/"];function o(t,e){if(new Blob([t]).size<=e)return{value:t,truncated:!1};let n=0,o=Math.min(t.length,e);for(;n<o;){const s=Math.ceil((n+o)/2);new Blob([t.slice(0,s)]).size<=e?n=s:o=s-1}return n>0&&t.charCodeAt(n-1)>=55296&&t.charCodeAt(n-1)<=56319&&(n-=1),{value:t.slice(0,n),truncated:!0}}class s{constructor(){this.fetchObserver=null}start(t,e){this.eventCallback=t,this.networkConfig=e,this.observeFetch()}stop(){var t;null===(t=this.fetchObserver)||void 0===t||t.call(this),this.fetchObserver=null,this.eventCallback=void 0,this.networkConfig=void 0}notifyEvent(t){var e;null===(e=this.eventCallback)||void 0===e||e.call(this,t)}observeFetch(){const s=e();if(!s)return;const r=s.fetch;r&&(s.fetch=(e,s)=>t(this,void 0,void 0,function*(){var t,i;const a=Date.now(),c={timestamp:a,type:"fetch",method:(null==s?void 0:s.method)||"GET",url:e.toString(),requestHeaders:null==s?void 0:s.headers},l=null===(t=this.networkConfig)||void 0===t?void 0:t.body;if(null==l?void 0:l.request){const t=function(t){if(null!=t){if("string"==typeof t)return t;if(t instanceof URLSearchParams)return t.toString();if(t instanceof FormData){const e=[];return t.forEach((t,n)=>{e.push(`${n}=${"string"==typeof t?t:"[File]"}`)}),e.join("&")}}}(null==s?void 0:s.body);if(void 0!==t){const e=null!==(i=l.maxBodySizeBytes)&&void 0!==i?i:10240;c.requestBody=o(t,e).value}}try{const t=yield r(e,s),i=Date.now();c.status=t.status,c.duration=i-a;const u={};if(t.headers.forEach((t,e)=>{u[e]=t}),c.responseHeaders=u,null==l?void 0:l.response){if(function(t){return!!t&&n.some(e=>t.toLowerCase().startsWith(e))}(u["content-type"]||null))c.responseBodyStatus="skipped_binary",this.notifyEvent(c);else{t.clone().text().then(t=>{var e;const n=null!==(e=l.maxBodySizeBytes)&&void 0!==e?e:10240,{value:s,truncated:r}=o(t,n);c.responseBody=s,c.responseBodyStatus=r?"truncated":"captured",this.notifyEvent(c)},()=>{c.responseBodyStatus="error",this.notifyEvent(c)})}}else this.notifyEvent(c);return t}catch(t){const e=Date.now();c.duration=e-a;const n=t;throw c.error={name:n.name||"UnknownError",message:n.message||"An unknown error occurred"},this.notifyEvent(c),t}}),this.fetchObserver=()=>{s.fetch=r})}}export{s as NetworkObservers};
2
2
  //# sourceMappingURL=observers-min.js.map
Binary file