@atlaskit/editor-plugin-collab-edit 3.9.0 → 3.9.1
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 +9 -0
- package/dist/cjs/pm-plugins/actions.js +1 -2
- package/dist/cjs/pm-plugins/main/index.js +1 -2
- package/dist/cjs/pm-plugins/track-step-metrics.js +4 -4
- package/dist/es2019/pm-plugins/track-step-metrics.js +3 -3
- package/dist/esm/pm-plugins/track-step-metrics.js +3 -3
- package/dist/types/pm-plugins/track-step-metrics.d.ts +32 -1
- package/dist/types-ts4.5/pm-plugins/track-step-metrics.d.ts +32 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-collab-edit
|
|
2
2
|
|
|
3
|
+
## 3.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161924](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161924)
|
|
8
|
+
[`ff6dfb15ac9cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ff6dfb15ac9cf) -
|
|
9
|
+
[EDITOR 752] Add Tests
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.9.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -11,8 +11,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
11
11
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
12
12
|
var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
|
|
13
13
|
var _utils = require("./utils");
|
|
14
|
-
function
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
15
|
// Ignored via go/ees005
|
|
17
16
|
// eslint-disable-next-line import/no-namespace
|
|
18
17
|
|
|
@@ -14,8 +14,7 @@ var _analytics2 = require("../analytics");
|
|
|
14
14
|
var _initialize = require("../events/initialize");
|
|
15
15
|
var _pluginKey = require("./plugin-key");
|
|
16
16
|
var _pluginState = require("./plugin-state");
|
|
17
|
-
function
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
18
|
// It is important to get all steps in that package
|
|
20
19
|
|
|
21
20
|
// Ignored via go/ees005
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateStepSessionMetrics = void 0;
|
|
7
|
+
exports.updateStepSessionMetrics = exports.updateActiveSessions = exports.getStepSessionMetrics = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _frontendUtilities = require("@atlaskit/frontend-utilities");
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -23,7 +23,7 @@ var storageClient = new _frontendUtilities.StorageClient(STORAGE_CLIENT_KEY);
|
|
|
23
23
|
* @param steps - The steps to calculate the metrics from.
|
|
24
24
|
* @returns The updated step session metrics for the given session ID.
|
|
25
25
|
*/
|
|
26
|
-
var getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, steps) {
|
|
26
|
+
var getStepSessionMetrics = exports.getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, steps) {
|
|
27
27
|
var _metrics$sessionId;
|
|
28
28
|
var current = (_metrics$sessionId = metrics[sessionId]) !== null && _metrics$sessionId !== void 0 ? _metrics$sessionId : {
|
|
29
29
|
totalStepSize: 0,
|
|
@@ -51,8 +51,8 @@ var getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, s
|
|
|
51
51
|
* @param sessionId - The session ID to check or update in local storage.
|
|
52
52
|
* @returns void
|
|
53
53
|
*/
|
|
54
|
-
var updateActiveSessions = function updateActiveSessions(sessionId) {
|
|
55
|
-
var currentActiveSessions = JSON.parse(storageClient.getItem('
|
|
54
|
+
var updateActiveSessions = exports.updateActiveSessions = function updateActiveSessions(sessionId) {
|
|
55
|
+
var currentActiveSessions = JSON.parse(storageClient.getItem('ncsActiveSessions') || '{}');
|
|
56
56
|
if (!currentActiveSessions[sessionId]) {
|
|
57
57
|
storageClient.setItemWithExpiry('ncsActiveSessions', JSON.stringify(_objectSpread(_objectSpread({}, currentActiveSessions), {}, (0, _defineProperty2.default)({}, sessionId, true))));
|
|
58
58
|
}
|
|
@@ -13,7 +13,7 @@ const storageClient = new StorageClient(STORAGE_CLIENT_KEY);
|
|
|
13
13
|
* @param steps - The steps to calculate the metrics from.
|
|
14
14
|
* @returns The updated step session metrics for the given session ID.
|
|
15
15
|
*/
|
|
16
|
-
const getStepSessionMetrics = (metrics, sessionId, steps) => {
|
|
16
|
+
export const getStepSessionMetrics = (metrics, sessionId, steps) => {
|
|
17
17
|
var _metrics$sessionId;
|
|
18
18
|
const current = (_metrics$sessionId = metrics[sessionId]) !== null && _metrics$sessionId !== void 0 ? _metrics$sessionId : {
|
|
19
19
|
totalStepSize: 0,
|
|
@@ -41,8 +41,8 @@ const getStepSessionMetrics = (metrics, sessionId, steps) => {
|
|
|
41
41
|
* @param sessionId - The session ID to check or update in local storage.
|
|
42
42
|
* @returns void
|
|
43
43
|
*/
|
|
44
|
-
const updateActiveSessions = sessionId => {
|
|
45
|
-
const currentActiveSessions = JSON.parse(storageClient.getItem('
|
|
44
|
+
export const updateActiveSessions = sessionId => {
|
|
45
|
+
const currentActiveSessions = JSON.parse(storageClient.getItem('ncsActiveSessions') || '{}');
|
|
46
46
|
if (!currentActiveSessions[sessionId]) {
|
|
47
47
|
storageClient.setItemWithExpiry('ncsActiveSessions', JSON.stringify({
|
|
48
48
|
...currentActiveSessions,
|
|
@@ -16,7 +16,7 @@ var storageClient = new StorageClient(STORAGE_CLIENT_KEY);
|
|
|
16
16
|
* @param steps - The steps to calculate the metrics from.
|
|
17
17
|
* @returns The updated step session metrics for the given session ID.
|
|
18
18
|
*/
|
|
19
|
-
var getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, steps) {
|
|
19
|
+
export var getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, steps) {
|
|
20
20
|
var _metrics$sessionId;
|
|
21
21
|
var current = (_metrics$sessionId = metrics[sessionId]) !== null && _metrics$sessionId !== void 0 ? _metrics$sessionId : {
|
|
22
22
|
totalStepSize: 0,
|
|
@@ -44,8 +44,8 @@ var getStepSessionMetrics = function getStepSessionMetrics(metrics, sessionId, s
|
|
|
44
44
|
* @param sessionId - The session ID to check or update in local storage.
|
|
45
45
|
* @returns void
|
|
46
46
|
*/
|
|
47
|
-
var updateActiveSessions = function updateActiveSessions(sessionId) {
|
|
48
|
-
var currentActiveSessions = JSON.parse(storageClient.getItem('
|
|
47
|
+
export var updateActiveSessions = function updateActiveSessions(sessionId) {
|
|
48
|
+
var currentActiveSessions = JSON.parse(storageClient.getItem('ncsActiveSessions') || '{}');
|
|
49
49
|
if (!currentActiveSessions[sessionId]) {
|
|
50
50
|
storageClient.setItemWithExpiry('ncsActiveSessions', JSON.stringify(_objectSpread(_objectSpread({}, currentActiveSessions), {}, _defineProperty({}, sessionId, true))));
|
|
51
51
|
}
|
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
+
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { CollabEditPlugin } from '../collabEditPluginType';
|
|
4
|
+
type StepSessionMetrics = {
|
|
5
|
+
totalStepSize: number;
|
|
6
|
+
numberOfSteps: number;
|
|
7
|
+
maxStepSize: number;
|
|
8
|
+
stepSizeSumForP90: number[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Gets the current step session metrics for a given session ID
|
|
12
|
+
* If the session ID does not exist, it initializes a new metrics object.
|
|
13
|
+
* It calculates the total size of the steps, the number of steps,
|
|
14
|
+
* the maximum step size, and the sum of step sizes for P90 calculation.
|
|
15
|
+
*
|
|
16
|
+
* @param metrics - The existing metrics object from local storage.
|
|
17
|
+
* @param sessionId - The session ID for which to get the metrics.
|
|
18
|
+
* @param steps - The steps to calculate the metrics from.
|
|
19
|
+
* @returns The updated step session metrics for the given session ID.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getStepSessionMetrics: (metrics: {
|
|
22
|
+
[sessionId: string]: StepSessionMetrics;
|
|
23
|
+
}, sessionId: string, steps: Step[]) => StepSessionMetrics;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current active sessions from local storage
|
|
26
|
+
* If the session ID does not exist, it initializes a new active session.
|
|
27
|
+
*
|
|
28
|
+
* This is used in the ncsStepMetricsPlugin to determine if the session is still active
|
|
29
|
+
* before sending the ncs steps analytics event.
|
|
30
|
+
*
|
|
31
|
+
* @param sessionId - The session ID to check or update in local storage.
|
|
32
|
+
* @returns void
|
|
33
|
+
*/
|
|
34
|
+
export declare const updateActiveSessions: (sessionId: string) => void;
|
|
4
35
|
type UpdateStepSessionMetricProps = {
|
|
5
36
|
api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
6
37
|
steps: Step[];
|
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
2
|
+
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
3
3
|
import { CollabEditPlugin } from '../collabEditPluginType';
|
|
4
|
+
type StepSessionMetrics = {
|
|
5
|
+
totalStepSize: number;
|
|
6
|
+
numberOfSteps: number;
|
|
7
|
+
maxStepSize: number;
|
|
8
|
+
stepSizeSumForP90: number[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Gets the current step session metrics for a given session ID
|
|
12
|
+
* If the session ID does not exist, it initializes a new metrics object.
|
|
13
|
+
* It calculates the total size of the steps, the number of steps,
|
|
14
|
+
* the maximum step size, and the sum of step sizes for P90 calculation.
|
|
15
|
+
*
|
|
16
|
+
* @param metrics - The existing metrics object from local storage.
|
|
17
|
+
* @param sessionId - The session ID for which to get the metrics.
|
|
18
|
+
* @param steps - The steps to calculate the metrics from.
|
|
19
|
+
* @returns The updated step session metrics for the given session ID.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getStepSessionMetrics: (metrics: {
|
|
22
|
+
[sessionId: string]: StepSessionMetrics;
|
|
23
|
+
}, sessionId: string, steps: Step[]) => StepSessionMetrics;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current active sessions from local storage
|
|
26
|
+
* If the session ID does not exist, it initializes a new active session.
|
|
27
|
+
*
|
|
28
|
+
* This is used in the ncsStepMetricsPlugin to determine if the session is still active
|
|
29
|
+
* before sending the ncs steps analytics event.
|
|
30
|
+
*
|
|
31
|
+
* @param sessionId - The session ID to check or update in local storage.
|
|
32
|
+
* @returns void
|
|
33
|
+
*/
|
|
34
|
+
export declare const updateActiveSessions: (sessionId: string) => void;
|
|
4
35
|
type UpdateStepSessionMetricProps = {
|
|
5
36
|
api: ExtractInjectionAPI<CollabEditPlugin> | undefined;
|
|
6
37
|
steps: Step[];
|