@amplitude/session-replay-browser 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/lib/cjs/config/local-config.d.ts +2 -1
- package/lib/cjs/config/local-config.d.ts.map +1 -1
- package/lib/cjs/config/local-config.js +3 -0
- package/lib/cjs/config/local-config.js.map +1 -1
- package/lib/cjs/config/types.d.ts +26 -0
- package/lib/cjs/config/types.d.ts.map +1 -1
- package/lib/cjs/config/types.js.map +1 -1
- package/lib/cjs/constants.d.ts +2 -0
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js +3 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/cross-origin-iframes.d.ts +28 -0
- package/lib/cjs/cross-origin-iframes.d.ts.map +1 -0
- package/lib/cjs/cross-origin-iframes.js +175 -0
- package/lib/cjs/cross-origin-iframes.js.map +1 -0
- package/lib/cjs/events/events-idb-store.d.ts +25 -4
- package/lib/cjs/events/events-idb-store.d.ts.map +1 -1
- package/lib/cjs/events/events-idb-store.js +257 -61
- package/lib/cjs/events/events-idb-store.js.map +1 -1
- package/lib/cjs/session-replay.d.ts +4 -0
- package/lib/cjs/session-replay.d.ts.map +1 -1
- package/lib/cjs/session-replay.js +118 -51
- package/lib/cjs/session-replay.js.map +1 -1
- package/lib/cjs/track-destination.d.ts.map +1 -1
- package/lib/cjs/track-destination.js +5 -1
- package/lib/cjs/track-destination.js.map +1 -1
- package/lib/cjs/utils/rrweb.d.ts +1 -0
- package/lib/cjs/utils/rrweb.d.ts.map +1 -1
- package/lib/cjs/utils/rrweb.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/cjs/worker/index.js +1 -1
- package/lib/esm/config/local-config.d.ts +2 -1
- package/lib/esm/config/local-config.d.ts.map +1 -1
- package/lib/esm/config/local-config.js +3 -0
- package/lib/esm/config/local-config.js.map +1 -1
- package/lib/esm/config/types.d.ts +26 -0
- package/lib/esm/config/types.d.ts.map +1 -1
- package/lib/esm/config/types.js.map +1 -1
- package/lib/esm/constants.d.ts +2 -0
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js +2 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/cross-origin-iframes.d.ts +28 -0
- package/lib/esm/cross-origin-iframes.d.ts.map +1 -0
- package/lib/esm/cross-origin-iframes.js +170 -0
- package/lib/esm/cross-origin-iframes.js.map +1 -0
- package/lib/esm/events/events-idb-store.d.ts +25 -4
- package/lib/esm/events/events-idb-store.d.ts.map +1 -1
- package/lib/esm/events/events-idb-store.js +255 -61
- package/lib/esm/events/events-idb-store.js.map +1 -1
- package/lib/esm/session-replay.d.ts +4 -0
- package/lib/esm/session-replay.d.ts.map +1 -1
- package/lib/esm/session-replay.js +118 -51
- package/lib/esm/session-replay.js.map +1 -1
- package/lib/esm/track-destination.d.ts.map +1 -1
- package/lib/esm/track-destination.js +6 -2
- package/lib/esm/track-destination.js.map +1 -1
- package/lib/esm/utils/rrweb.d.ts +1 -0
- package/lib/esm/utils/rrweb.d.ts.map +1 -1
- package/lib/esm/utils/rrweb.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/esm/worker/index.js +1 -1
- package/lib/scripts/index-min.js +1 -1
- package/lib/scripts/index-min.js.gz +0 -0
- package/lib/scripts/index-min.js.map +1 -1
- package/lib/scripts/session-replay-browser-min.js +1 -1
- package/lib/scripts/session-replay-browser-min.js.gz +0 -0
- package/lib/scripts/session-replay-browser-min.js.map +1 -1
- package/lib/scripts/targeting-min.js +1 -1
- package/lib/scripts/targeting-min.js.gz +0 -0
- package/lib/scripts/targeting-min.js.map +1 -1
- package/lib/scripts/worker-min.js +1 -1
- package/lib/scripts/worker-min.js.gz +0 -0
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e='var WebWorker=function(e){"use strict";onmessage=function(e){var s="string"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n',t='var WebWorker=function(e){"use strict";var t,
|
|
1
|
+
const e='var WebWorker=function(e){"use strict";onmessage=function(e){var s="string"==typeof e.data?JSON.parse(e.data):e.data,t=s.event,a=s.sessionId,n=t.type,r=t.timestamp,i=t.delay,o=t.data,d=null!=i?JSON.stringify({type:n,timestamp:r,delay:i,data:o}):JSON.stringify({type:n,timestamp:r,data:o});postMessage({compressedEvent:d,sessionId:a})};var s=onmessage;return e.compressionOnMessage=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n',t='var WebWorker=function(e){"use strict";var t,n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))(function(s,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function i(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((r=r.apply(e,t||[])).next())})}function s(e,t){var n,r,s,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=i(0),a.throw=i(1),a.return=i(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(t||(t={})),t.US;var o;!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision"}(o||(o={}));function a(e,t){return r(this,void 0,void 0,function(){var n,o,a,i,c,u,l,d,p,f,h,v,y,b,g=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),n=t.CompressionStream,o=new n("gzip"),a=o.writable.getWriter(),i=o.readable.getReader(),c=[],u=r(g,void 0,void 0,function(){var e,t,n;return s(this,function(r){switch(r.label){case 0:return[4,i.read()];case 1:if(e=r.sent(),t=e.done,n=e.value,t)return[3,3];c.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,a.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,a.close()];case 2:return m.sent(),[4,u];case 3:m.sent(),l=c.reduce(function(e,t){return e+t.length},0),d=new Uint8Array(l),p=0;try{for(f=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(c),h=f.next();!h.done;h=f.next())v=h.value,d.set(v,p),p+=v.length}catch(e){y={error:e}}finally{try{h&&!h.done&&(b=f.return)&&b.call(f)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function i(e,t){var o,i,c,u;return r(this,void 0,void 0,function(){var r,l,d,p,f,h,v,y,b,g;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),"CompressionStream"in self?[4,a(e,self)]:[3,2];case 1:return l=s.sent(),[3,3];case 2:l=null,s.label=3;case 3:return r=l,d="".concat(null!==(i=null===(o=t.version)||void 0===o?void 0:o.type)&&void 0!==i?i:"standalone","/").concat(null!==(u=null===(c=t.version)||void 0===c?void 0:c.version)&&void 0!==u?u:t.sdkVersion),p=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),f="".concat((m=t.serverZone,w=t.trackServerUrl,w||("STAGING"===m?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===m?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(p.toString()),h=n({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":d,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},r?{"Content-Encoding":"gzip"}:{}),v=r?r.byteLength:new Blob([e]).size,[4,fetch(f,{method:"POST",headers:h,body:null!=r?r:e,keepalive:v<=65536})];case 4:return null===(y=s.sent())?[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}]:y.status>=200&&y.status<300?(b=Math.round(new Blob(t.events).size/1024),[2,{shouldRetry:!1,success:!0,message:"Session replay event batch tracked successfully for session id ".concat(t.sessionId,", size of events: ").concat(b," KB")}]):y.status>=500||408===y.status||429===y.status||499===y.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(y.status)}]:[2,{shouldRetry:!1,success:!1,message:"Network error occurred, event batch rejected"}];case 5:return g=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(g)}];case 6:return[2]}var m,w})})}function c(e,t,n,o){return r(this,void 0,void 0,function(){var r,a,c;return s(this,function(s){switch(s.label){case 0:r=1,s.label=1;case 1:return[4,i(t,n)];case 2:return(a=s.sent()).success?(postMessage({type:"log",id:e,message:a.message}),postMessage({type:"complete",id:e}),[2]):o&&a.shouldRetry&&r<n.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*r*1e3)})]:[3,4];case 3:return s.sent(),r++,[3,5];case 4:return c=r>=n.flushMaxRetries?"Session replay event batch rejected due to exceeded retry count":a.message,postMessage({type:"warn",id:e,message:c}),postMessage({type:"complete",id:e}),[2];case 5:return[3,1];case 6:return[2]}})})}onmessage=function(e){return r(void 0,void 0,void 0,function(){var t,n,r,o,a,i,u;return s(this,function(s){switch(s.label){case 0:return t=e.data,n=t.type,r=t.id,o=t.payload,a=t.context,i=t.useRetry,"send"!==n?[3,2]:(u=JSON.stringify(o),[4,c(r,u,a,i)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var u=onmessage;return e.trackDestinationOnMessage=u,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n';export{e as compressionScript,t as trackDestinationScript};
|
|
2
2
|
//# sourceMappingURL=worker-min.js.map
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/session-replay-browser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@rollup/plugin-replace": "^6.0.1",
|
|
30
30
|
"idb": "8.0.0",
|
|
31
31
|
"tslib": "^2.4.1",
|
|
32
|
-
"@amplitude/analytics-client-common": "2.4.47",
|
|
33
|
-
"@amplitude/analytics-core": "2.48.1",
|
|
34
32
|
"@amplitude/analytics-types": "2.11.1",
|
|
35
|
-
"@amplitude/
|
|
33
|
+
"@amplitude/analytics-core": "2.48.1",
|
|
34
|
+
"@amplitude/targeting": "0.2.0",
|
|
35
|
+
"@amplitude/analytics-client-common": "2.4.47"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@aws-sdk/client-s3": "^3.229.0",
|