clarity-decode 0.8.33 → 0.8.34
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 +17 -3
- package/build/clarity.decode.min.js +1 -1
- package/build/clarity.decode.module.js +17 -3
- package/package.json +2 -2
- package/src/clarity.ts +8 -2
- package/src/interaction.ts +6 -1
- package/test/decode.test.js +28 -1
- package/types/data.d.ts +2 -1
- package/types/interaction.d.ts +1 -0
package/build/clarity.decode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version$1 = "0.8.
|
|
3
|
+
var version$1 = "0.8.34";
|
|
4
4
|
var version = version$1;
|
|
5
5
|
|
|
6
6
|
function decode$5(tokens) {
|
|
@@ -250,7 +250,13 @@ function decode$3(tokens) {
|
|
|
250
250
|
};
|
|
251
251
|
return { time: time, event: event, data: timelineData };
|
|
252
252
|
case 28 /* Data.Event.Visibility */:
|
|
253
|
-
var visibleData =
|
|
253
|
+
var visibleData = void 0;
|
|
254
|
+
if (typeof tokens[2] === "number") {
|
|
255
|
+
visibleData = { visible: tokens[2] };
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
visibleData = { visible: tokens[2] === "visible" ? 1 /* Data.BooleanFlag.True */ : 0 /* Data.BooleanFlag.False */ };
|
|
259
|
+
}
|
|
254
260
|
return { time: time, event: event, data: visibleData };
|
|
255
261
|
case 50 /* Data.Event.Focus */:
|
|
256
262
|
var focusData = { focused: tokens[2] };
|
|
@@ -649,6 +655,12 @@ function decode(input) {
|
|
|
649
655
|
}
|
|
650
656
|
payload.visibility.push(decode$3(entry));
|
|
651
657
|
break;
|
|
658
|
+
case 50 /* Data.Event.Focus */:
|
|
659
|
+
if (payload.focus === undefined) {
|
|
660
|
+
payload.focus = [];
|
|
661
|
+
}
|
|
662
|
+
payload.focus.push(decode$3(entry));
|
|
663
|
+
break;
|
|
652
664
|
case 37 /* Data.Event.Box */:
|
|
653
665
|
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
654
666
|
break;
|
|
@@ -722,7 +734,9 @@ function decode(input) {
|
|
|
722
734
|
payload.customElement.push(decode$2(entry));
|
|
723
735
|
break;
|
|
724
736
|
default:
|
|
725
|
-
|
|
737
|
+
if (typeof entry[1] === "number" && entry[1] < 200) {
|
|
738
|
+
console.error("No handler for Event: ".concat(JSON.stringify(entry)));
|
|
739
|
+
}
|
|
726
740
|
break;
|
|
727
741
|
}
|
|
728
742
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e="0.8.
|
|
1
|
+
!function(){"use strict";var e="0.8.34";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,n={};r<e.length;)n[e[r++]]=e[r++];return{time:t,event:a,data:n};case 1:for(var i=2,s={};i<e.length;)s[e[i++]]=e[i++];return{time:t,event:a,data:s};case 36:for(var c=2,o={};c<e.length;){var u=e[c++],l=e[c++];o[u]=[];for(var d=0;d<l.length-1;d+=2)o[u].push([l[d],l[d+1]])}return{time:t,event:a,data:o};case 4:var v=e.length;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],scrollTime:v>12?e[12]:null,pointerTime:v>13?e[13]:null,moveX:v>14?e[14]:null,moveY:v>15?e[15]:null,moveTime:v>16?e[16]:null,downX:v>17?e[17]:null,downY:v>18?e[18]:null,downTime:v>19?e[19]:null,upX:v>20?e[20]:null,upY:v>21?e[21]:null,upTime:v>22?e[22]:null,pointerPrevX:v>23?e[23]:null,pointerPrevY:v>24?e[24]:null,pointerPrevTime:v>25?e[25]:null}};case 34:for(var p=2,m={};p<e.length;)m[e[p++]]="string"==typeof e[p+1]?[e[p++]]:e[p++];return{time:t,event:a,data:m};case 40:for(var h=2,g={};h<e.length;)if("string"==typeof e[h+1])g[e[h++]]=e[h++];else{u=e[h++],l=e[h++];g[u]=[];for(d=0;d<l.length-1;d+=2)g[u][l[d]]=l[d+1]}return{time:t,event:a,data:g};case 47:return{time:t,event:a,data:{source:e[2],ad_Storage:e[3],analytics_Storage:e[4]}}}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]}};case 41:return{time:t,event:a,data:{id:e[2],target:e[3],checksum:e[4]}}}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],id:e[5]}};case 9:case 48: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,trust:e.length>13?e[13]:1,isFullText:e.length>14?e[14]: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],trust:e.length>4?e[4]:1}};case 21:return{time:t,event:a,data:{start:e[2],startOffset:e[3],end:e[4],endOffset:e[5]}};case 42:return{time:t,event:a,data:{target:e[2],type:e[3],value:e[4],checksum: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],top:e.length>5?e[5]:null,bottom:e.length>6?e[6]:null}};case 22:var n=e[3].split(".");return{time:t,event:a,data:{type:e[2],hash:n[0],x:e[4],y:e[5],reaction:e[6],context:e[7],hashBeta:n.length>0?n[1]:null}};case 28:return{time:t,event:a,data:"number"==typeof e[2]?{visible:e[2]}:{visible:"visible"===e[2]?1:0}};case 50:return{time:t,event:a,data:{focused:e[2]}};case 26:return{time:t,event:a,data:{name:e[2],persisted:e[3]}}}return null}var n=6,i=" ";function s(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=[],n=void 0,i=2;i<e.length;i+=n){var s=void 0;if("number"==typeof e[i+2])s={id:e[i],interaction:e[i+1],visibility:e[i+2],name:e[i+3]},n=4;else{var o=e[i+1];s={id:e[i],interaction:o>=16?o:16,visibility:o<=13?o:0,name:e[i+2]},n=3}r.push(s)}return{time:t,event:a,data:r};case 45:return{time:t,event:a,data:{id:e[2],operation:e[3],newIds:e[4]}};case 46:return{time:t,event:a,data:{id:e[2],operation:e[3],cssRules:e[4]}};case 44:return{time:t,event:a,data:{id:e[2],operation:e[3],keyFrames:e[4],timing:e[5],timeline:e[6],targetId:e[7]}};case 5:case 6:case 43:var u=null,l=[],d=0,v=[];for(i=2;i<e.length;i++){var p=e[i],m=typeof p;switch(m){case"number":m!==u&&null!==u&&(v.push(c(l,d)),l=[],d=0),l.push(p),d++;break;case"string":l.push(p);break;case"object":if("number"===typeof p[0])for(var h=0,g=p;h<g.length;h++){var b=g[h];l.push(e.length>b?e[b]:null)}}u=m}return v.push(c(l,d)),{time:t,event:a,data:v};case 51:return{time:t,event:a,data:{name:e[2]}}}return null}function c(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},n=e[0]<0,i=!1,s={},c=null,l=t+1;l<e.length;l++){var d=e[l].toString(),v=d.indexOf("="),p=d[0],m=d[d.length-1];if(l===e.length-1&&"STYLE"===r.tag)c=d;else if("*T"!==r.tag&&">"===m&&-1===v);else if("*T"!==r.tag&&"#"===p&&-1===v){var h=d.substr(1).split(".");2===h.length&&(r.width=o(h[0])/100,r.height=o(h[1])/100)}else if("*T"!==r.tag&&v>0){i=!0;var g=d.substr(0,v),b=d.substr(v+1);s[g]=b}else"*T"===r.tag&&(c=n?u(d):d)}return i&&(r.attributes=s),c&&(r.value=c),r}function o(e){return e?parseInt(e,36):null}function u(e){var t=e.trim();if(t.length>0&&-1===t.indexOf(i)){var a=o(t);if(a>0){for(var r=Math.floor(a/n),s=a%n,c=Array(s+1).join("•"),u=0;u<r;u++)c+=(0===u&&0===s?"•":i)+Array(n).join("•");return c}}return e}function l(e){var t=e[0],a=e[1];return 29===a?{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]}}:null}function d(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 v=Object.freeze({__proto__:null,decode:function(n){var i,c=JSON.parse(n),o={version:(i=c.e)[0],sequence:i[1],start:i[2],duration:i[3],projectId:i[4],userId:i[5],sessionId:i[6],pageNum:i[7],upload:i[8],end:i[9],applicationPlatform:i[10],url:i[11]},u={timestamp:Date.now(),envelope:o},v=c.p?c.a.concat(c.p):c.a;v=v.sort((function(e,t){return e[0]-t[0]}));var p=d(u.envelope.version),m=d(e);if(p.major!==m.major||Math.abs(p.minor-m.minor)>1)throw new Error("Invalid version. Actual: ".concat(u.envelope.version," | Expected: ").concat(e," (+/- 1) | ").concat(n.substr(0,250)));for(var h=0,g=v;h<g.length;h++){var b=g[h];switch(b[1]){case 4:void 0===u.baseline&&(u.baseline=[]),u.baseline.push(t(b));break;case 25:void 0===u.ping&&(u.ping=[]),u.ping.push(t(b));break;case 35:void 0===u.limit&&(u.limit=[]),u.limit.push(t(b));break;case 3:void 0===u.upgrade&&(u.upgrade=[]),u.upgrade.push(t(b));break;case 0:void 0===u.metric&&(u.metric=[]);var f=t(b);f.data[2]=n.length,u.metric.push(f);break;case 1:void 0===u.dimension&&(u.dimension=[]),u.dimension.push(t(b));break;case 36:void 0===u.summary&&(u.summary=[]),u.summary.push(t(b));break;case 24:void 0===u.custom&&(u.custom=[]),u.custom.push(t(b));break;case 34:void 0===u.variable&&(u.variable=[]),u.variable.push(t(b));break;case 2:void 0===u.upload&&(u.upload=[]),u.upload.push(t(b));break;case 13:case 14:case 12:case 15:case 16:case 17:case 20:case 18:case 19:void 0===u.pointer&&(u.pointer=[]),u.pointer.push(r(b));break;case 9:void 0===u.click&&(u.click=[]);var k=r(b);u.click.push(k);break;case 48:void 0===u.contextMenu&&(u.contextMenu=[]);var y=r(b);u.contextMenu.push(y);break;case 38:void 0===u.clipboard&&(u.clipboard=[]);var w=r(b);u.clipboard.push(w);break;case 10:void 0===u.scroll&&(u.scroll=[]),u.scroll.push(r(b));break;case 11:void 0===u.resize&&(u.resize=[]),u.resize.push(r(b));break;case 21:void 0===u.selection&&(u.selection=[]),u.selection.push(r(b));break;case 42:void 0===u.change&&(u.change=[]);var x=r(b);u.change.push(x);break;case 39:void 0===u.submit&&(u.submit=[]);var I=r(b);u.submit.push(I);break;case 22:void 0===u.timeline&&(u.timeline=[]),u.timeline.push(r(b));break;case 27:void 0===u.input&&(u.input=[]),u.input.push(r(b));break;case 26:void 0===u.unload&&(u.unload=[]),u.unload.push(r(b));break;case 28:void 0===u.visibility&&(u.visibility=[]),u.visibility.push(r(b));break;case 50:void 0===u.focus&&(u.focus=[]),u.focus.push(r(b));break;case 37:case 30:case 32:break;case 7:void 0===u.region&&(u.region=[]),u.region.push(s(b));break;case 5:case 6:case 43:case 45:case 46:case 44:void 0===u.dom&&(u.dom=[]),u.dom.push(s(b));break;case 8:void 0===u.doc&&(u.doc=[]),u.doc.push(s(b));break;case 31:void 0===u.script&&(u.script=[]),u.script.push(a(b));break;case 33:void 0===u.log&&(u.log=[]),u.log.push(a(b));break;case 41:void 0===u.fraud&&(u.fraud=[]),u.fraud.push(a(b));break;case 29:void 0===u.navigation&&(u.navigation=[]),u.navigation.push(l(b));break;case 40:void 0===u.extract&&(u.extract=[]),u.extract.push(t(b));break;case 47:void 0===u.consent&&(u.consent=[]),u.consent.push(t(b));break;case 51:void 0===u.customElement&&(u.customElement=[]),u.customElement.push(s(b));break;default:"number"==typeof b[1]&&b[1]<200&&console.error("No handler for Event: ".concat(JSON.stringify(b)))}}return u}});"undefined"!=typeof window&&(void 0!==window.clarity&&null!==window.clarity||(window.clarity={}),window.clarity.decode=v)}();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version$1 = "0.8.
|
|
1
|
+
var version$1 = "0.8.34";
|
|
2
2
|
var version = version$1;
|
|
3
3
|
|
|
4
4
|
function decode$5(tokens) {
|
|
@@ -248,7 +248,13 @@ function decode$3(tokens) {
|
|
|
248
248
|
};
|
|
249
249
|
return { time: time, event: event, data: timelineData };
|
|
250
250
|
case 28 /* Data.Event.Visibility */:
|
|
251
|
-
var visibleData =
|
|
251
|
+
var visibleData = void 0;
|
|
252
|
+
if (typeof tokens[2] === "number") {
|
|
253
|
+
visibleData = { visible: tokens[2] };
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
visibleData = { visible: tokens[2] === "visible" ? 1 /* Data.BooleanFlag.True */ : 0 /* Data.BooleanFlag.False */ };
|
|
257
|
+
}
|
|
252
258
|
return { time: time, event: event, data: visibleData };
|
|
253
259
|
case 50 /* Data.Event.Focus */:
|
|
254
260
|
var focusData = { focused: tokens[2] };
|
|
@@ -647,6 +653,12 @@ function decode(input) {
|
|
|
647
653
|
}
|
|
648
654
|
payload.visibility.push(decode$3(entry));
|
|
649
655
|
break;
|
|
656
|
+
case 50 /* Data.Event.Focus */:
|
|
657
|
+
if (payload.focus === undefined) {
|
|
658
|
+
payload.focus = [];
|
|
659
|
+
}
|
|
660
|
+
payload.focus.push(decode$3(entry));
|
|
661
|
+
break;
|
|
650
662
|
case 37 /* Data.Event.Box */:
|
|
651
663
|
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
652
664
|
break;
|
|
@@ -720,7 +732,9 @@ function decode(input) {
|
|
|
720
732
|
payload.customElement.push(decode$2(entry));
|
|
721
733
|
break;
|
|
722
734
|
default:
|
|
723
|
-
|
|
735
|
+
if (typeof entry[1] === "number" && entry[1] < 200) {
|
|
736
|
+
console.error("No handler for Event: ".concat(JSON.stringify(entry)));
|
|
737
|
+
}
|
|
724
738
|
break;
|
|
725
739
|
}
|
|
726
740
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clarity-decode",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.34",
|
|
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.8.
|
|
29
|
+
"clarity-js": "^0.8.34"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rollup/plugin-commonjs": "^24.0.0",
|
package/src/clarity.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaselineEvent, CustomEvent, DecodedPayload, DecodedVersion, DimensionEv
|
|
|
3
3
|
import { LimitEvent, MetricEvent, PingEvent, SummaryEvent, UpgradeEvent, UploadEvent, VariableEvent, ExtractEvent, ConsentEvent } from "../types/data";
|
|
4
4
|
import { FraudEvent, LogEvent, ScriptErrorEvent } from "../types/diagnostic";
|
|
5
5
|
import { ChangeEvent, ClickEvent, ContextMenuEvent, ClipboardEvent, InputEvent, PointerEvent, ResizeEvent, ScrollEvent } from "../types/interaction";
|
|
6
|
-
import { SelectionEvent, SubmitEvent, TimelineEvent, UnloadEvent, VisibilityEvent } from "../types/interaction";
|
|
6
|
+
import { SelectionEvent, SubmitEvent, TimelineEvent, UnloadEvent, VisibilityEvent, FocusEvent } from "../types/interaction";
|
|
7
7
|
import { CustomElementEvent, DocumentEvent, DomEvent, RegionEvent } from "../types/layout";
|
|
8
8
|
import { NavigationEvent } from "../types/performance";
|
|
9
9
|
|
|
@@ -149,6 +149,10 @@ export function decode(input: string): DecodedPayload {
|
|
|
149
149
|
if (payload.visibility === undefined) { payload.visibility = []; }
|
|
150
150
|
payload.visibility.push(interaction.decode(entry) as VisibilityEvent);
|
|
151
151
|
break;
|
|
152
|
+
case Data.Event.Focus:
|
|
153
|
+
if (payload.focus === undefined) { payload.focus = []; }
|
|
154
|
+
payload.focus.push(interaction.decode(entry) as FocusEvent);
|
|
155
|
+
break;
|
|
152
156
|
case Data.Event.Box:
|
|
153
157
|
/* Deprecated - Intentionally, no-op. For backward compatibility. */
|
|
154
158
|
break;
|
|
@@ -202,7 +206,9 @@ export function decode(input: string): DecodedPayload {
|
|
|
202
206
|
payload.customElement.push(layout.decode(entry) as CustomElementEvent);
|
|
203
207
|
break;
|
|
204
208
|
default:
|
|
205
|
-
|
|
209
|
+
if (typeof entry[1] === "number" && entry[1] < 200) {
|
|
210
|
+
console.error(`No handler for Event: ${JSON.stringify(entry)}`);
|
|
211
|
+
}
|
|
206
212
|
break;
|
|
207
213
|
}
|
|
208
214
|
}
|
package/src/interaction.ts
CHANGED
|
@@ -93,7 +93,12 @@ export function decode(tokens: Data.Token[]): InteractionEvent {
|
|
|
93
93
|
};
|
|
94
94
|
return { time, event, data: timelineData };
|
|
95
95
|
case Data.Event.Visibility:
|
|
96
|
-
let visibleData: Interaction.VisibilityData
|
|
96
|
+
let visibleData: Interaction.VisibilityData;
|
|
97
|
+
if (typeof tokens[2] === "number") {
|
|
98
|
+
visibleData = { visible: tokens[2] as number };
|
|
99
|
+
} else {
|
|
100
|
+
visibleData = { visible: (tokens[2] as string) === "visible" ? Data.BooleanFlag.True : Data.BooleanFlag.False };
|
|
101
|
+
}
|
|
97
102
|
return { time, event, data: visibleData };
|
|
98
103
|
case Data.Event.Focus:
|
|
99
104
|
let focusData: Interaction.FocusData = { focused: tokens[2] as number };
|
package/test/decode.test.js
CHANGED
|
@@ -10,7 +10,7 @@ describe('decode function', () => {
|
|
|
10
10
|
a: [
|
|
11
11
|
[2, 8, 1982, 3098],
|
|
12
12
|
[29, 11, 1982, 992],
|
|
13
|
-
[29, 28,
|
|
13
|
+
[29, 28, 1],
|
|
14
14
|
[35, 29, 63, 65, 421, 421, 551, 552, 941, 1820, 1821, 1826, 0, 23734, "navigate", "h2", 23434, 138226],
|
|
15
15
|
[36, 7, 116, 16, 13, "1"],
|
|
16
16
|
[36, 7, 120, 16, 0, "2"],
|
|
@@ -30,7 +30,34 @@ describe('decode function', () => {
|
|
|
30
30
|
assert.isNumber(result.timestamp);
|
|
31
31
|
assert.isObject(result.envelope);
|
|
32
32
|
assert.equal(result.envelope.version, "0.8.20");
|
|
33
|
+
assert.equal(result.visibility[0].data.visible, 1);
|
|
33
34
|
assert.equal(result.contextMenu[0].data.target, 488);
|
|
34
35
|
assert.equal(result.contextMenu[0].data.button, 2);
|
|
35
36
|
});
|
|
37
|
+
|
|
38
|
+
it('visibility event should be backward compatible to support string values', () => {
|
|
39
|
+
// This is a very simple test that focuses on basic decoding functionality
|
|
40
|
+
const testPayload = {
|
|
41
|
+
e: ["0.8.20", 1, 0, 506, "devtools", "1mtqiaz", "1c27tix", 2, 0, 0, 0, "https://test.com/"],
|
|
42
|
+
a: [
|
|
43
|
+
[2, 8, 1982, 3098],
|
|
44
|
+
[29, 11, 1982, 992],
|
|
45
|
+
[29, 28, "visible"],
|
|
46
|
+
[505, 1, 0, ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"], 1, ["https://test.com/"], 3, ["A little bit of this and that!"], 4, ["test.com"], 5, ["BlogPosting"], 9, ["en-US"], 15, ["1xtxvl0"], 17, ["ltr"], 18, ["Story 8", "Story 7", "Story 6"], 20, ["A title!"], 21, ["blogger"], 22, ["macOS"], 23, ["15.5.0"], 24, ["undefined~8", "undefined~138"], 26, ["1.7999999523162842"], 27, ["4g"], 28, ["1979"], 29, ["2"], 31, ["44nejbc7s.6933hhug7"], 32, ["519i394pb.53uwavtzg"], 34, ["America/Los_Angeles"], 35, ["420"], 36, ["1"], 37, ["-1"]],
|
|
47
|
+
[505, 0, 0, 1752816151601, 1, 1, 3, 34, 4, 35, 5, 3, 7, 4, 8, 1636, 9, 0, 10, 2, 14, 1792, 15, 1120, 16, 24, 25, 9, 26, 0, 27, 0, 31, 1, 32, 0, 33, 8, 34, 8, 35, 0],
|
|
48
|
+
[506, 47, 0, 1, 1],
|
|
49
|
+
[550, 48, 488, 493, 484, 16383, 16383, 2, 1, 0, "It's a title", null, "1ltv07afj", "4ppc0yuhe", 1, 0]
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const input = JSON.stringify(testPayload);
|
|
54
|
+
|
|
55
|
+
const result = decode(input);
|
|
56
|
+
|
|
57
|
+
assert.isObject(result);
|
|
58
|
+
assert.isNumber(result.timestamp);
|
|
59
|
+
assert.isObject(result.envelope);
|
|
60
|
+
assert.equal(result.envelope.version, "0.8.20");
|
|
61
|
+
assert.equal(result.visibility[0].data.visible, 1);
|
|
62
|
+
});
|
|
36
63
|
});
|
package/types/data.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Data } from "clarity-js";
|
|
2
2
|
import { DiagnosticEvent, FraudEvent, LogEvent, ScriptErrorEvent } from "./diagnostic";
|
|
3
3
|
import { ChangeEvent, ClickEvent, ContextMenuEvent, ClipboardEvent, InputEvent, InteractionEvent, PointerEvent, ResizeEvent, SubmitEvent } from "./interaction";
|
|
4
|
-
import { ScrollEvent, SelectionEvent, TimelineEvent, UnloadEvent, VisibilityEvent } from "./interaction";
|
|
4
|
+
import { ScrollEvent, SelectionEvent, TimelineEvent, UnloadEvent, VisibilityEvent, FocusEvent } from "./interaction";
|
|
5
5
|
import { DocumentEvent, DomEvent, LayoutEvent, RegionEvent, CustomElementEvent } from "./layout";
|
|
6
6
|
import { NavigationEvent, PerformanceEvent } from "./performance";
|
|
7
7
|
import { PartialEvent } from "./core";
|
|
@@ -71,6 +71,7 @@ export interface DecodedPayload {
|
|
|
71
71
|
upgrade?: UpgradeEvent[];
|
|
72
72
|
upload?: UploadEvent[];
|
|
73
73
|
visibility?: VisibilityEvent[];
|
|
74
|
+
focus?: FocusEvent[];
|
|
74
75
|
region?: RegionEvent[];
|
|
75
76
|
dom?: DomEvent[];
|
|
76
77
|
doc?: DocumentEvent[];
|
package/types/interaction.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface SubmitEvent extends PartialEvent { data: Interaction.SubmitData
|
|
|
28
28
|
export interface TimelineEvent extends PartialEvent { data: TimelineData; }
|
|
29
29
|
export interface UnloadEvent extends PartialEvent { data: Interaction.UnloadData; }
|
|
30
30
|
export interface VisibilityEvent extends PartialEvent { data: Interaction.VisibilityData; }
|
|
31
|
+
export interface FocusEvent extends PartialEvent { data: Interaction.FocusData; }
|
|
31
32
|
export interface InteractionEvent extends PartialEvent {
|
|
32
33
|
data: ClickData |
|
|
33
34
|
Interaction.ChangeData |
|