@atlaskit/editor-plugin-analytics 2.2.3 → 2.3.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 +18 -0
- package/dist/cjs/analyticsPlugin.js +4 -0
- package/dist/cjs/pm-plugins/analytics-api/editor-state-context.js +1 -1
- package/dist/es2019/analyticsPlugin.js +4 -0
- package/dist/es2019/pm-plugins/analytics-api/editor-state-context.js +1 -1
- package/dist/esm/analyticsPlugin.js +4 -0
- package/dist/esm/pm-plugins/analytics-api/editor-state-context.js +1 -1
- package/dist/types/pm-plugins/analytics-api/editor-state-context.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/analytics-api/editor-state-context.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-analytics
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#149096](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/149096)
|
|
14
|
+
[`831e11ae4484e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/831e11ae4484e) -
|
|
15
|
+
ED-27855 remove duplicate typeahead invoked events
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.2.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -16,6 +16,7 @@ var _isPerformanceApiAvailable = require("@atlaskit/editor-common/is-performance
|
|
|
16
16
|
var _measureRender = require("@atlaskit/editor-common/performance/measure-render");
|
|
17
17
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
18
18
|
var _attachPayloadIntoTransaction = require("./pm-plugins/analytics-api/attach-payload-into-transaction");
|
|
19
|
+
var _editorStateContext = require("./pm-plugins/analytics-api/editor-state-context");
|
|
19
20
|
var _consts = require("./pm-plugins/consts");
|
|
20
21
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
21
22
|
var _undoRedoInputSource = require("./pm-plugins/undo-redo-input-source");
|
|
@@ -157,6 +158,9 @@ var analyticsPlugin = exports.analyticsPlugin = function analyticsPlugin(_ref3)
|
|
|
157
158
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
158
159
|
var _ref6 = (_api$analytics$shared2 = api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.sharedState.currentState()) !== null && _api$analytics$shared2 !== void 0 ? _api$analytics$shared2 : {},
|
|
159
160
|
createAnalyticsEvent = _ref6.createAnalyticsEvent;
|
|
161
|
+
if (options !== null && options !== void 0 && options.context) {
|
|
162
|
+
payload = (0, _editorStateContext.getStateContext)(options.context.selection, payload);
|
|
163
|
+
}
|
|
160
164
|
if (!createAnalyticsEvent) {
|
|
161
165
|
analyticsEventPropQueue.add({
|
|
162
166
|
payload: payload,
|
|
@@ -74,7 +74,7 @@ function getStateContext(selection, payload, tr) {
|
|
|
74
74
|
payload.attributes.selectionPosition = position;
|
|
75
75
|
}
|
|
76
76
|
var insertLocation = (0, _analytics2.findInsertLocation)(selection);
|
|
77
|
-
if (payload.action === _analytics.ACTION.INSERTED && payload.actionSubject !== _analytics.ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== _analytics.ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
77
|
+
if (tr && payload.action === _analytics.ACTION.INSERTED && payload.actionSubject !== _analytics.ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== _analytics.ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
78
78
|
payload.attributes.insertedLocation = findInsertedLocation(selection, tr.selection);
|
|
79
79
|
}
|
|
80
80
|
if (payload.action === _analytics.ACTION.INSERTED && payload.actionSubject === _analytics.ACTION_SUBJECT.DOCUMENT && payload.attributes) {
|
|
@@ -6,6 +6,7 @@ import { isPerformanceAPIAvailable } from '@atlaskit/editor-common/is-performanc
|
|
|
6
6
|
import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
|
|
7
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
8
|
import { createAttachPayloadIntoTransaction } from './pm-plugins/analytics-api/attach-payload-into-transaction';
|
|
9
|
+
import { getStateContext } from './pm-plugins/analytics-api/editor-state-context';
|
|
9
10
|
import { editorAnalyticsChannel } from './pm-plugins/consts';
|
|
10
11
|
import { analyticsPluginKey } from './pm-plugins/plugin-key';
|
|
11
12
|
import { generateUndoRedoInputSoucePayload } from './pm-plugins/undo-redo-input-source';
|
|
@@ -133,6 +134,9 @@ const analyticsPlugin = ({
|
|
|
133
134
|
const {
|
|
134
135
|
createAnalyticsEvent
|
|
135
136
|
} = (_api$analytics$shared2 = api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.sharedState.currentState()) !== null && _api$analytics$shared2 !== void 0 ? _api$analytics$shared2 : {};
|
|
137
|
+
if (options !== null && options !== void 0 && options.context) {
|
|
138
|
+
payload = getStateContext(options.context.selection, payload);
|
|
139
|
+
}
|
|
136
140
|
if (!createAnalyticsEvent) {
|
|
137
141
|
analyticsEventPropQueue.add({
|
|
138
142
|
payload,
|
|
@@ -72,7 +72,7 @@ export function getStateContext(selection, payload, tr) {
|
|
|
72
72
|
payload.attributes.selectionPosition = position;
|
|
73
73
|
}
|
|
74
74
|
const insertLocation = findInsertLocation(selection);
|
|
75
|
-
if (payload.action === ACTION.INSERTED && payload.actionSubject !== ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
75
|
+
if (tr && payload.action === ACTION.INSERTED && payload.actionSubject !== ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
76
76
|
payload.attributes.insertedLocation = findInsertedLocation(selection, tr.selection);
|
|
77
77
|
}
|
|
78
78
|
if (payload.action === ACTION.INSERTED && payload.actionSubject === ACTION_SUBJECT.DOCUMENT && payload.attributes) {
|
|
@@ -13,6 +13,7 @@ import { isPerformanceAPIAvailable } from '@atlaskit/editor-common/is-performanc
|
|
|
13
13
|
import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
|
|
14
14
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
15
15
|
import { createAttachPayloadIntoTransaction } from './pm-plugins/analytics-api/attach-payload-into-transaction';
|
|
16
|
+
import { getStateContext } from './pm-plugins/analytics-api/editor-state-context';
|
|
16
17
|
import { editorAnalyticsChannel } from './pm-plugins/consts';
|
|
17
18
|
import { analyticsPluginKey } from './pm-plugins/plugin-key';
|
|
18
19
|
import { generateUndoRedoInputSoucePayload } from './pm-plugins/undo-redo-input-source';
|
|
@@ -149,6 +150,9 @@ var analyticsPlugin = function analyticsPlugin(_ref3) {
|
|
|
149
150
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
150
151
|
var _ref6 = (_api$analytics$shared2 = api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.sharedState.currentState()) !== null && _api$analytics$shared2 !== void 0 ? _api$analytics$shared2 : {},
|
|
151
152
|
createAnalyticsEvent = _ref6.createAnalyticsEvent;
|
|
153
|
+
if (options !== null && options !== void 0 && options.context) {
|
|
154
|
+
payload = getStateContext(options.context.selection, payload);
|
|
155
|
+
}
|
|
152
156
|
if (!createAnalyticsEvent) {
|
|
153
157
|
analyticsEventPropQueue.add({
|
|
154
158
|
payload: payload,
|
|
@@ -66,7 +66,7 @@ export function getStateContext(selection, payload, tr) {
|
|
|
66
66
|
payload.attributes.selectionPosition = position;
|
|
67
67
|
}
|
|
68
68
|
var insertLocation = findInsertLocation(selection);
|
|
69
|
-
if (payload.action === ACTION.INSERTED && payload.actionSubject !== ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
69
|
+
if (tr && payload.action === ACTION.INSERTED && payload.actionSubject !== ACTION_SUBJECT.ANNOTATION && payload.actionSubject !== ACTION_SUBJECT.EDITOR_PLUGIN_AI) {
|
|
70
70
|
payload.attributes.insertedLocation = findInsertedLocation(selection, tr.selection);
|
|
71
71
|
}
|
|
72
72
|
if (payload.action === ACTION.INSERTED && payload.actionSubject === ACTION_SUBJECT.DOCUMENT && payload.attributes) {
|
|
@@ -6,4 +6,4 @@ export declare function getSelectionType(selection: Selection): {
|
|
|
6
6
|
position?: SELECTION_POSITION;
|
|
7
7
|
};
|
|
8
8
|
export declare function findInsertedLocation(oldSelection: Selection, newSelection: Selection): string;
|
|
9
|
-
export declare function getStateContext(selection: Selection, payload: AnalyticsEventPayload, tr
|
|
9
|
+
export declare function getStateContext(selection: Selection, payload: AnalyticsEventPayload, tr?: Transaction): AnalyticsEventPayload;
|
|
@@ -6,4 +6,4 @@ export declare function getSelectionType(selection: Selection): {
|
|
|
6
6
|
position?: SELECTION_POSITION;
|
|
7
7
|
};
|
|
8
8
|
export declare function findInsertedLocation(oldSelection: Selection, newSelection: Selection): string;
|
|
9
|
-
export declare function getStateContext(selection: Selection, payload: AnalyticsEventPayload, tr
|
|
9
|
+
export declare function getStateContext(selection: Selection, payload: AnalyticsEventPayload, tr?: Transaction): AnalyticsEventPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-analytics",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Analytics plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
35
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^106.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.4.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-tables": "^2.9.0",
|