@atlaskit/editor-plugin-metrics 3.4.4 → 3.4.5
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 +10 -0
- package/dist/cjs/metricsPlugin.js +6 -5
- package/dist/cjs/pm-plugins/main.js +8 -3
- package/dist/es2019/metricsPlugin.js +6 -5
- package/dist/es2019/pm-plugins/main.js +10 -3
- package/dist/esm/metricsPlugin.js +6 -5
- package/dist/esm/pm-plugins/main.js +8 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-metrics
|
|
2
2
|
|
|
3
|
+
## 3.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139089](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/139089)
|
|
8
|
+
[`69dcdc0c4a543`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/69dcdc0c4a543) -
|
|
9
|
+
ED-26588 Start activity session and persist active session when type ahead and element broswer is
|
|
10
|
+
open
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 3.4.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -81,12 +81,13 @@ var metricsPlugin = exports.metricsPlugin = function metricsPlugin(_ref) {
|
|
|
81
81
|
return tr;
|
|
82
82
|
}
|
|
83
83
|
var pluginState = api === null || api === void 0 ? void 0 : api.metrics.sharedState.currentState();
|
|
84
|
+
if (shouldPersistActiveSession && pluginState !== null && pluginState !== void 0 && pluginState.intentToStartEditTime) {
|
|
85
|
+
return tr.setMeta(_main.metricsKey, {
|
|
86
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
87
|
+
});
|
|
88
|
+
}
|
|
84
89
|
if (!pluginState || pluginState.intentToStartEditTime) {
|
|
85
|
-
|
|
86
|
-
return tr.setMeta(_main.metricsKey, {
|
|
87
|
-
shouldPersistActiveSession: shouldPersistActiveSession
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
+
return tr;
|
|
90
91
|
}
|
|
91
92
|
tr.setMeta(_main.metricsKey, {
|
|
92
93
|
intentToStartEditTime: performance.now(),
|
|
@@ -23,6 +23,7 @@ var initialPluginState = exports.initialPluginState = {
|
|
|
23
23
|
activeSessionTime: 0,
|
|
24
24
|
totalActionCount: 0,
|
|
25
25
|
contentSizeChanged: 0,
|
|
26
|
+
shouldPersistActiveSession: undefined,
|
|
26
27
|
timeOfLastTextInput: undefined,
|
|
27
28
|
initialContent: undefined,
|
|
28
29
|
actionTypeCount: {
|
|
@@ -69,7 +70,9 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
69
70
|
var now = performance.now();
|
|
70
71
|
// If there is no intentToStartEditTime and there are no doc changes, return the plugin state
|
|
71
72
|
if (!intentToStartEditTime && !hasDocChanges && !tr.storedMarksSet) {
|
|
72
|
-
return pluginState
|
|
73
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
74
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
75
|
+
});
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
// Set intentToStartEditTime if it is not set and there are doc changes or marks are set
|
|
@@ -80,13 +83,15 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
80
83
|
// Start active session timer if intentToStartEditTime is defined, shouldStartTimer is true and shouldPersistActiveSession is false
|
|
81
84
|
// shouldPersistActiveSession is true when dragging block controls and when insert menu is open as user is interacting with the editor without making doc changes
|
|
82
85
|
// Timer should start when menu closes or dragging stops
|
|
83
|
-
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !
|
|
86
|
+
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !shouldPersistActiveSession) {
|
|
84
87
|
timer.startTimer();
|
|
85
88
|
}
|
|
86
89
|
if (hasDocChanges) {
|
|
87
90
|
timer.startTimer();
|
|
88
91
|
if ((0, _shouldSkipTr.shouldSkipTr)(tr)) {
|
|
89
|
-
return pluginState
|
|
92
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
93
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
94
|
+
});
|
|
90
95
|
}
|
|
91
96
|
var newPluginState = (0, _getNewPluginState.getNewPluginState)({
|
|
92
97
|
now: now,
|
|
@@ -70,12 +70,13 @@ export const metricsPlugin = ({
|
|
|
70
70
|
return tr;
|
|
71
71
|
}
|
|
72
72
|
const pluginState = api === null || api === void 0 ? void 0 : api.metrics.sharedState.currentState();
|
|
73
|
+
if (shouldPersistActiveSession && pluginState !== null && pluginState !== void 0 && pluginState.intentToStartEditTime) {
|
|
74
|
+
return tr.setMeta(metricsKey, {
|
|
75
|
+
shouldPersistActiveSession
|
|
76
|
+
});
|
|
77
|
+
}
|
|
73
78
|
if (!pluginState || pluginState.intentToStartEditTime) {
|
|
74
|
-
|
|
75
|
-
return tr.setMeta(metricsKey, {
|
|
76
|
-
shouldPersistActiveSession: shouldPersistActiveSession
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
+
return tr;
|
|
79
80
|
}
|
|
80
81
|
tr.setMeta(metricsKey, {
|
|
81
82
|
intentToStartEditTime: performance.now(),
|
|
@@ -13,6 +13,7 @@ export const initialPluginState = {
|
|
|
13
13
|
activeSessionTime: 0,
|
|
14
14
|
totalActionCount: 0,
|
|
15
15
|
contentSizeChanged: 0,
|
|
16
|
+
shouldPersistActiveSession: undefined,
|
|
16
17
|
timeOfLastTextInput: undefined,
|
|
17
18
|
initialContent: undefined,
|
|
18
19
|
actionTypeCount: {
|
|
@@ -61,7 +62,10 @@ export const createPlugin = api => {
|
|
|
61
62
|
const now = performance.now();
|
|
62
63
|
// If there is no intentToStartEditTime and there are no doc changes, return the plugin state
|
|
63
64
|
if (!intentToStartEditTime && !hasDocChanges && !tr.storedMarksSet) {
|
|
64
|
-
return
|
|
65
|
+
return {
|
|
66
|
+
...pluginState,
|
|
67
|
+
shouldPersistActiveSession
|
|
68
|
+
};
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
// Set intentToStartEditTime if it is not set and there are doc changes or marks are set
|
|
@@ -72,13 +76,16 @@ export const createPlugin = api => {
|
|
|
72
76
|
// Start active session timer if intentToStartEditTime is defined, shouldStartTimer is true and shouldPersistActiveSession is false
|
|
73
77
|
// shouldPersistActiveSession is true when dragging block controls and when insert menu is open as user is interacting with the editor without making doc changes
|
|
74
78
|
// Timer should start when menu closes or dragging stops
|
|
75
|
-
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !
|
|
79
|
+
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !shouldPersistActiveSession) {
|
|
76
80
|
timer.startTimer();
|
|
77
81
|
}
|
|
78
82
|
if (hasDocChanges) {
|
|
79
83
|
timer.startTimer();
|
|
80
84
|
if (shouldSkipTr(tr)) {
|
|
81
|
-
return
|
|
85
|
+
return {
|
|
86
|
+
...pluginState,
|
|
87
|
+
shouldPersistActiveSession
|
|
88
|
+
};
|
|
82
89
|
}
|
|
83
90
|
const newPluginState = getNewPluginState({
|
|
84
91
|
now,
|
|
@@ -75,12 +75,13 @@ export var metricsPlugin = function metricsPlugin(_ref) {
|
|
|
75
75
|
return tr;
|
|
76
76
|
}
|
|
77
77
|
var pluginState = api === null || api === void 0 ? void 0 : api.metrics.sharedState.currentState();
|
|
78
|
+
if (shouldPersistActiveSession && pluginState !== null && pluginState !== void 0 && pluginState.intentToStartEditTime) {
|
|
79
|
+
return tr.setMeta(metricsKey, {
|
|
80
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
81
|
+
});
|
|
82
|
+
}
|
|
78
83
|
if (!pluginState || pluginState.intentToStartEditTime) {
|
|
79
|
-
|
|
80
|
-
return tr.setMeta(metricsKey, {
|
|
81
|
-
shouldPersistActiveSession: shouldPersistActiveSession
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
+
return tr;
|
|
84
85
|
}
|
|
85
86
|
tr.setMeta(metricsKey, {
|
|
86
87
|
intentToStartEditTime: performance.now(),
|
|
@@ -16,6 +16,7 @@ export var initialPluginState = {
|
|
|
16
16
|
activeSessionTime: 0,
|
|
17
17
|
totalActionCount: 0,
|
|
18
18
|
contentSizeChanged: 0,
|
|
19
|
+
shouldPersistActiveSession: undefined,
|
|
19
20
|
timeOfLastTextInput: undefined,
|
|
20
21
|
initialContent: undefined,
|
|
21
22
|
actionTypeCount: {
|
|
@@ -62,7 +63,9 @@ export var createPlugin = function createPlugin(api) {
|
|
|
62
63
|
var now = performance.now();
|
|
63
64
|
// If there is no intentToStartEditTime and there are no doc changes, return the plugin state
|
|
64
65
|
if (!intentToStartEditTime && !hasDocChanges && !tr.storedMarksSet) {
|
|
65
|
-
return pluginState
|
|
66
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
67
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
68
|
+
});
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
// Set intentToStartEditTime if it is not set and there are doc changes or marks are set
|
|
@@ -73,13 +76,15 @@ export var createPlugin = function createPlugin(api) {
|
|
|
73
76
|
// Start active session timer if intentToStartEditTime is defined, shouldStartTimer is true and shouldPersistActiveSession is false
|
|
74
77
|
// shouldPersistActiveSession is true when dragging block controls and when insert menu is open as user is interacting with the editor without making doc changes
|
|
75
78
|
// Timer should start when menu closes or dragging stops
|
|
76
|
-
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !
|
|
79
|
+
if (intentToStartEditTime && meta !== null && meta !== void 0 && meta.shouldStartTimer && !shouldPersistActiveSession) {
|
|
77
80
|
timer.startTimer();
|
|
78
81
|
}
|
|
79
82
|
if (hasDocChanges) {
|
|
80
83
|
timer.startTimer();
|
|
81
84
|
if (shouldSkipTr(tr)) {
|
|
82
|
-
return pluginState
|
|
85
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
86
|
+
shouldPersistActiveSession: shouldPersistActiveSession
|
|
87
|
+
});
|
|
83
88
|
}
|
|
84
89
|
var newPluginState = getNewPluginState({
|
|
85
90
|
now: now,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-metrics",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "Metrics plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^103.
|
|
36
|
+
"@atlaskit/editor-common": "^103.9.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|