@amplitude/segment-session-replay-plugin 0.0.21 → 0.0.23
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/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.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/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/index-min2.js +1 -1
- package/lib/scripts/index-min2.js.gz +0 -0
- package/lib/scripts/index-min2.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var 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,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=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 a,o=/payload.*exceed/i;!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"}(a||(a={}));var i="Network error occurred, event batch rejected";function c(e,t){return n(this,void 0,void 0,function(){var r,a,o,i,c,u,l,d,p,f,h,y,
|
|
1
|
+
var 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,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=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 a,o=/payload.*exceed/i;!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"}(a||(a={}));var i="Network error occurred, event batch rejected";function c(e,t){return n(this,void 0,void 0,function(){var r,a,o,i,c,u,l,d,p,f,h,v,y,g,b=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,a=new r("gzip"),o=a.writable.getWriter(),i=a.readable.getReader(),c=[],u=n(b,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];c.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,o.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,o.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,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],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&&(g=f.return)&&g.call(f)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function u(e,t){var a,u,l,d,p,f,h;return n(this,void 0,void 0,function(){var n,v,y,g,b,m,S,w,T,k,R,x;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),"CompressionStream"in self?[4,c(e,self)]:[3,2];case 1:return v=s.sent(),[3,3];case 2:v=null,s.label=3;case 3:return n=v,y="".concat(null!==(u=null===(a=t.version)||void 0===a?void 0:a.type)&&void 0!==u?u:"standalone","/").concat(null!==(d=null===(l=t.version)||void 0===l?void 0:l.version)&&void 0!==d?d:t.sdkVersion),g=new URLSearchParams({device_id:t.deviceId,session_id:"".concat(t.sessionId),type:t.eventType}),b="".concat((E=t.serverZone,U=t.trackServerUrl,U||("STAGING"===E?"https://api-sr.stag2.amplitude.com/sessions/v2/track":"EU"===E?"https://api-sr.eu.amplitude.com/sessions/v2/track":"https://api-sr.amplitude.com/sessions/v2/track")),"?").concat(g.toString()),m=r({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t.apiKey),"X-Client-Version":t.sdkVersion,"X-Client-Library":y,"X-Client-Url":t.currentUrl.substring(0,1e3),"X-Client-Sample-Rate":"".concat(t.sampleRate),"X-Sampling-Hash-Alg":"xxhash32"},n?{"Content-Encoding":"gzip"}:{}),S=n?n.byteLength:new Blob([e]).size,[4,fetch(b,{method:"POST",headers:m,body:null!=n?n:e,keepalive:S<=65536})];case 4:if(null===(w=s.sent()))return[2,{shouldRetry:!1,success:!1,message:"Unexpected error occurred"}];if(w.status>=200&&w.status<300)return T=Math.round(new Blob(t.events).size/1024),k=null!==(h=null===(f=null===(p=w.headers)||void 0===p?void 0:p.get)||void 0===f?void 0:f.call(p,"X-Session-Replay-Event-Skipped"))&&void 0!==h?h:null,[2,{shouldRetry:!1,success:!0,message:"Session replay event batch tracked successfully for session id ".concat(t.sessionId,", size of events: ").concat(T," KB"),skipCode:k}];if(413!==w.status)return[3,9];R="",s.label=5;case 5:return s.trys.push([5,7,,8]),[4,w.text()];case 6:return R=s.sent(),[3,8];case 7:return s.sent(),[3,8];case 8:return[2,{shouldRetry:!1,success:!1,message:i,payloadTooLarge:!0,isWaf:o.test(R)}];case 9:return w.status>=500||408===w.status||429===w.status||499===w.status?[2,{shouldRetry:!0,success:!1,message:"HTTP ".concat(w.status)}]:[2,{shouldRetry:!1,success:!1,message:i}];case 10:return x=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(x)}];case 11:return[2]}var E,U})})}function l(e,t,r,a){var o;return n(this,void 0,void 0,function(){var n,i,c;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,u(t,r)];case 2:return(i=s.sent()).success?(postMessage({type:"log",id:e,message:i.message}),postMessage({type:"complete",id:e,skipCode:null!==(o=i.skipCode)&&void 0!==o?o:null}),[2]):i.payloadTooLarge&&a?(postMessage({type:"payload_too_large",id:e,isWaf:!0===i.isWaf}),[2]):a&&i.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return c=n>=r.flushMaxRetries?"Session replay event batch rejected due to exceeded retry count":i.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 n(void 0,void 0,void 0,function(){var t,r,n,a,o,i,c;return s(this,function(s){switch(s.label){case 0:return t=e.data,r=t.type,n=t.id,a=t.payload,o=t.context,i=t.useRetry,"send"!==r?[3,2]:(c=JSON.stringify(a),[4,l(n,c,o,i)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var d=onmessage;return e.trackDestinationOnMessage=d,Object.defineProperty(e,"__esModule",{value:!0}),e}({});\n';export{e as compressionScript,t as trackDestinationScript};
|
|
2
2
|
//# sourceMappingURL=index-min2.js.map
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-min2.js","sources":["../../../session-replay-browser/lib/esm/worker/index.js"],"sourcesContent":["var compressionScript = \"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\";\nvar trackDestinationScript = \"var WebWorker=function(e){\\\"use strict\\\";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((\\\"function\\\"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),\\\"function\\\"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(r)throw new TypeError(\\\"Generator is already executing.\\\");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=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 a,o=/payload.*exceed/i;!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\\\"}(a||(a={}));var i=\\\"Network error occurred, event batch rejected\\\";function c(e,t){return n(this,void 0,void 0,function(){var r,a,o,i,c,u,l,d,p,f,h,y,
|
|
1
|
+
{"version":3,"file":"index-min2.js","sources":["../../../session-replay-browser/lib/esm/worker/index.js"],"sourcesContent":["var compressionScript = \"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\";\nvar trackDestinationScript = \"var WebWorker=function(e){\\\"use strict\\\";var t,r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(s,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function i(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,i)}c((n=n.apply(e,t||[])).next())})}function s(e,t){var r,n,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((\\\"function\\\"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),\\\"function\\\"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(r)throw new TypeError(\\\"Generator is already executing.\\\");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){a.label=i[1];break}if(6===i[0]&&a.label<s[1]){a.label=s[1],s=i;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(i);break}s[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=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 a,o=/payload.*exceed/i;!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\\\"}(a||(a={}));var i=\\\"Network error occurred, event batch rejected\\\";function c(e,t){return n(this,void 0,void 0,function(){var r,a,o,i,c,u,l,d,p,f,h,v,y,g,b=this;return s(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),r=t.CompressionStream,a=new r(\\\"gzip\\\"),o=a.writable.getWriter(),i=a.readable.getReader(),c=[],u=n(b,void 0,void 0,function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:return[4,i.read()];case 1:if(e=n.sent(),t=e.done,r=e.value,t)return[3,3];c.push(r),n.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,o.write((new TextEncoder).encode(e))];case 1:return m.sent(),[4,o.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,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&\\\"number\\\"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],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&&(g=f.return)&&g.call(f)}finally{if(y)throw y.error}}return[2,d];case 4:return m.sent(),[2,null];case 5:return[2]}})})}function u(e,t){var a,u,l,d,p,f,h;return n(this,void 0,void 0,function(){var n,v,y,g,b,m,S,w,T,k,R,x;return s(this,function(s){switch(s.label){case 0:return s.trys.push([0,10,,11]),\\\"CompressionStream\\\"in self?[4,c(e,self)]:[3,2];case 1:return v=s.sent(),[3,3];case 2:v=null,s.label=3;case 3:return n=v,y=\\\"\\\".concat(null!==(u=null===(a=t.version)||void 0===a?void 0:a.type)&&void 0!==u?u:\\\"standalone\\\",\\\"/\\\").concat(null!==(d=null===(l=t.version)||void 0===l?void 0:l.version)&&void 0!==d?d:t.sdkVersion),g=new URLSearchParams({device_id:t.deviceId,session_id:\\\"\\\".concat(t.sessionId),type:t.eventType}),b=\\\"\\\".concat((E=t.serverZone,U=t.trackServerUrl,U||(\\\"STAGING\\\"===E?\\\"https://api-sr.stag2.amplitude.com/sessions/v2/track\\\":\\\"EU\\\"===E?\\\"https://api-sr.eu.amplitude.com/sessions/v2/track\\\":\\\"https://api-sr.amplitude.com/sessions/v2/track\\\")),\\\"?\\\").concat(g.toString()),m=r({\\\"Content-Type\\\":\\\"application/json\\\",Accept:\\\"*/*\\\",Authorization:\\\"Bearer \\\".concat(t.apiKey),\\\"X-Client-Version\\\":t.sdkVersion,\\\"X-Client-Library\\\":y,\\\"X-Client-Url\\\":t.currentUrl.substring(0,1e3),\\\"X-Client-Sample-Rate\\\":\\\"\\\".concat(t.sampleRate),\\\"X-Sampling-Hash-Alg\\\":\\\"xxhash32\\\"},n?{\\\"Content-Encoding\\\":\\\"gzip\\\"}:{}),S=n?n.byteLength:new Blob([e]).size,[4,fetch(b,{method:\\\"POST\\\",headers:m,body:null!=n?n:e,keepalive:S<=65536})];case 4:if(null===(w=s.sent()))return[2,{shouldRetry:!1,success:!1,message:\\\"Unexpected error occurred\\\"}];if(w.status>=200&&w.status<300)return T=Math.round(new Blob(t.events).size/1024),k=null!==(h=null===(f=null===(p=w.headers)||void 0===p?void 0:p.get)||void 0===f?void 0:f.call(p,\\\"X-Session-Replay-Event-Skipped\\\"))&&void 0!==h?h:null,[2,{shouldRetry:!1,success:!0,message:\\\"Session replay event batch tracked successfully for session id \\\".concat(t.sessionId,\\\", size of events: \\\").concat(T,\\\" KB\\\"),skipCode:k}];if(413!==w.status)return[3,9];R=\\\"\\\",s.label=5;case 5:return s.trys.push([5,7,,8]),[4,w.text()];case 6:return R=s.sent(),[3,8];case 7:return s.sent(),[3,8];case 8:return[2,{shouldRetry:!1,success:!1,message:i,payloadTooLarge:!0,isWaf:o.test(R)}];case 9:return w.status>=500||408===w.status||429===w.status||499===w.status?[2,{shouldRetry:!0,success:!1,message:\\\"HTTP \\\".concat(w.status)}]:[2,{shouldRetry:!1,success:!1,message:i}];case 10:return x=s.sent(),[2,{shouldRetry:!1,success:!1,message:String(x)}];case 11:return[2]}var E,U})})}function l(e,t,r,a){var o;return n(this,void 0,void 0,function(){var n,i,c;return s(this,function(s){switch(s.label){case 0:n=1,s.label=1;case 1:return[4,u(t,r)];case 2:return(i=s.sent()).success?(postMessage({type:\\\"log\\\",id:e,message:i.message}),postMessage({type:\\\"complete\\\",id:e,skipCode:null!==(o=i.skipCode)&&void 0!==o?o:null}),[2]):i.payloadTooLarge&&a?(postMessage({type:\\\"payload_too_large\\\",id:e,isWaf:!0===i.isWaf}),[2]):a&&i.shouldRetry&&n<r.flushMaxRetries?[4,new Promise(function(e){return setTimeout(e,Math.random()*n*1e3)})]:[3,4];case 3:return s.sent(),n++,[3,5];case 4:return c=n>=r.flushMaxRetries?\\\"Session replay event batch rejected due to exceeded retry count\\\":i.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 n(void 0,void 0,void 0,function(){var t,r,n,a,o,i,c;return s(this,function(s){switch(s.label){case 0:return t=e.data,r=t.type,n=t.id,a=t.payload,o=t.context,i=t.useRetry,\\\"send\\\"!==r?[3,2]:(c=JSON.stringify(a),[4,l(n,c,o,i)]);case 1:s.sent(),s.label=2;case 2:return[2]}})})};var d=onmessage;return e.trackDestinationOnMessage=d,Object.defineProperty(e,\\\"__esModule\\\",{value:!0}),e}({});\\n\";\n\nexport { compressionScript, trackDestinationScript };\n"],"names":["compressionScript","trackDestinationScript"],"mappings":"AAAG,IAACA,EAAoB,4bACpBC,EAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/segment-session-replay-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Plugin for Segment's analytics.js library to support Amplitude's Session Replay.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amplitude",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@segment/analytics-next": "^1.81.0",
|
|
32
32
|
"js-cookie": "^3.0.5",
|
|
33
|
-
"@amplitude/session-replay-browser": "1.42.
|
|
33
|
+
"@amplitude/session-replay-browser": "1.42.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@aws-sdk/client-s3": "^3.229.0",
|