clarity-decode 0.6.26 → 0.6.30
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/build/clarity.decode.js +27 -27
- package/build/clarity.decode.min.js +1 -1
- package/build/clarity.decode.module.js +27 -27
- package/package.json +2 -2
- package/src/clarity.ts +17 -11
- package/src/diagnostic.ts +0 -6
- package/src/interaction.ts +8 -0
- package/src/performance.ts +0 -8
- package/types/data.d.ts +5 -5
- package/types/diagnostic.d.ts +1 -2
- package/types/interaction.d.ts +4 -0
- package/types/performance.d.ts +1 -2
package/build/clarity.decode.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version$1 = "0.6.
|
|
5
|
+
var version$1 = "0.6.30";
|
|
6
6
|
var version = version$1;
|
|
7
7
|
|
|
8
8
|
function decode$5(tokens) {
|
|
@@ -93,12 +93,6 @@ function decode$4(tokens) {
|
|
|
93
93
|
var time = tokens[0];
|
|
94
94
|
var event = tokens[1];
|
|
95
95
|
switch (event) {
|
|
96
|
-
case 32 /* ImageError */:
|
|
97
|
-
var imageError = {
|
|
98
|
-
source: tokens[2],
|
|
99
|
-
target: tokens[3],
|
|
100
|
-
};
|
|
101
|
-
return { time: time, event: event, data: imageError };
|
|
102
96
|
case 31 /* ScriptError */:
|
|
103
97
|
var scriptError = {
|
|
104
98
|
message: tokens[2],
|
|
@@ -157,6 +151,9 @@ function decode$3(tokens) {
|
|
|
157
151
|
hashBeta: clickHashes.length > 0 ? clickHashes[1] : null
|
|
158
152
|
};
|
|
159
153
|
return { time: time, event: event, data: clickData };
|
|
154
|
+
case 38 /* Clipboard */:
|
|
155
|
+
var clipData = { target: tokens[2], action: tokens[3] };
|
|
156
|
+
return { time: time, event: event, data: clipData };
|
|
160
157
|
case 11 /* Resize */:
|
|
161
158
|
var resizeData = { width: tokens[2], height: tokens[3] };
|
|
162
159
|
return { time: time, event: event, data: resizeData };
|
|
@@ -174,6 +171,11 @@ function decode$3(tokens) {
|
|
|
174
171
|
endOffset: tokens[5]
|
|
175
172
|
};
|
|
176
173
|
return { time: time, event: event, data: selectionData };
|
|
174
|
+
case 39 /* Submit */:
|
|
175
|
+
var submitData = {
|
|
176
|
+
target: tokens[2]
|
|
177
|
+
};
|
|
178
|
+
return { time: time, event: event, data: submitData };
|
|
177
179
|
case 10 /* Scroll */:
|
|
178
180
|
var scrollData = {
|
|
179
181
|
target: tokens[2],
|
|
@@ -370,14 +372,6 @@ function decode$1(tokens) {
|
|
|
370
372
|
var time = tokens[0];
|
|
371
373
|
var event = tokens[1];
|
|
372
374
|
switch (event) {
|
|
373
|
-
case 30 /* Connection */:
|
|
374
|
-
var connectionData = {
|
|
375
|
-
downlink: tokens[2],
|
|
376
|
-
rtt: tokens[3],
|
|
377
|
-
saveData: tokens[4],
|
|
378
|
-
type: tokens[5]
|
|
379
|
-
};
|
|
380
|
-
return { time: time, event: event, data: connectionData };
|
|
381
375
|
case 29 /* Navigation */:
|
|
382
376
|
var navigationData = {
|
|
383
377
|
fetchStart: tokens[2],
|
|
@@ -511,6 +505,13 @@ function decode(input) {
|
|
|
511
505
|
var clickEntry = decode$3(entry);
|
|
512
506
|
payload.click.push(clickEntry);
|
|
513
507
|
break;
|
|
508
|
+
case 38 /* Clipboard */:
|
|
509
|
+
if (payload.clipboard === undefined) {
|
|
510
|
+
payload.clipboard = [];
|
|
511
|
+
}
|
|
512
|
+
var clipEntry = decode$3(entry);
|
|
513
|
+
payload.clipboard.push(clipEntry);
|
|
514
|
+
break;
|
|
514
515
|
case 10 /* Scroll */:
|
|
515
516
|
if (payload.scroll === undefined) {
|
|
516
517
|
payload.scroll = [];
|
|
@@ -529,6 +530,13 @@ function decode(input) {
|
|
|
529
530
|
}
|
|
530
531
|
payload.selection.push(decode$3(entry));
|
|
531
532
|
break;
|
|
533
|
+
case 39 /* Submit */:
|
|
534
|
+
if (payload.submit === undefined) {
|
|
535
|
+
payload.submit = [];
|
|
536
|
+
}
|
|
537
|
+
var submitEntry = decode$3(entry);
|
|
538
|
+
payload.submit.push(submitEntry);
|
|
539
|
+
break;
|
|
532
540
|
case 22 /* Timeline */:
|
|
533
541
|
if (payload.timeline === undefined) {
|
|
534
542
|
payload.timeline = [];
|
|
@@ -584,30 +592,22 @@ function decode(input) {
|
|
|
584
592
|
}
|
|
585
593
|
payload.script.push(decode$4(entry));
|
|
586
594
|
break;
|
|
587
|
-
case 32 /* ImageError */:
|
|
588
|
-
if (payload.image === undefined) {
|
|
589
|
-
payload.image = [];
|
|
590
|
-
}
|
|
591
|
-
payload.image.push(decode$4(entry));
|
|
592
|
-
break;
|
|
593
595
|
case 33 /* Log */:
|
|
594
596
|
if (payload.log === undefined) {
|
|
595
597
|
payload.log = [];
|
|
596
598
|
}
|
|
597
599
|
payload.log.push(decode$4(entry));
|
|
598
600
|
break;
|
|
599
|
-
case 30 /* Connection */:
|
|
600
|
-
if (payload.connection === undefined) {
|
|
601
|
-
payload.connection = [];
|
|
602
|
-
}
|
|
603
|
-
payload.connection.push(decode$1(entry));
|
|
604
|
-
break;
|
|
605
601
|
case 29 /* Navigation */:
|
|
606
602
|
if (payload.navigation === undefined) {
|
|
607
603
|
payload.navigation = [];
|
|
608
604
|
}
|
|
609
605
|
payload.navigation.push(decode$1(entry));
|
|
610
606
|
break;
|
|
607
|
+
case 30 /* Connection */:
|
|
608
|
+
case 32 /* ImageError */:
|
|
609
|
+
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
610
|
+
break;
|
|
611
611
|
default:
|
|
612
612
|
console.error("No handler for Event: " + JSON.stringify(entry));
|
|
613
613
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e="0.6.
|
|
1
|
+
!function(){"use strict";var e="0.6.30";function t(e){var t=e[0],a=e[1];switch(a){case 25:return{time:t,event:a,data:{gap:e[2]}};case 35:return{time:t,event:a,data:{check:e[2]}};case 24:return{time:t,event:a,data:{key:e[2],value:e[3]}};case 3:return{time:t,event:a,data:{key:e[2]}};case 2:return{time:t,event:a,data:{sequence:e[2],attempts:e[3],status:e[4]}};case 0:for(var r=2,i={};r<e.length;)i[e[r++]]=e[r++];return{time:t,event:a,data:i};case 1:for(var n=2,s={};n<e.length;)s[e[n++]]=e[n++];return{time:t,event:a,data:s};case 36:for(var o=2,c={};o<e.length;){var u=e[o++],l=e[o++];c[u]=[];for(var d=0;d<l.length-1;d+=2)c[u].push([l[d],l[d+1]])}return{time:t,event:a,data:c};case 4:return{time:t,event:a,data:{visible:e[2],docWidth:e[3],docHeight:e[4],screenWidth:e[5],screenHeight:e[6],scrollX:e[7],scrollY:e[8],pointerX:e[9],pointerY:e[10],activityTime:e[11]}};case 34:for(var v=2,p={};v<e.length;)p[e[v++]]="string"==typeof e[v+1]?[e[v++]]:e[v++];return{time:t,event:a,data:p}}return null}function a(e){var t=e[0],a=e[1];switch(a){case 31:return{time:t,event:a,data:{message:e[2],line:e[3],column:e[4],stack:e[5],source:e[6]}};case 33:return{time:t,event:a,data:{code:e[2],name:e[3],message:e[4],stack:e[5],severity:e[6]}}}return null}function r(e){var t=e[0],a=e[1];switch(a){case 13:case 14:case 12:case 15:case 16:case 17:case 20:case 18:case 19:return{time:t,event:a,data:{target:e[2],x:e[3],y:e[4]}};case 9:var r=e[12].split(".");return{time:t,event:a,data:{target:e[2],x:e[3],y:e[4],eX:e[5],eY:e[6],button:e[7],reaction:e[8],context:e[9],text:e[10],link:e[11],hash:r[0],hashBeta:r.length>0?r[1]:null}};case 38:return{time:t,event:a,data:{target:e[2],action:e[3]}};case 11:return{time:t,event:a,data:{width:e[2],height:e[3]}};case 27:return{time:t,event:a,data:{target:e[2],value:e[3]}};case 21:return{time:t,event:a,data:{start:e[2],startOffset:e[3],end:e[4],endOffset:e[5]}};case 39:return{time:t,event:a,data:{target:e[2]}};case 10:return{time:t,event:a,data:{target:e[2],x:e[3],y:e[4]}};case 22:var i=e[3].split(".");return{time:t,event:a,data:{type:e[2],hash:i[0],x:e[4],y:e[5],reaction:e[6],context:e[7],hashBeta:i.length>0?i[1]:null}};case 28:return{time:t,event:a,data:{visible:e[2]}};case 26:return{time:t,event:a,data:{name:e[2]}}}return null}function i(e){var t=e[0],a=e[1];switch(a){case 8:return{time:t,event:a,data:{width:e[2],height:e[3]}};case 7:for(var r=[],i=void 0,s=2;s<e.length;s+=i){var o=void 0;if("number"==typeof e[s+2])o={id:e[s],interaction:e[s+1],visibility:e[s+2],name:e[s+3]},i=4;else{var c=e[s+1];o={id:e[s],interaction:c>=16?c:16,visibility:c<=13?c:0,name:e[s+2]},i=3}r.push(o)}return{time:t,event:a,data:r};case 37:var u=[];for(s=2;s<e.length;s+=3){var l={id:e[s],width:e[s+1]/100,height:e[s+2]/100};u.push(l)}return{time:t,event:a,data:u};case 5:case 6:var d=null,v=[],p=0,h=[];for(s=2;s<e.length;s++){var m=e[s],b=typeof m;switch(b){case"number":b!==d&&null!==d&&(h.push(n(v,p)),v=[],p=0),v.push(m),p++;break;case"string":v.push(m);break;case"object":switch(typeof m[0]){case"number":for(var g=0,f=m;g<f.length;g++){var k=f[g];v.push(e.length>k?e[k]:null)}}}d=b}return h.push(n(v,p)),{time:t,event:a,data:h}}return null}function n(e,t){for(var a=e[t]?e[t].split("~")[0]:e[t],r={id:Math.abs(e[0]),parent:t>1?e[1]:null,previous:t>2?e[2]:null,tag:a},i=e[0]<0,n=!1,c={},u=null,l=t+1;l<e.length;l++){var d=e[l].toString(),v=d.indexOf("="),p=d[0],h=d[d.length-1];if(l===e.length-1&&"STYLE"===r.tag)u=d;else if("*T"!==r.tag&&">"===h&&-1===v);else if("*T"!==r.tag&&"#"===p&&-1===v){var m=d.substr(1).split(".");2===m.length&&(r.width=s(m[0])/100,r.height=s(m[1])/100)}else if("*T"!==r.tag&&v>0){n=!0;var b=d.substr(0,v),g=d.substr(v+1);c[b]=g}else"*T"===r.tag&&(u=i?o(d):d)}return n&&(r.attributes=c),u&&(r.value=u),r}function s(e){return e?parseInt(e,36):null}function o(e){var t=e.trim();if(t.length>0&&-1===t.indexOf(" ")){var a=s(t);if(a>0){for(var r=Math.floor(a/6),i=a%6,n=Array(i+1).join("•"),o=0;o<r;o++)n+=(0===o&&0===i?"•":" ")+Array(6).join("•");return n}}return e}function c(e){var t=e[0],a=e[1];switch(a){case 29:return{time:t,event:a,data:{fetchStart:e[2],connectStart:e[3],connectEnd:e[4],requestStart:e[5],responseStart:e[6],responseEnd:e[7],domInteractive:e[8],domComplete:e[9],loadEventStart:e[10],loadEventEnd:e[11],redirectCount:e[12],size:e[13],type:e[14],protocol:e[15],encodedSize:e[16],decodedSize:e[17]}}}return null}function u(e){var t={major:0,minor:0,patch:0,beta:0},a=e.split(".");if(3===a.length){var r=a[2].split("-b");t.major=parseInt(a[0],10),t.minor=parseInt(a[1],10),2===r.length?(t.patch=parseInt(r[0],10),t.beta=parseInt(r[1],10)):t.patch=parseInt(a[2],10)}return t}var l=Object.freeze({__proto__:null,decode:function(n){var s,o=JSON.parse(n),l={version:(s=o.e)[0],sequence:s[1],start:s[2],duration:s[3],projectId:s[4],userId:s[5],sessionId:s[6],pageNum:s[7],upload:s[8],end:s[9]},d={timestamp:Date.now(),envelope:l},v=o.p?o.a.concat(o.p):o.a;v=v.sort((function(e,t){return e[0]-t[0]}));var p=u(d.envelope.version),h=u(e);if(p.major!==h.major||Math.abs(p.minor-h.minor)>1)throw new Error("Invalid version. Actual: "+d.envelope.version+" | Expected: "+"0.6.30 (+/- 1) | "+n.substr(0,250));for(var m=0,b=v;m<b.length;m++){var g=b[m];switch(g[1]){case 4:void 0===d.baseline&&(d.baseline=[]),d.baseline.push(t(g));break;case 25:void 0===d.ping&&(d.ping=[]),d.ping.push(t(g));break;case 35:void 0===d.limit&&(d.limit=[]),d.limit.push(t(g));break;case 3:void 0===d.upgrade&&(d.upgrade=[]),d.upgrade.push(t(g));break;case 0:void 0===d.metric&&(d.metric=[]);var f=t(g);f.data[2]=n.length,d.metric.push(f);break;case 1:void 0===d.dimension&&(d.dimension=[]),d.dimension.push(t(g));break;case 36:void 0===d.summary&&(d.summary=[]),d.summary.push(t(g));break;case 24:void 0===d.custom&&(d.custom=[]),d.custom.push(t(g));break;case 34:void 0===d.variable&&(d.variable=[]),d.variable.push(t(g));break;case 2:void 0===d.upload&&(d.upload=[]),d.upload.push(t(g));break;case 13:case 14:case 12:case 15:case 16:case 17:case 20:case 18:case 19:void 0===d.pointer&&(d.pointer=[]),d.pointer.push(r(g));break;case 9:void 0===d.click&&(d.click=[]);var k=r(g);d.click.push(k);break;case 38:void 0===d.clipboard&&(d.clipboard=[]);var y=r(g);d.clipboard.push(y);break;case 10:void 0===d.scroll&&(d.scroll=[]),d.scroll.push(r(g));break;case 11:void 0===d.resize&&(d.resize=[]),d.resize.push(r(g));break;case 21:void 0===d.selection&&(d.selection=[]),d.selection.push(r(g));break;case 39:void 0===d.submit&&(d.submit=[]);var w=r(g);d.submit.push(w);break;case 22:void 0===d.timeline&&(d.timeline=[]),d.timeline.push(r(g));break;case 27:void 0===d.input&&(d.input=[]),d.input.push(r(g));break;case 26:void 0===d.unload&&(d.unload=[]),d.unload.push(r(g));break;case 28:void 0===d.visibility&&(d.visibility=[]),d.visibility.push(r(g));break;case 37:void 0===d.box&&(d.box=[]),d.box.push(i(g));break;case 7:void 0===d.region&&(d.region=[]),d.region.push(i(g));break;case 5:case 6:void 0===d.dom&&(d.dom=[]),d.dom.push(i(g));break;case 8:void 0===d.doc&&(d.doc=[]),d.doc.push(i(g));break;case 31:void 0===d.script&&(d.script=[]),d.script.push(a(g));break;case 33:void 0===d.log&&(d.log=[]),d.log.push(a(g));break;case 29:void 0===d.navigation&&(d.navigation=[]),d.navigation.push(c(g));break;case 30:case 32:break;default:console.error("No handler for Event: "+JSON.stringify(g))}}return d}});"undefined"!=typeof window&&(void 0!==window.clarity&&null!==window.clarity||(window.clarity={}),window.clarity.decode=l)}();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version$1 = "0.6.
|
|
1
|
+
var version$1 = "0.6.30";
|
|
2
2
|
var version = version$1;
|
|
3
3
|
|
|
4
4
|
function decode$5(tokens) {
|
|
@@ -89,12 +89,6 @@ function decode$4(tokens) {
|
|
|
89
89
|
var time = tokens[0];
|
|
90
90
|
var event = tokens[1];
|
|
91
91
|
switch (event) {
|
|
92
|
-
case 32 /* ImageError */:
|
|
93
|
-
var imageError = {
|
|
94
|
-
source: tokens[2],
|
|
95
|
-
target: tokens[3],
|
|
96
|
-
};
|
|
97
|
-
return { time: time, event: event, data: imageError };
|
|
98
92
|
case 31 /* ScriptError */:
|
|
99
93
|
var scriptError = {
|
|
100
94
|
message: tokens[2],
|
|
@@ -153,6 +147,9 @@ function decode$3(tokens) {
|
|
|
153
147
|
hashBeta: clickHashes.length > 0 ? clickHashes[1] : null
|
|
154
148
|
};
|
|
155
149
|
return { time: time, event: event, data: clickData };
|
|
150
|
+
case 38 /* Clipboard */:
|
|
151
|
+
var clipData = { target: tokens[2], action: tokens[3] };
|
|
152
|
+
return { time: time, event: event, data: clipData };
|
|
156
153
|
case 11 /* Resize */:
|
|
157
154
|
var resizeData = { width: tokens[2], height: tokens[3] };
|
|
158
155
|
return { time: time, event: event, data: resizeData };
|
|
@@ -170,6 +167,11 @@ function decode$3(tokens) {
|
|
|
170
167
|
endOffset: tokens[5]
|
|
171
168
|
};
|
|
172
169
|
return { time: time, event: event, data: selectionData };
|
|
170
|
+
case 39 /* Submit */:
|
|
171
|
+
var submitData = {
|
|
172
|
+
target: tokens[2]
|
|
173
|
+
};
|
|
174
|
+
return { time: time, event: event, data: submitData };
|
|
173
175
|
case 10 /* Scroll */:
|
|
174
176
|
var scrollData = {
|
|
175
177
|
target: tokens[2],
|
|
@@ -366,14 +368,6 @@ function decode$1(tokens) {
|
|
|
366
368
|
var time = tokens[0];
|
|
367
369
|
var event = tokens[1];
|
|
368
370
|
switch (event) {
|
|
369
|
-
case 30 /* Connection */:
|
|
370
|
-
var connectionData = {
|
|
371
|
-
downlink: tokens[2],
|
|
372
|
-
rtt: tokens[3],
|
|
373
|
-
saveData: tokens[4],
|
|
374
|
-
type: tokens[5]
|
|
375
|
-
};
|
|
376
|
-
return { time: time, event: event, data: connectionData };
|
|
377
371
|
case 29 /* Navigation */:
|
|
378
372
|
var navigationData = {
|
|
379
373
|
fetchStart: tokens[2],
|
|
@@ -507,6 +501,13 @@ function decode(input) {
|
|
|
507
501
|
var clickEntry = decode$3(entry);
|
|
508
502
|
payload.click.push(clickEntry);
|
|
509
503
|
break;
|
|
504
|
+
case 38 /* Clipboard */:
|
|
505
|
+
if (payload.clipboard === undefined) {
|
|
506
|
+
payload.clipboard = [];
|
|
507
|
+
}
|
|
508
|
+
var clipEntry = decode$3(entry);
|
|
509
|
+
payload.clipboard.push(clipEntry);
|
|
510
|
+
break;
|
|
510
511
|
case 10 /* Scroll */:
|
|
511
512
|
if (payload.scroll === undefined) {
|
|
512
513
|
payload.scroll = [];
|
|
@@ -525,6 +526,13 @@ function decode(input) {
|
|
|
525
526
|
}
|
|
526
527
|
payload.selection.push(decode$3(entry));
|
|
527
528
|
break;
|
|
529
|
+
case 39 /* Submit */:
|
|
530
|
+
if (payload.submit === undefined) {
|
|
531
|
+
payload.submit = [];
|
|
532
|
+
}
|
|
533
|
+
var submitEntry = decode$3(entry);
|
|
534
|
+
payload.submit.push(submitEntry);
|
|
535
|
+
break;
|
|
528
536
|
case 22 /* Timeline */:
|
|
529
537
|
if (payload.timeline === undefined) {
|
|
530
538
|
payload.timeline = [];
|
|
@@ -580,30 +588,22 @@ function decode(input) {
|
|
|
580
588
|
}
|
|
581
589
|
payload.script.push(decode$4(entry));
|
|
582
590
|
break;
|
|
583
|
-
case 32 /* ImageError */:
|
|
584
|
-
if (payload.image === undefined) {
|
|
585
|
-
payload.image = [];
|
|
586
|
-
}
|
|
587
|
-
payload.image.push(decode$4(entry));
|
|
588
|
-
break;
|
|
589
591
|
case 33 /* Log */:
|
|
590
592
|
if (payload.log === undefined) {
|
|
591
593
|
payload.log = [];
|
|
592
594
|
}
|
|
593
595
|
payload.log.push(decode$4(entry));
|
|
594
596
|
break;
|
|
595
|
-
case 30 /* Connection */:
|
|
596
|
-
if (payload.connection === undefined) {
|
|
597
|
-
payload.connection = [];
|
|
598
|
-
}
|
|
599
|
-
payload.connection.push(decode$1(entry));
|
|
600
|
-
break;
|
|
601
597
|
case 29 /* Navigation */:
|
|
602
598
|
if (payload.navigation === undefined) {
|
|
603
599
|
payload.navigation = [];
|
|
604
600
|
}
|
|
605
601
|
payload.navigation.push(decode$1(entry));
|
|
606
602
|
break;
|
|
603
|
+
case 30 /* Connection */:
|
|
604
|
+
case 32 /* ImageError */:
|
|
605
|
+
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
606
|
+
break;
|
|
607
607
|
default:
|
|
608
608
|
console.error("No handler for Event: " + JSON.stringify(entry));
|
|
609
609
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clarity-decode",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.30",
|
|
4
4
|
"description": "An analytics library that uses web page interactions to generate aggregated insights",
|
|
5
5
|
"author": "Microsoft Corp.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/Microsoft/clarity/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"clarity-js": "^0.6.
|
|
29
|
+
"clarity-js": "^0.6.30"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rollup/plugin-commonjs": "^19.0.1",
|
package/src/clarity.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Data, version } from "clarity-js";
|
|
2
2
|
import { BaselineEvent, CustomEvent, DecodedPayload, DecodedVersion, DimensionEvent } from "../types/data";
|
|
3
3
|
import { LimitEvent, MetricEvent, PingEvent, SummaryEvent, UpgradeEvent, UploadEvent, VariableEvent } from "../types/data";
|
|
4
|
-
import {
|
|
5
|
-
import { ClickEvent, InputEvent, PointerEvent, ResizeEvent, ScrollEvent, TimelineEvent } from "../types/interaction";
|
|
4
|
+
import { LogEvent, ScriptErrorEvent } from "../types/diagnostic";
|
|
5
|
+
import { ClickEvent, ClipboardEvent, InputEvent, PointerEvent, ResizeEvent, ScrollEvent, SubmitEvent, TimelineEvent } from "../types/interaction";
|
|
6
6
|
import { SelectionEvent, UnloadEvent, VisibilityEvent } from "../types/interaction";
|
|
7
7
|
import { BoxEvent, DocumentEvent, DomEvent, RegionEvent } from "../types/layout";
|
|
8
|
-
import {
|
|
8
|
+
import { NavigationEvent } from "../types/performance";
|
|
9
9
|
|
|
10
10
|
import * as data from "./data";
|
|
11
11
|
import * as diagnostic from "./diagnostic";
|
|
@@ -101,6 +101,11 @@ export function decode(input: string): DecodedPayload {
|
|
|
101
101
|
let clickEntry = interaction.decode(entry) as ClickEvent;
|
|
102
102
|
payload.click.push(clickEntry);
|
|
103
103
|
break;
|
|
104
|
+
case Data.Event.Clipboard:
|
|
105
|
+
if (payload.clipboard === undefined) { payload.clipboard = []; }
|
|
106
|
+
let clipEntry = interaction.decode(entry) as ClipboardEvent;
|
|
107
|
+
payload.clipboard.push(clipEntry);
|
|
108
|
+
break;
|
|
104
109
|
case Data.Event.Scroll:
|
|
105
110
|
if (payload.scroll === undefined) { payload.scroll = []; }
|
|
106
111
|
payload.scroll.push(interaction.decode(entry) as ScrollEvent);
|
|
@@ -113,6 +118,11 @@ export function decode(input: string): DecodedPayload {
|
|
|
113
118
|
if (payload.selection === undefined) { payload.selection = []; }
|
|
114
119
|
payload.selection.push(interaction.decode(entry) as SelectionEvent);
|
|
115
120
|
break;
|
|
121
|
+
case Data.Event.Submit:
|
|
122
|
+
if (payload.submit === undefined) { payload.submit = []; }
|
|
123
|
+
let submitEntry = interaction.decode(entry) as SubmitEvent;
|
|
124
|
+
payload.submit.push(submitEntry);
|
|
125
|
+
break;
|
|
116
126
|
case Data.Event.Timeline:
|
|
117
127
|
if (payload.timeline === undefined) { payload.timeline = []; }
|
|
118
128
|
payload.timeline.push(interaction.decode(entry) as TimelineEvent);
|
|
@@ -150,22 +160,18 @@ export function decode(input: string): DecodedPayload {
|
|
|
150
160
|
if (payload.script === undefined) { payload.script = []; }
|
|
151
161
|
payload.script.push(diagnostic.decode(entry) as ScriptErrorEvent);
|
|
152
162
|
break;
|
|
153
|
-
case Data.Event.ImageError:
|
|
154
|
-
if (payload.image === undefined) { payload.image = []; }
|
|
155
|
-
payload.image.push(diagnostic.decode(entry) as ImageErrorEvent);
|
|
156
|
-
break;
|
|
157
163
|
case Data.Event.Log:
|
|
158
164
|
if (payload.log === undefined) { payload.log = []; }
|
|
159
165
|
payload.log.push(diagnostic.decode(entry) as LogEvent);
|
|
160
166
|
break;
|
|
161
|
-
case Data.Event.Connection:
|
|
162
|
-
if (payload.connection === undefined) { payload.connection = []; }
|
|
163
|
-
payload.connection.push(performance.decode(entry) as ConnectionEvent);
|
|
164
|
-
break;
|
|
165
167
|
case Data.Event.Navigation:
|
|
166
168
|
if (payload.navigation === undefined) { payload.navigation = []; }
|
|
167
169
|
payload.navigation.push(performance.decode(entry) as NavigationEvent);
|
|
168
170
|
break;
|
|
171
|
+
case Data.Event.Connection:
|
|
172
|
+
case Data.Event.ImageError:
|
|
173
|
+
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
174
|
+
break;
|
|
169
175
|
default:
|
|
170
176
|
console.error(`No handler for Event: ${JSON.stringify(entry)}`);
|
|
171
177
|
break;
|
package/src/diagnostic.ts
CHANGED
|
@@ -5,12 +5,6 @@ export function decode(tokens: Data.Token[]): DiagnosticEvent {
|
|
|
5
5
|
let time = tokens[0] as number;
|
|
6
6
|
let event = tokens[1] as Data.Event;
|
|
7
7
|
switch (event) {
|
|
8
|
-
case Data.Event.ImageError:
|
|
9
|
-
let imageError: Diagnostic.ImageErrorData = {
|
|
10
|
-
source: tokens[2] as string,
|
|
11
|
-
target: tokens[3] as number,
|
|
12
|
-
};
|
|
13
|
-
return { time, event, data: imageError };
|
|
14
8
|
case Data.Event.ScriptError:
|
|
15
9
|
let scriptError: Diagnostic.ScriptErrorData = {
|
|
16
10
|
message: tokens[2] as string,
|
package/src/interaction.ts
CHANGED
|
@@ -37,6 +37,9 @@ export function decode(tokens: Data.Token[]): InteractionEvent {
|
|
|
37
37
|
hashBeta: clickHashes.length > 0 ? clickHashes[1] : null
|
|
38
38
|
};
|
|
39
39
|
return { time, event, data: clickData };
|
|
40
|
+
case Data.Event.Clipboard:
|
|
41
|
+
let clipData: Interaction.ClipboardData = { target: tokens[2] as number, action: tokens[3] as Interaction.Clipboard };
|
|
42
|
+
return { time, event, data: clipData };
|
|
40
43
|
case Data.Event.Resize:
|
|
41
44
|
let resizeData: Interaction.ResizeData = { width: tokens[2] as number, height: tokens[3] as number };
|
|
42
45
|
return { time, event, data: resizeData };
|
|
@@ -54,6 +57,11 @@ export function decode(tokens: Data.Token[]): InteractionEvent {
|
|
|
54
57
|
endOffset: tokens[5] as number
|
|
55
58
|
};
|
|
56
59
|
return { time, event, data: selectionData };
|
|
60
|
+
case Data.Event.Submit:
|
|
61
|
+
let submitData: Interaction.SubmitData = {
|
|
62
|
+
target: tokens[2] as number
|
|
63
|
+
};
|
|
64
|
+
return { time, event, data: submitData };
|
|
57
65
|
case Data.Event.Scroll:
|
|
58
66
|
let scrollData: Interaction.ScrollData = {
|
|
59
67
|
target: tokens[2] as number,
|
package/src/performance.ts
CHANGED
|
@@ -5,14 +5,6 @@ export function decode(tokens: Data.Token[]): PerformanceEvent {
|
|
|
5
5
|
let time = tokens[0] as number;
|
|
6
6
|
let event = tokens[1] as Data.Event;
|
|
7
7
|
switch (event) {
|
|
8
|
-
case Data.Event.Connection:
|
|
9
|
-
let connectionData: Performance.ConnectionData = {
|
|
10
|
-
downlink: tokens[2] as number,
|
|
11
|
-
rtt: tokens[3] as number,
|
|
12
|
-
saveData: tokens[4] as number,
|
|
13
|
-
type: tokens[5] as string
|
|
14
|
-
};
|
|
15
|
-
return { time, event, data: connectionData };
|
|
16
8
|
case Data.Event.Navigation:
|
|
17
9
|
let navigationData: Performance.NavigationData = {
|
|
18
10
|
fetchStart: tokens[2] as number,
|
package/types/data.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Data } from "clarity-js";
|
|
2
|
-
import { DiagnosticEvent,
|
|
3
|
-
import { ClickEvent, InputEvent, InteractionEvent, PointerEvent, ResizeEvent } from "./interaction";
|
|
2
|
+
import { DiagnosticEvent, LogEvent, ScriptErrorEvent } from "./diagnostic";
|
|
3
|
+
import { ClickEvent, ClipboardEvent, InputEvent, InteractionEvent, PointerEvent, ResizeEvent, SubmitEvent } from "./interaction";
|
|
4
4
|
import { ScrollEvent, SelectionEvent, TimelineEvent, UnloadEvent, VisibilityEvent } from "./interaction";
|
|
5
5
|
import { BoxEvent, DocumentEvent, DomEvent, LayoutEvent, RegionEvent } from "./layout";
|
|
6
|
-
import {
|
|
6
|
+
import { NavigationEvent, PerformanceEvent } from "./performance";
|
|
7
7
|
import { PartialEvent } from "./core";
|
|
8
8
|
|
|
9
9
|
/* Redeclare enums */
|
|
@@ -50,14 +50,15 @@ export interface DecodedPayload {
|
|
|
50
50
|
dimension?: DimensionEvent[];
|
|
51
51
|
ping?: PingEvent[];
|
|
52
52
|
limit?: LimitEvent[];
|
|
53
|
-
image?: ImageErrorEvent[];
|
|
54
53
|
script?: ScriptErrorEvent[];
|
|
55
54
|
input?: InputEvent[];
|
|
56
55
|
pointer?: PointerEvent[];
|
|
57
56
|
click?: ClickEvent[];
|
|
57
|
+
clipboard?: ClipboardEvent[];
|
|
58
58
|
resize?: ResizeEvent[];
|
|
59
59
|
scroll?: ScrollEvent[];
|
|
60
60
|
selection?: SelectionEvent[];
|
|
61
|
+
submit?: SubmitEvent[];
|
|
61
62
|
summary?: SummaryEvent[];
|
|
62
63
|
timeline?: TimelineEvent[];
|
|
63
64
|
unload?: UnloadEvent[];
|
|
@@ -68,7 +69,6 @@ export interface DecodedPayload {
|
|
|
68
69
|
region?: RegionEvent[];
|
|
69
70
|
dom?: DomEvent[];
|
|
70
71
|
doc?: DocumentEvent[];
|
|
71
|
-
connection?: ConnectionEvent[];
|
|
72
72
|
navigation?: NavigationEvent[];
|
|
73
73
|
log?: LogEvent[];
|
|
74
74
|
baseline?: BaselineEvent[];
|
package/types/diagnostic.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Diagnostic } from "clarity-js";
|
|
2
2
|
import { PartialEvent } from "./core";
|
|
3
3
|
|
|
4
|
-
export interface ImageErrorEvent extends PartialEvent { data: Diagnostic.ImageErrorData; }
|
|
5
4
|
export interface ScriptErrorEvent extends PartialEvent { data: Diagnostic.ScriptErrorData; }
|
|
6
5
|
export interface LogEvent extends PartialEvent { data: Diagnostic.LogData; }
|
|
7
6
|
export interface DiagnosticEvent extends PartialEvent {
|
|
8
|
-
data: Diagnostic.
|
|
7
|
+
data: Diagnostic.LogData | Diagnostic.ScriptErrorData;
|
|
9
8
|
}
|
package/types/interaction.d.ts
CHANGED
|
@@ -11,20 +11,24 @@ export interface TimelineData extends Interaction.TimelineData {
|
|
|
11
11
|
|
|
12
12
|
export interface InputEvent extends PartialEvent { data: Interaction.InputData; }
|
|
13
13
|
export interface ClickEvent extends PartialEvent { data: ClickData; }
|
|
14
|
+
export interface ClipboardEvent extends PartialEvent { data: Interaction.ClipboardData; }
|
|
14
15
|
export interface PointerEvent extends PartialEvent { data: Interaction.PointerData; }
|
|
15
16
|
export interface ResizeEvent extends PartialEvent { data: Interaction.ResizeData; }
|
|
16
17
|
export interface ScrollEvent extends PartialEvent { data: Interaction.ScrollData; }
|
|
17
18
|
export interface SelectionEvent extends PartialEvent { data: Interaction.SelectionData; }
|
|
19
|
+
export interface SubmitEvent extends PartialEvent { data: Interaction.SubmitData; }
|
|
18
20
|
export interface TimelineEvent extends PartialEvent { data: TimelineData; }
|
|
19
21
|
export interface UnloadEvent extends PartialEvent { data: Interaction.UnloadData; }
|
|
20
22
|
export interface VisibilityEvent extends PartialEvent { data: Interaction.VisibilityData; }
|
|
21
23
|
export interface InteractionEvent extends PartialEvent {
|
|
22
24
|
data: ClickData |
|
|
25
|
+
Interaction.ClipboardData |
|
|
23
26
|
Interaction.InputData |
|
|
24
27
|
Interaction.PointerData |
|
|
25
28
|
Interaction.ResizeData |
|
|
26
29
|
Interaction.ScrollData |
|
|
27
30
|
Interaction.SelectionData |
|
|
31
|
+
Interaction.SubmitData |
|
|
28
32
|
TimelineData |
|
|
29
33
|
Interaction.UnloadData |
|
|
30
34
|
Interaction.VisibilityData;
|
package/types/performance.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Performance } from "clarity-js";
|
|
2
2
|
import { PartialEvent } from "./core";
|
|
3
3
|
|
|
4
|
-
export interface ConnectionEvent extends PartialEvent { data: Performance.ConnectionData; }
|
|
5
4
|
export interface NavigationEvent extends PartialEvent { data: Performance.NavigationData; }
|
|
6
5
|
export interface PerformanceEvent extends PartialEvent {
|
|
7
|
-
data: Performance.
|
|
6
|
+
data: Performance.NavigationData
|
|
8
7
|
}
|