@atlaskit/insm 0.1.0 → 0.1.2
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/CHANGELOG.md +15 -0
- package/dist/cjs/inp-measurers/inp.js +1 -1
- package/dist/cjs/insm-session.js +3 -2
- package/dist/cjs/insm.js +17 -18
- package/dist/es2019/inp-measurers/inp.js +1 -1
- package/dist/es2019/insm-session.js +3 -2
- package/dist/es2019/insm.js +17 -18
- package/dist/esm/inp-measurers/inp.js +1 -1
- package/dist/esm/insm-session.js +3 -2
- package/dist/esm/insm.js +17 -18
- package/dist/types/insm-session.d.ts +3 -3
- package/dist/types/insm.d.ts +1 -9
- package/dist/types-ts4.5/insm-session.d.ts +3 -3
- package/dist/types-ts4.5/insm.d.ts +0 -5
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/insm
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cf1cfd5a04c5c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf1cfd5a04c5c) -
|
|
8
|
+
Remove INSM circular dependency
|
|
9
|
+
- [`78573b5014067`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/78573b5014067) -
|
|
10
|
+
Update numerator calculation in INP Measurers
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 0.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -60,7 +60,7 @@ var InteractionResult = /*#__PURE__*/function () {
|
|
|
60
60
|
if (duration < this.min) {
|
|
61
61
|
this.min = duration;
|
|
62
62
|
}
|
|
63
|
-
this.numerator +=
|
|
63
|
+
this.numerator += duration;
|
|
64
64
|
this.count += 1;
|
|
65
65
|
this.average = this.numerator / this.count;
|
|
66
66
|
}
|
package/dist/cjs/insm-session.js
CHANGED
|
@@ -174,8 +174,9 @@ var INSMSession = exports.INSMSession = /*#__PURE__*/function () {
|
|
|
174
174
|
periods: periodResults,
|
|
175
175
|
endDetails: endDetails
|
|
176
176
|
}),
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
highPriority: true,
|
|
178
|
+
tags: ['editor'],
|
|
179
|
+
source: 'unknown'
|
|
179
180
|
};
|
|
180
181
|
(_this$insm$analyticsW = this.insm.analyticsWebClient) === null || _this$insm$analyticsW === void 0 || _this$insm$analyticsW.sendOperationalEvent(operationalEvent);
|
|
181
182
|
}
|
package/dist/cjs/insm.js
CHANGED
|
@@ -21,17 +21,7 @@ var INSM = exports.INSM = /*#__PURE__*/function () {
|
|
|
21
21
|
* page session.
|
|
22
22
|
*/
|
|
23
23
|
(0, _defineProperty2.default)(this, "runningHeavyTasks", new Set());
|
|
24
|
-
this.periodMeasurers = [new _afps.AnimationFPSIM(), new _inp.INPTracker()
|
|
25
|
-
includedInteractions: ['pointerup']
|
|
26
|
-
}), new _inp.INPTracker({
|
|
27
|
-
includedInteractions: ['pointerdown']
|
|
28
|
-
}), new _inp.INPTracker({
|
|
29
|
-
includedInteractions: ['click']
|
|
30
|
-
}), new _inp.INPTracker({
|
|
31
|
-
includedInteractions: ['keydown']
|
|
32
|
-
}), new _inp.INPTracker({
|
|
33
|
-
includedInteractions: ['keyup']
|
|
34
|
-
})];
|
|
24
|
+
this.periodMeasurers = [new _afps.AnimationFPSIM(), new _inp.INPTracker()];
|
|
35
25
|
this.options = options;
|
|
36
26
|
|
|
37
27
|
// If this does throw -- we do want an unhandledRejection rejection to be passed to the window
|
|
@@ -40,14 +30,23 @@ var INSM = exports.INSM = /*#__PURE__*/function () {
|
|
|
40
30
|
return _this.analyticsWebClient = analyticsWebClient;
|
|
41
31
|
});
|
|
42
32
|
|
|
43
|
-
// No cleanup needs to be performed -- as this is intended to run until the tab is closed
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
// No cleanup needs to be performed -- as this tooling is intended to run until the tab is closed
|
|
34
|
+
// The use of beforeunload here is because using pagehide does not reliably result in the analytics
|
|
35
|
+
// being fired by the analytics web client.
|
|
36
|
+
// The use of this means we will miss events from mobile safari which does not reliably call this api
|
|
37
|
+
// however mobile browsers do not call when a browser closes - so we expect limited mobile data from
|
|
38
|
+
// this tooling in its current form.
|
|
39
|
+
|
|
40
|
+
// window will not be defined in server envs - in these envs -- there can never be a session end
|
|
41
|
+
if (typeof window !== 'undefined') {
|
|
42
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
43
|
+
window.addEventListener('beforeunload', function () {
|
|
44
|
+
var _this$runningSession;
|
|
45
|
+
(_this$runningSession = _this.runningSession) === null || _this$runningSession === void 0 || _this$runningSession.end({
|
|
46
|
+
stoppedBy: 'beforeunload'
|
|
47
|
+
});
|
|
49
48
|
});
|
|
50
|
-
}
|
|
49
|
+
}
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
/**
|
|
@@ -141,8 +141,9 @@ export class INSMSession {
|
|
|
141
141
|
periods: periodResults,
|
|
142
142
|
endDetails: endDetails
|
|
143
143
|
},
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
highPriority: true,
|
|
145
|
+
tags: ['editor'],
|
|
146
|
+
source: 'unknown'
|
|
146
147
|
};
|
|
147
148
|
(_this$insm$analyticsW = this.insm.analyticsWebClient) === null || _this$insm$analyticsW === void 0 ? void 0 : _this$insm$analyticsW.sendOperationalEvent(operationalEvent);
|
|
148
149
|
}
|
package/dist/es2019/insm.js
CHANGED
|
@@ -10,31 +10,30 @@ export class INSM {
|
|
|
10
10
|
* page session.
|
|
11
11
|
*/
|
|
12
12
|
_defineProperty(this, "runningHeavyTasks", new Set());
|
|
13
|
-
this.periodMeasurers = [new AnimationFPSIM(), new INPTracker()
|
|
14
|
-
includedInteractions: ['pointerup']
|
|
15
|
-
}), new INPTracker({
|
|
16
|
-
includedInteractions: ['pointerdown']
|
|
17
|
-
}), new INPTracker({
|
|
18
|
-
includedInteractions: ['click']
|
|
19
|
-
}), new INPTracker({
|
|
20
|
-
includedInteractions: ['keydown']
|
|
21
|
-
}), new INPTracker({
|
|
22
|
-
includedInteractions: ['keyup']
|
|
23
|
-
})];
|
|
13
|
+
this.periodMeasurers = [new AnimationFPSIM(), new INPTracker()];
|
|
24
14
|
this.options = options;
|
|
25
15
|
|
|
26
16
|
// If this does throw -- we do want an unhandledRejection rejection to be passed to the window
|
|
27
17
|
// this is to ease debugging.
|
|
28
18
|
options.getAnalyticsWebClient.then(analyticsWebClient => this.analyticsWebClient = analyticsWebClient);
|
|
29
19
|
|
|
30
|
-
// No cleanup needs to be performed -- as this is intended to run until the tab is closed
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
// No cleanup needs to be performed -- as this tooling is intended to run until the tab is closed
|
|
21
|
+
// The use of beforeunload here is because using pagehide does not reliably result in the analytics
|
|
22
|
+
// being fired by the analytics web client.
|
|
23
|
+
// The use of this means we will miss events from mobile safari which does not reliably call this api
|
|
24
|
+
// however mobile browsers do not call when a browser closes - so we expect limited mobile data from
|
|
25
|
+
// this tooling in its current form.
|
|
26
|
+
|
|
27
|
+
// window will not be defined in server envs - in these envs -- there can never be a session end
|
|
28
|
+
if (typeof window !== 'undefined') {
|
|
29
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
30
|
+
window.addEventListener('beforeunload', () => {
|
|
31
|
+
var _this$runningSession;
|
|
32
|
+
(_this$runningSession = this.runningSession) === null || _this$runningSession === void 0 ? void 0 : _this$runningSession.end({
|
|
33
|
+
stoppedBy: 'beforeunload'
|
|
34
|
+
});
|
|
36
35
|
});
|
|
37
|
-
}
|
|
36
|
+
}
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
/**
|
|
@@ -53,7 +53,7 @@ var InteractionResult = /*#__PURE__*/function () {
|
|
|
53
53
|
if (duration < this.min) {
|
|
54
54
|
this.min = duration;
|
|
55
55
|
}
|
|
56
|
-
this.numerator +=
|
|
56
|
+
this.numerator += duration;
|
|
57
57
|
this.count += 1;
|
|
58
58
|
this.average = this.numerator / this.count;
|
|
59
59
|
}
|
package/dist/esm/insm-session.js
CHANGED
|
@@ -168,8 +168,9 @@ export var INSMSession = /*#__PURE__*/function () {
|
|
|
168
168
|
periods: periodResults,
|
|
169
169
|
endDetails: endDetails
|
|
170
170
|
}),
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
highPriority: true,
|
|
172
|
+
tags: ['editor'],
|
|
173
|
+
source: 'unknown'
|
|
173
174
|
};
|
|
174
175
|
(_this$insm$analyticsW = this.insm.analyticsWebClient) === null || _this$insm$analyticsW === void 0 || _this$insm$analyticsW.sendOperationalEvent(operationalEvent);
|
|
175
176
|
}
|
package/dist/esm/insm.js
CHANGED
|
@@ -14,17 +14,7 @@ export var INSM = /*#__PURE__*/function () {
|
|
|
14
14
|
* page session.
|
|
15
15
|
*/
|
|
16
16
|
_defineProperty(this, "runningHeavyTasks", new Set());
|
|
17
|
-
this.periodMeasurers = [new AnimationFPSIM(), new INPTracker()
|
|
18
|
-
includedInteractions: ['pointerup']
|
|
19
|
-
}), new INPTracker({
|
|
20
|
-
includedInteractions: ['pointerdown']
|
|
21
|
-
}), new INPTracker({
|
|
22
|
-
includedInteractions: ['click']
|
|
23
|
-
}), new INPTracker({
|
|
24
|
-
includedInteractions: ['keydown']
|
|
25
|
-
}), new INPTracker({
|
|
26
|
-
includedInteractions: ['keyup']
|
|
27
|
-
})];
|
|
17
|
+
this.periodMeasurers = [new AnimationFPSIM(), new INPTracker()];
|
|
28
18
|
this.options = options;
|
|
29
19
|
|
|
30
20
|
// If this does throw -- we do want an unhandledRejection rejection to be passed to the window
|
|
@@ -33,14 +23,23 @@ export var INSM = /*#__PURE__*/function () {
|
|
|
33
23
|
return _this.analyticsWebClient = analyticsWebClient;
|
|
34
24
|
});
|
|
35
25
|
|
|
36
|
-
// No cleanup needs to be performed -- as this is intended to run until the tab is closed
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
// No cleanup needs to be performed -- as this tooling is intended to run until the tab is closed
|
|
27
|
+
// The use of beforeunload here is because using pagehide does not reliably result in the analytics
|
|
28
|
+
// being fired by the analytics web client.
|
|
29
|
+
// The use of this means we will miss events from mobile safari which does not reliably call this api
|
|
30
|
+
// however mobile browsers do not call when a browser closes - so we expect limited mobile data from
|
|
31
|
+
// this tooling in its current form.
|
|
32
|
+
|
|
33
|
+
// window will not be defined in server envs - in these envs -- there can never be a session end
|
|
34
|
+
if (typeof window !== 'undefined') {
|
|
35
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
36
|
+
window.addEventListener('beforeunload', function () {
|
|
37
|
+
var _this$runningSession;
|
|
38
|
+
(_this$runningSession = _this.runningSession) === null || _this$runningSession === void 0 || _this$runningSession.end({
|
|
39
|
+
stoppedBy: 'beforeunload'
|
|
40
|
+
});
|
|
42
41
|
});
|
|
43
|
-
}
|
|
42
|
+
}
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -78,11 +78,11 @@ export declare class INSMSession {
|
|
|
78
78
|
*/
|
|
79
79
|
earlyStop(reason: string, description?: string): void;
|
|
80
80
|
end(endDetails: {
|
|
81
|
-
stoppedBy: 'new-experience';
|
|
82
|
-
experienceKey: string;
|
|
83
81
|
contentId?: string | null;
|
|
82
|
+
experienceKey: string;
|
|
83
|
+
stoppedBy: 'new-experience';
|
|
84
84
|
} | {
|
|
85
|
-
stoppedBy: '
|
|
85
|
+
stoppedBy: 'beforeunload';
|
|
86
86
|
} | {
|
|
87
87
|
stoppedBy: 'early-stop';
|
|
88
88
|
reason: string;
|
package/dist/types/insm.d.ts
CHANGED
|
@@ -7,15 +7,7 @@ export declare class INSM {
|
|
|
7
7
|
analyticsWebClient?: AnalyticsWebClient;
|
|
8
8
|
runningSession?: INSMSession;
|
|
9
9
|
options: INSMOptions;
|
|
10
|
-
periodMeasurers: [
|
|
11
|
-
AnimationFPSIM,
|
|
12
|
-
INPTracker,
|
|
13
|
-
INPTracker,
|
|
14
|
-
INPTracker,
|
|
15
|
-
INPTracker,
|
|
16
|
-
INPTracker,
|
|
17
|
-
INPTracker
|
|
18
|
-
];
|
|
10
|
+
periodMeasurers: [AnimationFPSIM, INPTracker];
|
|
19
11
|
/**
|
|
20
12
|
* Heavy tasks are tracked at the insm layer as heavy tasks
|
|
21
13
|
* are expected at times to be unrelated to the current
|
|
@@ -78,11 +78,11 @@ export declare class INSMSession {
|
|
|
78
78
|
*/
|
|
79
79
|
earlyStop(reason: string, description?: string): void;
|
|
80
80
|
end(endDetails: {
|
|
81
|
-
stoppedBy: 'new-experience';
|
|
82
|
-
experienceKey: string;
|
|
83
81
|
contentId?: string | null;
|
|
82
|
+
experienceKey: string;
|
|
83
|
+
stoppedBy: 'new-experience';
|
|
84
84
|
} | {
|
|
85
|
-
stoppedBy: '
|
|
85
|
+
stoppedBy: 'beforeunload';
|
|
86
86
|
} | {
|
|
87
87
|
stoppedBy: 'early-stop';
|
|
88
88
|
reason: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/insm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "INSM tooling measures user-perceived interactivity of a page",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,12 +26,9 @@
|
|
|
26
26
|
"atlaskit:src": "src/index.ts",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
29
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
29
|
+
"@atlaskit/tmp-editor-statsig": "^12.5.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@atlaskit/editor-test-helpers": "workspace:^"
|
|
34
|
-
},
|
|
35
32
|
"peerDependencies": {
|
|
36
33
|
"react": "^18.2.0"
|
|
37
34
|
},
|