@openreplay/tracker 17.2.1 → 17.2.3
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/dist/cjs/entry.js +136 -42
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +136 -42
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/index.d.ts +1 -0
- package/dist/cjs/main/modules/input.d.ts +2 -1
- package/dist/cjs/main/modules/mouse.d.ts +1 -0
- package/dist/cjs/main/utils.d.ts +2 -0
- package/dist/lib/entry.js +136 -42
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +136 -42
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/index.d.ts +1 -0
- package/dist/lib/main/modules/input.d.ts +2 -1
- package/dist/lib/main/modules/mouse.d.ts +1 -0
- package/dist/lib/main/utils.d.ts +2 -0
- package/dist/types/main/index.d.ts +1 -0
- package/dist/types/main/modules/input.d.ts +2 -1
- package/dist/types/main/modules/mouse.d.ts +1 -0
- package/dist/types/main/utils.d.ts +2 -0
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -434,6 +434,23 @@ function deprecationWarn(nameOfFeature, useInstead, docsPath = '/') {
|
|
|
434
434
|
console.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ''} Visit ${DOCS_HOST}${docsPath} for more information.`);
|
|
435
435
|
warnedFeatures[nameOfFeature] = true;
|
|
436
436
|
}
|
|
437
|
+
function getCustomAttributeLabel(e, customAttributes) {
|
|
438
|
+
if (!customAttributes || customAttributes.length === 0)
|
|
439
|
+
return '';
|
|
440
|
+
const parts = [];
|
|
441
|
+
for (const attr of customAttributes) {
|
|
442
|
+
const value = e.getAttribute(attr);
|
|
443
|
+
if (value !== null) {
|
|
444
|
+
parts.push(`[${attr}=${value}]`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return parts.join('');
|
|
448
|
+
}
|
|
449
|
+
function getClassSelector(e) {
|
|
450
|
+
if (!e.classList || e.classList.length === 0)
|
|
451
|
+
return '';
|
|
452
|
+
return '.' + Array.from(e.classList).join('.');
|
|
453
|
+
}
|
|
437
454
|
function getLabelAttribute(e) {
|
|
438
455
|
let value = e.getAttribute('data-openreplay-label');
|
|
439
456
|
if (value !== null) {
|
|
@@ -3405,7 +3422,10 @@ class TopObserver extends Observer {
|
|
|
3405
3422
|
this.app.debug.info('doc already observed for', id);
|
|
3406
3423
|
return;
|
|
3407
3424
|
}
|
|
3408
|
-
const observer = new IFrameObserver(this.app, false, {
|
|
3425
|
+
const observer = new IFrameObserver(this.app, false, {
|
|
3426
|
+
disableSprites: this.options.disableSprites,
|
|
3427
|
+
...getInlineOptions(this.options.inlineCss, console.warn),
|
|
3428
|
+
});
|
|
3409
3429
|
this.iframeObservers.set(iframe, observer);
|
|
3410
3430
|
this.docObservers.set(currentDoc, observer);
|
|
3411
3431
|
this.iframeObserversArr.push(observer);
|
|
@@ -3427,7 +3447,10 @@ class TopObserver extends Observer {
|
|
|
3427
3447
|
handle();
|
|
3428
3448
|
}
|
|
3429
3449
|
handleShadowRoot(shRoot) {
|
|
3430
|
-
const observer = new ShadowRootObserver(this.app
|
|
3450
|
+
const observer = new ShadowRootObserver(this.app, false, {
|
|
3451
|
+
disableSprites: this.options.disableSprites,
|
|
3452
|
+
...getInlineOptions(this.options.inlineCss, console.warn),
|
|
3453
|
+
});
|
|
3431
3454
|
this.shadowRootObservers.set(shRoot, observer);
|
|
3432
3455
|
observer.observe(shRoot.host);
|
|
3433
3456
|
}
|
|
@@ -3463,7 +3486,10 @@ class TopObserver extends Observer {
|
|
|
3463
3486
|
};
|
|
3464
3487
|
this.app.nodes.clear();
|
|
3465
3488
|
this.app.nodes.crossdomainMode(frameLevel, frameOder);
|
|
3466
|
-
const iframeObserver = new IFrameObserver(this.app
|
|
3489
|
+
const iframeObserver = new IFrameObserver(this.app, false, {
|
|
3490
|
+
disableSprites: this.options.disableSprites,
|
|
3491
|
+
...getInlineOptions(this.options.inlineCss, console.warn),
|
|
3492
|
+
});
|
|
3467
3493
|
this.iframeObservers.set(window.document, iframeObserver);
|
|
3468
3494
|
iframeObserver.syntheticObserve(rootNodeId, window.document);
|
|
3469
3495
|
}
|
|
@@ -3822,7 +3848,7 @@ class App {
|
|
|
3822
3848
|
this.stopCallbacks = [];
|
|
3823
3849
|
this.commitCallbacks = [];
|
|
3824
3850
|
this.activityState = ActivityState.NotActive;
|
|
3825
|
-
this.version = '17.2.
|
|
3851
|
+
this.version = '17.2.3'; // TODO: version compatability check inside each plugin.
|
|
3826
3852
|
this.socketMode = false;
|
|
3827
3853
|
this.compressionThreshold = 24 * 1000;
|
|
3828
3854
|
this.bc = null;
|
|
@@ -4252,9 +4278,6 @@ class App {
|
|
|
4252
4278
|
window.addEventListener('message', this.parentCrossDomainFrameListener);
|
|
4253
4279
|
window.addEventListener('message', this.crossDomainIframeListener);
|
|
4254
4280
|
setInterval(() => {
|
|
4255
|
-
if (document.hidden) {
|
|
4256
|
-
return;
|
|
4257
|
-
}
|
|
4258
4281
|
window.parent.postMessage({
|
|
4259
4282
|
line: proto.polling,
|
|
4260
4283
|
context: this.contextId,
|
|
@@ -5724,19 +5747,21 @@ const labelElementFor = IN_BROWSER && 'labels' in HTMLInputElement.prototype
|
|
|
5724
5747
|
}
|
|
5725
5748
|
}
|
|
5726
5749
|
};
|
|
5727
|
-
function getInputLabel(node) {
|
|
5728
|
-
|
|
5729
|
-
if (
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5750
|
+
function getInputLabel(node, customAttributes) {
|
|
5751
|
+
const openreplayLabel = getLabelAttribute(node);
|
|
5752
|
+
if (openreplayLabel !== null)
|
|
5753
|
+
return normSpaces(openreplayLabel).slice(0, 100);
|
|
5754
|
+
const customAttributeLabel = getCustomAttributeLabel(node, customAttributes);
|
|
5755
|
+
if (customAttributeLabel)
|
|
5756
|
+
return customAttributeLabel;
|
|
5757
|
+
if (node.id)
|
|
5758
|
+
return `#${node.id}`;
|
|
5759
|
+
const classLabel = getClassSelector(node);
|
|
5760
|
+
if (classLabel)
|
|
5761
|
+
return classLabel;
|
|
5762
|
+
const labelElement = labelElementFor(node);
|
|
5763
|
+
const label = node.name || node.placeholder || (labelElement && labelElement.innerText) || node.type;
|
|
5764
|
+
return normSpaces(label || '').slice(0, 100);
|
|
5740
5765
|
}
|
|
5741
5766
|
const InputMode = {
|
|
5742
5767
|
Plain: 0,
|
|
@@ -5817,7 +5842,7 @@ function Input (app, opts) {
|
|
|
5817
5842
|
}, 3);
|
|
5818
5843
|
function sendInputChange(id, node, hesitationTime, inputTime) {
|
|
5819
5844
|
const { value, mask } = getInputValue(id, node);
|
|
5820
|
-
let label = getInputLabel(node);
|
|
5845
|
+
let label = getInputLabel(node, options.customAttributes);
|
|
5821
5846
|
if (app.sanitizer.privateMode) {
|
|
5822
5847
|
label = label.replaceAll(/./g, '*');
|
|
5823
5848
|
}
|
|
@@ -5926,21 +5951,28 @@ function _getTarget(target, document) {
|
|
|
5926
5951
|
return target === document.documentElement ? null : target;
|
|
5927
5952
|
}
|
|
5928
5953
|
function Mouse (app, options) {
|
|
5929
|
-
const { disableClickmaps = false } = options || {};
|
|
5954
|
+
const { disableClickmaps = false, customAttributes } = options || {};
|
|
5930
5955
|
function getTargetLabel(target) {
|
|
5931
5956
|
const dl = getLabelAttribute(target);
|
|
5932
5957
|
if (dl !== null) {
|
|
5933
5958
|
return dl;
|
|
5934
5959
|
}
|
|
5935
5960
|
if (hasTag(target, 'input')) {
|
|
5936
|
-
return getInputLabel(target);
|
|
5937
|
-
}
|
|
5961
|
+
return getInputLabel(target, customAttributes);
|
|
5962
|
+
}
|
|
5963
|
+
const customAttributeLabel = getCustomAttributeLabel(target, customAttributes);
|
|
5964
|
+
if (customAttributeLabel)
|
|
5965
|
+
return customAttributeLabel;
|
|
5966
|
+
if (target.id)
|
|
5967
|
+
return `#${target.id}`;
|
|
5968
|
+
const classLabel = getClassSelector(target);
|
|
5969
|
+
if (classLabel)
|
|
5970
|
+
return classLabel;
|
|
5938
5971
|
if (isClickable(target)) {
|
|
5939
5972
|
let label = '';
|
|
5940
5973
|
if (target instanceof HTMLElement) {
|
|
5941
5974
|
label = app.sanitizer.getInnerTextSecure(target);
|
|
5942
5975
|
}
|
|
5943
|
-
label = label || target.id || target.className;
|
|
5944
5976
|
return normSpaces(label).slice(0, 100);
|
|
5945
5977
|
}
|
|
5946
5978
|
return '';
|
|
@@ -6084,6 +6116,11 @@ function getCSSPath(el) {
|
|
|
6084
6116
|
return false;
|
|
6085
6117
|
if (el.id)
|
|
6086
6118
|
return `#${cssEscape(el.id)}`;
|
|
6119
|
+
// if has data attributes - use them as they are more likely to be stable and unique
|
|
6120
|
+
const dataAttr = Array.from(el.attributes).find(attr => attr.name.startsWith('data-'));
|
|
6121
|
+
if (dataAttr) {
|
|
6122
|
+
return `[${dataAttr.name}="${cssEscape(dataAttr.value)}"]`;
|
|
6123
|
+
}
|
|
6087
6124
|
const parts = [];
|
|
6088
6125
|
while (el && el.nodeType === 1 && el !== el.ownerDocument) {
|
|
6089
6126
|
if (el.id) {
|
|
@@ -6135,7 +6172,7 @@ function getUniqueSiblingClass(el) {
|
|
|
6135
6172
|
return null;
|
|
6136
6173
|
}
|
|
6137
6174
|
|
|
6138
|
-
|
|
6175
|
+
let e=-1;const t=t=>{addEventListener("pageshow",(n=>{n.persisted&&(e=n.timeStamp,t(n));}),true);},n=(e,t,n,i)=>{let s,o;return r=>{t.value>=0&&(r||i)&&(o=t.value-(s??0),(o||void 0===s)&&(s=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)));}},i=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))));},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},o=()=>{const e=s();return e?.activationStart??0},r=(t,n=-1)=>{const i=s();let r="navigate";e>=0?r="back-forward-cache":i&&(document.prerendering||o()>0?r="prerender":document.wasDiscarded?r="restore":i.type&&(r=i.type.replace(/_/g,"-")));return {name:t,value:n,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},c=new WeakMap;function a(e,t){return c.get(e)||c.set(e,new t),c.get(e)}class d{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e);}}const h=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const i=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries());}));}));return i.observe({type:e,buffered:!0,...n}),i}}catch{}},f=e=>{let t=false;return ()=>{t||(e(),t=true);}};let u=-1;const l=new Set,m=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,p=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(u)||(u="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",p,true));}},v=()=>{if(u<0){const e=o(),n=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;u=n??m(),addEventListener("visibilitychange",p,true),addEventListener("prerenderingchange",p,true),t((()=>{setTimeout((()=>{u=m();}));}));}return {get firstHiddenTime(){return u},onHidden(e){l.add(e);}}},g=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),true):e();},y=[1800,3e3],E=(e,s={})=>{g((()=>{const c=v();let a,d=r("FCP");const f=h("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<c.firstHiddenTime&&(d.value=Math.max(t.startTime-o(),0),d.entries.push(t),a(true)));}));f&&(a=n(e,d,y,s.reportAllChanges),t((t=>{d=r("FCP"),a=n(e,d,y,s.reportAllChanges),i((()=>{d.value=performance.now()-t.timeStamp,a(true);}));})));}));},b=[.1,.25],L=(e,s={})=>{const o=v();E(f((()=>{let c,f=r("CLS",0);const u=a(s,d),l=e=>{for(const t of e)u.h(t);u.i>f.value&&(f.value=u.i,f.entries=u.o,c());},m=h("layout-shift",l);m&&(c=n(e,f,b,s.reportAllChanges),o.onHidden((()=>{l(m.takeRecords()),c(true);})),t((()=>{u.i=0,f=r("CLS",0),c=n(e,f,b,s.reportAllChanges),i((()=>c()));})),setTimeout(c));})));};let P=0,T=1/0,_=0;const M=e=>{for(const t of e)t.interactionId&&(T=Math.min(T,t.interactionId),_=Math.max(_,t.interactionId),P=_?(_-T)/7+1:0);};let w;const C=()=>w?P:performance.interactionCount??0,I=()=>{"interactionCount"in performance||w||(w=h("event",M,{type:"event",buffered:true,durationThreshold:0}));};let F=0;class k{u=[];l=new Map;m;p;v(){F=C(),this.u.length=0,this.l.clear();}L(){const e=Math.min(this.u.length-1,Math.floor((C()-F)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.P-e.P)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id);}this.p?.(n);}}}const A=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=f(e),addEventListener("visibilitychange",e,{once:true,capture:true}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:true});})));},B=[200,500],S=(e,i={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const s=v();g((()=>{I();let o,c=r("INP");const d=a(i,k),f=e=>{A((()=>{for(const t of e)d.h(t);const t=d.L();t&&t.P!==c.value&&(c.value=t.P,c.entries=t.entries,o());}));},u=h("event",f,{durationThreshold:i.durationThreshold??40});o=n(e,c,B,i.reportAllChanges),u&&(u.observe({type:"first-input",buffered:true}),s.onHidden((()=>{f(u.takeRecords()),o(true);})),t((()=>{d.v(),c=r("INP"),o=n(e,c,B,i.reportAllChanges);})));}));};class N{m;h(e){this.m?.(e);}}const q=[2500,4e3],x=(e,s={})=>{g((()=>{const c=v();let d,u=r("LCP");const l=a(s,N),m=e=>{s.reportAllChanges||(e=e.slice(-1));for(const t of e)l.h(t),t.startTime<c.firstHiddenTime&&(u.value=Math.max(t.startTime-o(),0),u.entries=[t],d());},p=h("largest-contentful-paint",m);if(p){d=n(e,u,q,s.reportAllChanges);const o=f((()=>{m(p.takeRecords()),p.disconnect(),d(true);})),c=e=>{e.isTrusted&&(A(o),removeEventListener(e.type,c,{capture:true}));};for(const e of ["keydown","click","visibilitychange"])addEventListener(e,c,{capture:true});t((t=>{u=r("LCP"),d=n(e,u,q,s.reportAllChanges),i((()=>{u.value=performance.now()-t.timeStamp,d(true);}));}));}}));},H=[800,1800],O=e=>{document.prerendering?g((()=>O(e))):"complete"!==document.readyState?addEventListener("load",(()=>O(e)),true):setTimeout(e);},$=(e,i={})=>{let c=r("TTFB"),a=n(e,c,H,i.reportAllChanges);O((()=>{const d=s();d&&(c.value=Math.max(d.responseStart-o(),0),c.entries=[d],a(true),t((()=>{c=r("TTFB",0),a=n(e,c,H,i.reportAllChanges),a(true);})));}));};
|
|
6139
6176
|
|
|
6140
6177
|
function getPaintBlocks(resources) {
|
|
6141
6178
|
const paintBlocks = [];
|
|
@@ -6268,10 +6305,10 @@ function Timing (app, opts) {
|
|
|
6268
6305
|
// onINP(): Chromium
|
|
6269
6306
|
// onLCP(): Chromium, Firefox
|
|
6270
6307
|
// onTTFB(): Chromium, Firefox, Safari
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6308
|
+
L(onVitalsSignal);
|
|
6309
|
+
S(onVitalsSignal);
|
|
6310
|
+
x(onVitalsSignal);
|
|
6311
|
+
$(onVitalsSignal);
|
|
6275
6312
|
});
|
|
6276
6313
|
app.attachStopCallback(function () {
|
|
6277
6314
|
observer.disconnect();
|
|
@@ -7072,7 +7109,9 @@ class NetworkMessage {
|
|
|
7072
7109
|
});
|
|
7073
7110
|
if (!messageInfo)
|
|
7074
7111
|
return null;
|
|
7075
|
-
const
|
|
7112
|
+
const gqlHeader = "application/graphql-response";
|
|
7113
|
+
const isGraphql = messageInfo.url.includes("/graphql")
|
|
7114
|
+
|| Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
|
|
7076
7115
|
if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
|
|
7077
7116
|
const isError = messageInfo.response.body.includes("errors");
|
|
7078
7117
|
messageInfo.status = isError ? 400 : 200;
|
|
@@ -7378,6 +7417,7 @@ class FetchProxyHandler {
|
|
|
7378
7417
|
this.tokenUrlMatcher = tokenUrlMatcher;
|
|
7379
7418
|
}
|
|
7380
7419
|
apply(target, _, argsList) {
|
|
7420
|
+
var _a;
|
|
7381
7421
|
const input = argsList[0];
|
|
7382
7422
|
const init = argsList[1];
|
|
7383
7423
|
if (!input ||
|
|
@@ -7393,6 +7433,31 @@ class FetchProxyHandler {
|
|
|
7393
7433
|
}
|
|
7394
7434
|
const item = new NetworkMessage(this.ignoredHeaders, this.setSessionTokenHeader, this.sanitize);
|
|
7395
7435
|
this.beforeFetch(item, input, init);
|
|
7436
|
+
const signal = (argsList[0] instanceof Request ? argsList[0].signal : undefined) ||
|
|
7437
|
+
((_a = argsList[1]) === null || _a === void 0 ? void 0 : _a.signal);
|
|
7438
|
+
// guard to avoid double-send
|
|
7439
|
+
let abortedNotified = false;
|
|
7440
|
+
const notifyAbort = () => {
|
|
7441
|
+
if (abortedNotified)
|
|
7442
|
+
return;
|
|
7443
|
+
abortedNotified = true;
|
|
7444
|
+
item.endTime = performance.now();
|
|
7445
|
+
item.duration = item.endTime - (item.startTime || item.endTime);
|
|
7446
|
+
item.status = 0;
|
|
7447
|
+
item.statusText = "Aborted";
|
|
7448
|
+
item.readyState = 0;
|
|
7449
|
+
const msg = item.getMessage();
|
|
7450
|
+
if (msg)
|
|
7451
|
+
this.sendMessage(msg);
|
|
7452
|
+
};
|
|
7453
|
+
if (signal) {
|
|
7454
|
+
if (signal.aborted) {
|
|
7455
|
+
notifyAbort();
|
|
7456
|
+
}
|
|
7457
|
+
else {
|
|
7458
|
+
signal.addEventListener("abort", notifyAbort, { once: true });
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7396
7461
|
this.setSessionTokenHeader((name, value) => {
|
|
7397
7462
|
if (this.tokenUrlMatcher !== undefined) {
|
|
7398
7463
|
if (!this.tokenUrlMatcher(item.url)) {
|
|
@@ -7421,11 +7486,22 @@ class FetchProxyHandler {
|
|
|
7421
7486
|
}
|
|
7422
7487
|
});
|
|
7423
7488
|
return target.apply(window, argsList)
|
|
7424
|
-
.then(this.afterFetch(item)
|
|
7489
|
+
.then(this.afterFetch(item, () => {
|
|
7490
|
+
abortedNotified = true;
|
|
7491
|
+
}))
|
|
7425
7492
|
.catch((e) => {
|
|
7426
|
-
// mock finally
|
|
7427
7493
|
item.endTime = performance.now();
|
|
7428
7494
|
item.duration = item.endTime - (item.startTime || item.endTime);
|
|
7495
|
+
if (e && e.name === "AbortError") {
|
|
7496
|
+
item.status = 0;
|
|
7497
|
+
item.statusText = "Aborted";
|
|
7498
|
+
item.readyState = 0;
|
|
7499
|
+
if (!abortedNotified) {
|
|
7500
|
+
const msg = item.getMessage();
|
|
7501
|
+
if (msg)
|
|
7502
|
+
this.sendMessage(msg);
|
|
7503
|
+
}
|
|
7504
|
+
}
|
|
7429
7505
|
throw e;
|
|
7430
7506
|
});
|
|
7431
7507
|
}
|
|
@@ -7477,8 +7553,10 @@ class FetchProxyHandler {
|
|
|
7477
7553
|
item.requestData = genStringBody(init.body);
|
|
7478
7554
|
}
|
|
7479
7555
|
}
|
|
7480
|
-
afterFetch(item) {
|
|
7556
|
+
afterFetch(item, onResolved) {
|
|
7481
7557
|
return (resp) => {
|
|
7558
|
+
if (onResolved)
|
|
7559
|
+
onResolved === null || onResolved === void 0 ? void 0 : onResolved();
|
|
7482
7560
|
item.endTime = performance.now();
|
|
7483
7561
|
item.duration = item.endTime - (item.startTime || item.endTime);
|
|
7484
7562
|
item.status = resp.status;
|
|
@@ -7514,7 +7592,15 @@ class FetchProxyHandler {
|
|
|
7514
7592
|
}
|
|
7515
7593
|
})
|
|
7516
7594
|
.catch((e) => {
|
|
7517
|
-
if (e.name
|
|
7595
|
+
if (e.name === "AbortError") {
|
|
7596
|
+
item.status = 0;
|
|
7597
|
+
item.statusText = "Aborted";
|
|
7598
|
+
item.readyState = 0;
|
|
7599
|
+
const msg = item.getMessage();
|
|
7600
|
+
if (msg)
|
|
7601
|
+
this.sendMessage(msg);
|
|
7602
|
+
}
|
|
7603
|
+
else {
|
|
7518
7604
|
throw e;
|
|
7519
7605
|
}
|
|
7520
7606
|
});
|
|
@@ -8615,7 +8701,7 @@ class ConstantProperties {
|
|
|
8615
8701
|
user_id: this.user_id,
|
|
8616
8702
|
distinct_id: this.deviceId,
|
|
8617
8703
|
sdk_edition: 'web',
|
|
8618
|
-
sdk_version: '17.2.
|
|
8704
|
+
sdk_version: '17.2.3',
|
|
8619
8705
|
timezone: getUTCOffsetString(),
|
|
8620
8706
|
search_engine: this.searchEngine,
|
|
8621
8707
|
};
|
|
@@ -9058,9 +9144,12 @@ class Batcher {
|
|
|
9058
9144
|
})
|
|
9059
9145
|
.then((response) => {
|
|
9060
9146
|
if ([403, 401].includes(response.status)) {
|
|
9061
|
-
this.
|
|
9062
|
-
|
|
9063
|
-
|
|
9147
|
+
if (attempts < this.retryLimit) {
|
|
9148
|
+
return this.init().then(() => {
|
|
9149
|
+
send();
|
|
9150
|
+
});
|
|
9151
|
+
}
|
|
9152
|
+
return;
|
|
9064
9153
|
}
|
|
9065
9154
|
if (!response.ok) {
|
|
9066
9155
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
@@ -9075,6 +9164,9 @@ class Batcher {
|
|
|
9075
9164
|
void send();
|
|
9076
9165
|
}
|
|
9077
9166
|
startAutosend() {
|
|
9167
|
+
if (this.intervalId) {
|
|
9168
|
+
clearInterval(this.intervalId);
|
|
9169
|
+
}
|
|
9078
9170
|
this.intervalId = setInterval(() => {
|
|
9079
9171
|
this.flush();
|
|
9080
9172
|
}, this.autosendInterval);
|
|
@@ -9123,7 +9215,9 @@ class Analytics {
|
|
|
9123
9215
|
if (this.standalone) {
|
|
9124
9216
|
return this.token;
|
|
9125
9217
|
}
|
|
9126
|
-
|
|
9218
|
+
else {
|
|
9219
|
+
return this.getToken();
|
|
9220
|
+
}
|
|
9127
9221
|
};
|
|
9128
9222
|
this._getTimestamp = () => {
|
|
9129
9223
|
if (this.standalone) {
|
|
@@ -9259,7 +9353,7 @@ class API {
|
|
|
9259
9353
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9260
9354
|
const doNotTrack = this.checkDoNotTrack();
|
|
9261
9355
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9262
|
-
trackerVersion: '17.2.
|
|
9356
|
+
trackerVersion: '17.2.3',
|
|
9263
9357
|
projectKey: this.options.projectKey,
|
|
9264
9358
|
doNotTrack,
|
|
9265
9359
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
|
@@ -9422,7 +9516,7 @@ class API {
|
|
|
9422
9516
|
// no tabs in iframes yet
|
|
9423
9517
|
Tabs(app);
|
|
9424
9518
|
}
|
|
9425
|
-
Mouse(app, options.mouse);
|
|
9519
|
+
Mouse(app, { ...options.mouse, customAttributes: options.customAttributes });
|
|
9426
9520
|
// inside iframe, we ignore viewport scroll
|
|
9427
9521
|
Scroll(app, this.crossdomainMode);
|
|
9428
9522
|
CSSRules(app, options.css);
|