@atlaskit/editor-plugin-card 0.5.10 → 0.6.0
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 +16 -0
- package/dist/cjs/analytics/events-from-tr.js +1 -0
- package/dist/cjs/pm-plugins/doc.js +12 -3
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +141 -19
- package/dist/es2019/analytics/events-from-tr.js +1 -0
- package/dist/es2019/pm-plugins/doc.js +12 -3
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +146 -13
- package/dist/esm/analytics/events-from-tr.js +1 -0
- package/dist/esm/pm-plugins/doc.js +12 -3
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +141 -19
- package/dist/types/analytics/events-from-tr.d.ts +2 -2
- package/dist/types/analytics/types.d.ts +1 -1
- package/dist/types/pm-plugins/doc.d.ts +9 -8
- package/dist/types/ui/DatasourceModal/index.d.ts +3 -3
- package/dist/types/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
- package/dist/types-ts4.5/analytics/events-from-tr.d.ts +2 -2
- package/dist/types-ts4.5/analytics/types.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +9 -8
- package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +3 -3
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
- package/package.json +3 -3
- package/report.api.md +1 -1
- package/tmp/api-report-tmp.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8b8a309cb62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8b8a309cb62) - Added datasource analytic CRUD events
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 0.5.11
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`37c62369dae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/37c62369dae) - NO-ISSUE Import doc builder types from editor-common
|
|
18
|
+
|
|
3
19
|
## 0.5.10
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -140,6 +140,7 @@ var findChanged = function findChanged(tr, state) {
|
|
|
140
140
|
if (!isUpdate) {
|
|
141
141
|
var _getLinkMetadataFromT = (0, _card.getLinkMetadataFromTransaction)(tr),
|
|
142
142
|
inputMethod = _getLinkMetadataFromT.inputMethod;
|
|
143
|
+
|
|
143
144
|
/**
|
|
144
145
|
* If there is no identifiable input method, and the links inserted and removed appear to be the same,
|
|
145
146
|
* then this transaction likely is not intended to be consided to be the insertion and removal of links
|
|
@@ -430,7 +430,7 @@ var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
|
430
430
|
|
|
431
431
|
// Apply an update to a datasource (aka blockCard) node
|
|
432
432
|
exports.getLinkNodeType = getLinkNodeType;
|
|
433
|
-
var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view) {
|
|
433
|
+
var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view, sourceEvent) {
|
|
434
434
|
var tr = state.tr,
|
|
435
435
|
from = state.selection.from,
|
|
436
436
|
schemaNodes = state.schema.nodes;
|
|
@@ -455,18 +455,23 @@ var updateExistingDatasource = function updateExistingDatasource(state, node, ne
|
|
|
455
455
|
if (isColumnChange || isUrlChange) {
|
|
456
456
|
tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
|
|
457
457
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
458
|
-
action: _analytics.ACTION.UPDATED
|
|
458
|
+
action: _analytics.ACTION.UPDATED,
|
|
459
|
+
sourceEvent: sourceEvent
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
462
|
} else if (newAdf.type === 'inlineCard') {
|
|
462
463
|
// datasource to inline
|
|
463
464
|
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
465
|
+
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
466
|
+
action: _analytics.ACTION.UPDATED,
|
|
467
|
+
sourceEvent: sourceEvent
|
|
468
|
+
});
|
|
464
469
|
}
|
|
465
470
|
(0, _actions.hideDatasourceModal)(tr);
|
|
466
471
|
view.dispatch(tr.scrollIntoView());
|
|
467
472
|
};
|
|
468
473
|
exports.updateExistingDatasource = updateExistingDatasource;
|
|
469
|
-
var insertDatasource = function insertDatasource(state, adf, view) {
|
|
474
|
+
var insertDatasource = function insertDatasource(state, adf, view, sourceEvent) {
|
|
470
475
|
var tr = state.tr,
|
|
471
476
|
from = state.selection.from,
|
|
472
477
|
schemaNodes = state.schema.nodes;
|
|
@@ -478,6 +483,10 @@ var insertDatasource = function insertDatasource(state, adf, view) {
|
|
|
478
483
|
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
479
484
|
newNode && tr.insert(from, newNode);
|
|
480
485
|
(0, _actions.hideDatasourceModal)(tr);
|
|
486
|
+
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
487
|
+
action: _analytics.ACTION.INSERTED,
|
|
488
|
+
sourceEvent: sourceEvent
|
|
489
|
+
});
|
|
481
490
|
view.dispatch(tr.scrollIntoView());
|
|
482
491
|
};
|
|
483
492
|
exports.insertDatasource = insertDatasource;
|
|
@@ -6,39 +6,161 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.DatasourceEventsBinding = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
10
|
var _react = require("react");
|
|
11
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
+
var _linkAnalytics = require("@atlaskit/link-analytics");
|
|
10
13
|
var _types = require("../../analytics/types");
|
|
14
|
+
var _common = require("./common");
|
|
15
|
+
var _excluded = ["node", "nodeContext"],
|
|
16
|
+
_excluded2 = ["node", "nodeContext"],
|
|
17
|
+
_excluded3 = ["node", "nodeContext"];
|
|
18
|
+
function getDatasourceDisplay(datasourceAttrs) {
|
|
19
|
+
var _datasourceAttrs$data;
|
|
20
|
+
return (_datasourceAttrs$data = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data === void 0 ? void 0 : _datasourceAttrs$data.type;
|
|
21
|
+
}
|
|
22
|
+
function getDisplayedColumnCount(datasourceAttrs) {
|
|
23
|
+
var _datasourceAttrs$data2, _datasourceAttrs$data3, _datasourceAttrs$data4, _datasourceAttrs$data5;
|
|
24
|
+
return (_datasourceAttrs$data2 = (_datasourceAttrs$data3 = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data3 === void 0 ? void 0 : (_datasourceAttrs$data4 = _datasourceAttrs$data3.properties) === null || _datasourceAttrs$data4 === void 0 ? void 0 : (_datasourceAttrs$data5 = _datasourceAttrs$data4.columns) === null || _datasourceAttrs$data5 === void 0 ? void 0 : _datasourceAttrs$data5.length) !== null && _datasourceAttrs$data2 !== void 0 ? _datasourceAttrs$data2 : 0;
|
|
25
|
+
}
|
|
26
|
+
function getSearchMethod(creationMethod, metadata) {
|
|
27
|
+
if (creationMethod === 'editor_paste' || creationMethod === 'editor_type') {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
var sourceEvent = metadata.sourceEvent;
|
|
31
|
+
if (sourceEvent instanceof _analyticsNext.UIAnalyticsEvent) {
|
|
32
|
+
var event = sourceEvent;
|
|
33
|
+
return event.payload.searchMethod;
|
|
34
|
+
}
|
|
35
|
+
return 'unknown';
|
|
36
|
+
}
|
|
37
|
+
function getAnalyticAttributesFromNode(datasourceAttrs, metadata) {
|
|
38
|
+
var url = datasourceAttrs.url,
|
|
39
|
+
_datasourceAttrs$data6 = datasourceAttrs.datasource,
|
|
40
|
+
datasourceId = _datasourceAttrs$data6.id,
|
|
41
|
+
parameters = _datasourceAttrs$data6.parameters;
|
|
42
|
+
var display = getDatasourceDisplay(datasourceAttrs);
|
|
43
|
+
var inputMethod = '';
|
|
44
|
+
var actions = [];
|
|
45
|
+
if (metadata.inputMethod) {
|
|
46
|
+
var _getMethod;
|
|
47
|
+
inputMethod = (_getMethod = (0, _common.getMethod)({
|
|
48
|
+
inputMethod: metadata.inputMethod
|
|
49
|
+
})) !== null && _getMethod !== void 0 ? _getMethod : '';
|
|
50
|
+
} else if (metadata.sourceEvent instanceof _analyticsNext.UIAnalyticsEvent) {
|
|
51
|
+
inputMethod = metadata.sourceEvent.payload.inputMethod;
|
|
52
|
+
actions = metadata.sourceEvent.payload.actions;
|
|
53
|
+
}
|
|
54
|
+
var displayedColumnCount = getDisplayedColumnCount(datasourceAttrs);
|
|
55
|
+
var searchMethod = getSearchMethod(inputMethod, metadata);
|
|
56
|
+
return {
|
|
57
|
+
actions: actions,
|
|
58
|
+
inputMethod: inputMethod,
|
|
59
|
+
datasourceId: datasourceId,
|
|
60
|
+
display: display,
|
|
61
|
+
displayedColumnCount: displayedColumnCount,
|
|
62
|
+
parameters: parameters,
|
|
63
|
+
searchMethod: searchMethod,
|
|
64
|
+
url: url
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
11
68
|
/**
|
|
12
69
|
* Subscribes to the events occuring in the card
|
|
13
70
|
* plugin and fires analytics events accordingly
|
|
14
71
|
*/
|
|
15
72
|
var DatasourceEventsBinding = function DatasourceEventsBinding(_ref) {
|
|
16
73
|
var cardPluginEvents = _ref.cardPluginEvents;
|
|
74
|
+
var _useDatasourceLifecyc = (0, _linkAnalytics.useDatasourceLifecycleAnalytics)(),
|
|
75
|
+
datasourceCreated = _useDatasourceLifecyc.datasourceCreated,
|
|
76
|
+
datasourceUpdated = _useDatasourceLifecyc.datasourceUpdated,
|
|
77
|
+
datasourceDeleted = _useDatasourceLifecyc.datasourceDeleted;
|
|
17
78
|
var eventHandlers = (0, _react.useMemo)(function () {
|
|
18
|
-
var
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
79
|
+
var _ref5;
|
|
80
|
+
return _ref5 = {}, (0, _defineProperty2.default)(_ref5, _types.EVENT.CREATED, function (_ref2) {
|
|
81
|
+
var node = _ref2.node,
|
|
82
|
+
nodeContext = _ref2.nodeContext,
|
|
83
|
+
metadata = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
84
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
85
|
+
var actions = attributes.actions,
|
|
86
|
+
inputMethod = attributes.inputMethod,
|
|
87
|
+
datasourceId = attributes.datasourceId,
|
|
88
|
+
display = attributes.display,
|
|
89
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
90
|
+
parameters = attributes.parameters,
|
|
91
|
+
searchMethod = attributes.searchMethod,
|
|
92
|
+
url = attributes.url;
|
|
93
|
+
datasourceCreated({
|
|
94
|
+
datasourceId: datasourceId,
|
|
95
|
+
parameters: parameters,
|
|
96
|
+
url: url
|
|
97
|
+
}, null, {
|
|
98
|
+
actions: actions,
|
|
99
|
+
creationMethod: inputMethod,
|
|
100
|
+
display: display,
|
|
101
|
+
displayedColumnCount: displayedColumnCount,
|
|
102
|
+
nodeContext: nodeContext,
|
|
103
|
+
searchMethod: searchMethod
|
|
104
|
+
});
|
|
105
|
+
}), (0, _defineProperty2.default)(_ref5, _types.EVENT.UPDATED, function (_ref3) {
|
|
106
|
+
var node = _ref3.node,
|
|
107
|
+
nodeContext = _ref3.nodeContext,
|
|
108
|
+
metadata = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
109
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
110
|
+
var actions = attributes.actions,
|
|
111
|
+
datasourceId = attributes.datasourceId,
|
|
112
|
+
display = attributes.display,
|
|
113
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
114
|
+
inputMethod = attributes.inputMethod,
|
|
115
|
+
parameters = attributes.parameters,
|
|
116
|
+
searchMethod = attributes.searchMethod,
|
|
117
|
+
url = attributes.url;
|
|
118
|
+
datasourceUpdated({
|
|
119
|
+
datasourceId: datasourceId,
|
|
120
|
+
parameters: parameters,
|
|
121
|
+
url: url
|
|
122
|
+
}, null, {
|
|
123
|
+
actions: actions,
|
|
124
|
+
display: display,
|
|
125
|
+
displayedColumnCount: displayedColumnCount,
|
|
126
|
+
nodeContext: nodeContext,
|
|
127
|
+
searchMethod: searchMethod,
|
|
128
|
+
updateMethod: inputMethod
|
|
129
|
+
});
|
|
130
|
+
}), (0, _defineProperty2.default)(_ref5, _types.EVENT.DELETED, function (_ref4) {
|
|
131
|
+
var node = _ref4.node,
|
|
132
|
+
nodeContext = _ref4.nodeContext,
|
|
133
|
+
metadata = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
|
|
134
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
135
|
+
var datasourceId = attributes.datasourceId,
|
|
136
|
+
display = attributes.display,
|
|
137
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
138
|
+
inputMethod = attributes.inputMethod,
|
|
139
|
+
parameters = attributes.parameters,
|
|
140
|
+
searchMethod = attributes.searchMethod,
|
|
141
|
+
url = attributes.url;
|
|
142
|
+
datasourceDeleted({
|
|
143
|
+
datasourceId: datasourceId,
|
|
144
|
+
parameters: parameters,
|
|
145
|
+
url: url
|
|
146
|
+
}, null, {
|
|
147
|
+
deleteMethod: inputMethod,
|
|
148
|
+
display: display,
|
|
149
|
+
displayedColumnCount: displayedColumnCount,
|
|
150
|
+
nodeContext: nodeContext,
|
|
151
|
+
searchMethod: searchMethod
|
|
152
|
+
});
|
|
153
|
+
}), _ref5;
|
|
154
|
+
}, [datasourceCreated, datasourceUpdated, datasourceDeleted]);
|
|
33
155
|
|
|
34
156
|
/**
|
|
35
157
|
* Subscribe to datasource events
|
|
36
158
|
*/
|
|
37
159
|
(0, _react.useEffect)(function () {
|
|
38
|
-
var unsubscribe = cardPluginEvents.subscribe(function (
|
|
39
|
-
var event =
|
|
40
|
-
subject =
|
|
41
|
-
data =
|
|
160
|
+
var unsubscribe = cardPluginEvents.subscribe(function (_ref6) {
|
|
161
|
+
var event = _ref6.event,
|
|
162
|
+
subject = _ref6.subject,
|
|
163
|
+
data = _ref6.data;
|
|
42
164
|
if (subject === _types.EVENT_SUBJECT.DATASOURCE) {
|
|
43
165
|
eventHandlers[event](data);
|
|
44
166
|
}
|
|
@@ -123,6 +123,7 @@ export const findChanged = (tr, state) => {
|
|
|
123
123
|
const {
|
|
124
124
|
inputMethod
|
|
125
125
|
} = getLinkMetadataFromTransaction(tr);
|
|
126
|
+
|
|
126
127
|
/**
|
|
127
128
|
* If there is no identifiable input method, and the links inserted and removed appear to be the same,
|
|
128
129
|
* then this transaction likely is not intended to be consided to be the insertion and removal of links
|
|
@@ -394,7 +394,7 @@ export const getLinkNodeType = (appearance, linkNodes) => {
|
|
|
394
394
|
};
|
|
395
395
|
|
|
396
396
|
// Apply an update to a datasource (aka blockCard) node
|
|
397
|
-
export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
397
|
+
export const updateExistingDatasource = (state, node, newAdf, view, sourceEvent) => {
|
|
398
398
|
const {
|
|
399
399
|
tr,
|
|
400
400
|
selection: {
|
|
@@ -420,17 +420,22 @@ export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
|
420
420
|
...newAdf.attrs
|
|
421
421
|
});
|
|
422
422
|
addLinkMetadata(state.selection, tr, {
|
|
423
|
-
action: ACTION.UPDATED
|
|
423
|
+
action: ACTION.UPDATED,
|
|
424
|
+
sourceEvent
|
|
424
425
|
});
|
|
425
426
|
}
|
|
426
427
|
} else if (newAdf.type === 'inlineCard') {
|
|
427
428
|
// datasource to inline
|
|
428
429
|
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
430
|
+
addLinkMetadata(state.selection, tr, {
|
|
431
|
+
action: ACTION.UPDATED,
|
|
432
|
+
sourceEvent
|
|
433
|
+
});
|
|
429
434
|
}
|
|
430
435
|
hideDatasourceModal(tr);
|
|
431
436
|
view.dispatch(tr.scrollIntoView());
|
|
432
437
|
};
|
|
433
|
-
export const insertDatasource = (state, adf, view) => {
|
|
438
|
+
export const insertDatasource = (state, adf, view, sourceEvent) => {
|
|
434
439
|
const {
|
|
435
440
|
tr,
|
|
436
441
|
selection: {
|
|
@@ -450,5 +455,9 @@ export const insertDatasource = (state, adf, view) => {
|
|
|
450
455
|
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
451
456
|
newNode && tr.insert(from, newNode);
|
|
452
457
|
hideDatasourceModal(tr);
|
|
458
|
+
addLinkMetadata(state.selection, tr, {
|
|
459
|
+
action: ACTION.INSERTED,
|
|
460
|
+
sourceEvent
|
|
461
|
+
});
|
|
453
462
|
view.dispatch(tr.scrollIntoView());
|
|
454
463
|
};
|
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { useDatasourceLifecycleAnalytics } from '@atlaskit/link-analytics';
|
|
2
4
|
import { EVENT, EVENT_SUBJECT } from '../../analytics/types';
|
|
5
|
+
import { getMethod } from './common';
|
|
6
|
+
function getDatasourceDisplay(datasourceAttrs) {
|
|
7
|
+
var _datasourceAttrs$data;
|
|
8
|
+
return (_datasourceAttrs$data = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data === void 0 ? void 0 : _datasourceAttrs$data.type;
|
|
9
|
+
}
|
|
10
|
+
function getDisplayedColumnCount(datasourceAttrs) {
|
|
11
|
+
var _datasourceAttrs$data2, _datasourceAttrs$data3, _datasourceAttrs$data4, _datasourceAttrs$data5;
|
|
12
|
+
return (_datasourceAttrs$data2 = (_datasourceAttrs$data3 = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data3 === void 0 ? void 0 : (_datasourceAttrs$data4 = _datasourceAttrs$data3.properties) === null || _datasourceAttrs$data4 === void 0 ? void 0 : (_datasourceAttrs$data5 = _datasourceAttrs$data4.columns) === null || _datasourceAttrs$data5 === void 0 ? void 0 : _datasourceAttrs$data5.length) !== null && _datasourceAttrs$data2 !== void 0 ? _datasourceAttrs$data2 : 0;
|
|
13
|
+
}
|
|
14
|
+
function getSearchMethod(creationMethod, metadata) {
|
|
15
|
+
if (creationMethod === 'editor_paste' || creationMethod === 'editor_type') {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
sourceEvent
|
|
20
|
+
} = metadata;
|
|
21
|
+
if (sourceEvent instanceof UIAnalyticsEvent) {
|
|
22
|
+
const event = sourceEvent;
|
|
23
|
+
return event.payload.searchMethod;
|
|
24
|
+
}
|
|
25
|
+
return 'unknown';
|
|
26
|
+
}
|
|
27
|
+
function getAnalyticAttributesFromNode(datasourceAttrs, metadata) {
|
|
28
|
+
const {
|
|
29
|
+
url,
|
|
30
|
+
datasource: {
|
|
31
|
+
id: datasourceId,
|
|
32
|
+
parameters
|
|
33
|
+
}
|
|
34
|
+
} = datasourceAttrs;
|
|
35
|
+
const display = getDatasourceDisplay(datasourceAttrs);
|
|
36
|
+
let inputMethod = '';
|
|
37
|
+
let actions = [];
|
|
38
|
+
if (metadata.inputMethod) {
|
|
39
|
+
var _getMethod;
|
|
40
|
+
inputMethod = (_getMethod = getMethod({
|
|
41
|
+
inputMethod: metadata.inputMethod
|
|
42
|
+
})) !== null && _getMethod !== void 0 ? _getMethod : '';
|
|
43
|
+
} else if (metadata.sourceEvent instanceof UIAnalyticsEvent) {
|
|
44
|
+
inputMethod = metadata.sourceEvent.payload.inputMethod;
|
|
45
|
+
actions = metadata.sourceEvent.payload.actions;
|
|
46
|
+
}
|
|
47
|
+
const displayedColumnCount = getDisplayedColumnCount(datasourceAttrs);
|
|
48
|
+
const searchMethod = getSearchMethod(inputMethod, metadata);
|
|
49
|
+
return {
|
|
50
|
+
actions,
|
|
51
|
+
inputMethod,
|
|
52
|
+
datasourceId,
|
|
53
|
+
display,
|
|
54
|
+
displayedColumnCount,
|
|
55
|
+
parameters,
|
|
56
|
+
searchMethod,
|
|
57
|
+
url
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
3
61
|
/**
|
|
4
62
|
* Subscribes to the events occuring in the card
|
|
5
63
|
* plugin and fires analytics events accordingly
|
|
@@ -7,25 +65,100 @@ import { EVENT, EVENT_SUBJECT } from '../../analytics/types';
|
|
|
7
65
|
export const DatasourceEventsBinding = ({
|
|
8
66
|
cardPluginEvents
|
|
9
67
|
}) => {
|
|
68
|
+
const {
|
|
69
|
+
datasourceCreated,
|
|
70
|
+
datasourceUpdated,
|
|
71
|
+
datasourceDeleted
|
|
72
|
+
} = useDatasourceLifecycleAnalytics();
|
|
10
73
|
const eventHandlers = useMemo(() => {
|
|
11
74
|
return {
|
|
12
|
-
[EVENT.CREATED]:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
75
|
+
[EVENT.CREATED]: ({
|
|
76
|
+
node,
|
|
77
|
+
nodeContext,
|
|
78
|
+
...metadata
|
|
79
|
+
}) => {
|
|
80
|
+
const attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
81
|
+
const {
|
|
82
|
+
actions,
|
|
83
|
+
inputMethod,
|
|
84
|
+
datasourceId,
|
|
85
|
+
display,
|
|
86
|
+
displayedColumnCount,
|
|
87
|
+
parameters,
|
|
88
|
+
searchMethod,
|
|
89
|
+
url
|
|
90
|
+
} = attributes;
|
|
91
|
+
datasourceCreated({
|
|
92
|
+
datasourceId,
|
|
93
|
+
parameters,
|
|
94
|
+
url
|
|
95
|
+
}, null, {
|
|
96
|
+
actions,
|
|
97
|
+
creationMethod: inputMethod,
|
|
98
|
+
display,
|
|
99
|
+
displayedColumnCount,
|
|
100
|
+
nodeContext: nodeContext,
|
|
101
|
+
searchMethod
|
|
102
|
+
});
|
|
16
103
|
},
|
|
17
|
-
[EVENT.UPDATED]:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
104
|
+
[EVENT.UPDATED]: ({
|
|
105
|
+
node,
|
|
106
|
+
nodeContext,
|
|
107
|
+
...metadata
|
|
108
|
+
}) => {
|
|
109
|
+
const attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
110
|
+
const {
|
|
111
|
+
actions,
|
|
112
|
+
datasourceId,
|
|
113
|
+
display,
|
|
114
|
+
displayedColumnCount,
|
|
115
|
+
inputMethod,
|
|
116
|
+
parameters,
|
|
117
|
+
searchMethod,
|
|
118
|
+
url
|
|
119
|
+
} = attributes;
|
|
120
|
+
datasourceUpdated({
|
|
121
|
+
datasourceId,
|
|
122
|
+
parameters,
|
|
123
|
+
url
|
|
124
|
+
}, null, {
|
|
125
|
+
actions,
|
|
126
|
+
display,
|
|
127
|
+
displayedColumnCount,
|
|
128
|
+
nodeContext: nodeContext,
|
|
129
|
+
searchMethod,
|
|
130
|
+
updateMethod: inputMethod
|
|
131
|
+
});
|
|
21
132
|
},
|
|
22
|
-
[EVENT.DELETED]:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
133
|
+
[EVENT.DELETED]: ({
|
|
134
|
+
node,
|
|
135
|
+
nodeContext,
|
|
136
|
+
...metadata
|
|
137
|
+
}) => {
|
|
138
|
+
const attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
139
|
+
const {
|
|
140
|
+
datasourceId,
|
|
141
|
+
display,
|
|
142
|
+
displayedColumnCount,
|
|
143
|
+
inputMethod,
|
|
144
|
+
parameters,
|
|
145
|
+
searchMethod,
|
|
146
|
+
url
|
|
147
|
+
} = attributes;
|
|
148
|
+
datasourceDeleted({
|
|
149
|
+
datasourceId,
|
|
150
|
+
parameters,
|
|
151
|
+
url
|
|
152
|
+
}, null, {
|
|
153
|
+
deleteMethod: inputMethod,
|
|
154
|
+
display,
|
|
155
|
+
displayedColumnCount,
|
|
156
|
+
nodeContext: nodeContext,
|
|
157
|
+
searchMethod
|
|
158
|
+
});
|
|
26
159
|
}
|
|
27
160
|
};
|
|
28
|
-
}, []);
|
|
161
|
+
}, [datasourceCreated, datasourceUpdated, datasourceDeleted]);
|
|
29
162
|
|
|
30
163
|
/**
|
|
31
164
|
* Subscribe to datasource events
|
|
@@ -133,6 +133,7 @@ export var findChanged = function findChanged(tr, state) {
|
|
|
133
133
|
if (!isUpdate) {
|
|
134
134
|
var _getLinkMetadataFromT = getLinkMetadataFromTransaction(tr),
|
|
135
135
|
inputMethod = _getLinkMetadataFromT.inputMethod;
|
|
136
|
+
|
|
136
137
|
/**
|
|
137
138
|
* If there is no identifiable input method, and the links inserted and removed appear to be the same,
|
|
138
139
|
* then this transaction likely is not intended to be consided to be the insertion and removal of links
|
|
@@ -412,7 +412,7 @@ export var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
|
412
412
|
};
|
|
413
413
|
|
|
414
414
|
// Apply an update to a datasource (aka blockCard) node
|
|
415
|
-
export var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view) {
|
|
415
|
+
export var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view, sourceEvent) {
|
|
416
416
|
var tr = state.tr,
|
|
417
417
|
from = state.selection.from,
|
|
418
418
|
schemaNodes = state.schema.nodes;
|
|
@@ -437,17 +437,22 @@ export var updateExistingDatasource = function updateExistingDatasource(state, n
|
|
|
437
437
|
if (isColumnChange || isUrlChange) {
|
|
438
438
|
tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
|
|
439
439
|
addLinkMetadata(state.selection, tr, {
|
|
440
|
-
action: ACTION.UPDATED
|
|
440
|
+
action: ACTION.UPDATED,
|
|
441
|
+
sourceEvent: sourceEvent
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
444
|
} else if (newAdf.type === 'inlineCard') {
|
|
444
445
|
// datasource to inline
|
|
445
446
|
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
447
|
+
addLinkMetadata(state.selection, tr, {
|
|
448
|
+
action: ACTION.UPDATED,
|
|
449
|
+
sourceEvent: sourceEvent
|
|
450
|
+
});
|
|
446
451
|
}
|
|
447
452
|
hideDatasourceModal(tr);
|
|
448
453
|
view.dispatch(tr.scrollIntoView());
|
|
449
454
|
};
|
|
450
|
-
export var insertDatasource = function insertDatasource(state, adf, view) {
|
|
455
|
+
export var insertDatasource = function insertDatasource(state, adf, view, sourceEvent) {
|
|
451
456
|
var tr = state.tr,
|
|
452
457
|
from = state.selection.from,
|
|
453
458
|
schemaNodes = state.schema.nodes;
|
|
@@ -459,5 +464,9 @@ export var insertDatasource = function insertDatasource(state, adf, view) {
|
|
|
459
464
|
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
460
465
|
newNode && tr.insert(from, newNode);
|
|
461
466
|
hideDatasourceModal(tr);
|
|
467
|
+
addLinkMetadata(state.selection, tr, {
|
|
468
|
+
action: ACTION.INSERTED,
|
|
469
|
+
sourceEvent: sourceEvent
|
|
470
|
+
});
|
|
462
471
|
view.dispatch(tr.scrollIntoView());
|
|
463
472
|
};
|
|
@@ -1,37 +1,159 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["node", "nodeContext"],
|
|
4
|
+
_excluded2 = ["node", "nodeContext"],
|
|
5
|
+
_excluded3 = ["node", "nodeContext"];
|
|
2
6
|
import { useEffect, useMemo } from 'react';
|
|
7
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
8
|
+
import { useDatasourceLifecycleAnalytics } from '@atlaskit/link-analytics';
|
|
3
9
|
import { EVENT, EVENT_SUBJECT } from '../../analytics/types';
|
|
10
|
+
import { getMethod } from './common';
|
|
11
|
+
function getDatasourceDisplay(datasourceAttrs) {
|
|
12
|
+
var _datasourceAttrs$data;
|
|
13
|
+
return (_datasourceAttrs$data = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data === void 0 ? void 0 : _datasourceAttrs$data.type;
|
|
14
|
+
}
|
|
15
|
+
function getDisplayedColumnCount(datasourceAttrs) {
|
|
16
|
+
var _datasourceAttrs$data2, _datasourceAttrs$data3, _datasourceAttrs$data4, _datasourceAttrs$data5;
|
|
17
|
+
return (_datasourceAttrs$data2 = (_datasourceAttrs$data3 = datasourceAttrs.datasource.views[0]) === null || _datasourceAttrs$data3 === void 0 ? void 0 : (_datasourceAttrs$data4 = _datasourceAttrs$data3.properties) === null || _datasourceAttrs$data4 === void 0 ? void 0 : (_datasourceAttrs$data5 = _datasourceAttrs$data4.columns) === null || _datasourceAttrs$data5 === void 0 ? void 0 : _datasourceAttrs$data5.length) !== null && _datasourceAttrs$data2 !== void 0 ? _datasourceAttrs$data2 : 0;
|
|
18
|
+
}
|
|
19
|
+
function getSearchMethod(creationMethod, metadata) {
|
|
20
|
+
if (creationMethod === 'editor_paste' || creationMethod === 'editor_type') {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
var sourceEvent = metadata.sourceEvent;
|
|
24
|
+
if (sourceEvent instanceof UIAnalyticsEvent) {
|
|
25
|
+
var event = sourceEvent;
|
|
26
|
+
return event.payload.searchMethod;
|
|
27
|
+
}
|
|
28
|
+
return 'unknown';
|
|
29
|
+
}
|
|
30
|
+
function getAnalyticAttributesFromNode(datasourceAttrs, metadata) {
|
|
31
|
+
var url = datasourceAttrs.url,
|
|
32
|
+
_datasourceAttrs$data6 = datasourceAttrs.datasource,
|
|
33
|
+
datasourceId = _datasourceAttrs$data6.id,
|
|
34
|
+
parameters = _datasourceAttrs$data6.parameters;
|
|
35
|
+
var display = getDatasourceDisplay(datasourceAttrs);
|
|
36
|
+
var inputMethod = '';
|
|
37
|
+
var actions = [];
|
|
38
|
+
if (metadata.inputMethod) {
|
|
39
|
+
var _getMethod;
|
|
40
|
+
inputMethod = (_getMethod = getMethod({
|
|
41
|
+
inputMethod: metadata.inputMethod
|
|
42
|
+
})) !== null && _getMethod !== void 0 ? _getMethod : '';
|
|
43
|
+
} else if (metadata.sourceEvent instanceof UIAnalyticsEvent) {
|
|
44
|
+
inputMethod = metadata.sourceEvent.payload.inputMethod;
|
|
45
|
+
actions = metadata.sourceEvent.payload.actions;
|
|
46
|
+
}
|
|
47
|
+
var displayedColumnCount = getDisplayedColumnCount(datasourceAttrs);
|
|
48
|
+
var searchMethod = getSearchMethod(inputMethod, metadata);
|
|
49
|
+
return {
|
|
50
|
+
actions: actions,
|
|
51
|
+
inputMethod: inputMethod,
|
|
52
|
+
datasourceId: datasourceId,
|
|
53
|
+
display: display,
|
|
54
|
+
displayedColumnCount: displayedColumnCount,
|
|
55
|
+
parameters: parameters,
|
|
56
|
+
searchMethod: searchMethod,
|
|
57
|
+
url: url
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
4
61
|
/**
|
|
5
62
|
* Subscribes to the events occuring in the card
|
|
6
63
|
* plugin and fires analytics events accordingly
|
|
7
64
|
*/
|
|
8
65
|
export var DatasourceEventsBinding = function DatasourceEventsBinding(_ref) {
|
|
9
66
|
var cardPluginEvents = _ref.cardPluginEvents;
|
|
67
|
+
var _useDatasourceLifecyc = useDatasourceLifecycleAnalytics(),
|
|
68
|
+
datasourceCreated = _useDatasourceLifecyc.datasourceCreated,
|
|
69
|
+
datasourceUpdated = _useDatasourceLifecyc.datasourceUpdated,
|
|
70
|
+
datasourceDeleted = _useDatasourceLifecyc.datasourceDeleted;
|
|
10
71
|
var eventHandlers = useMemo(function () {
|
|
11
|
-
var
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
72
|
+
var _ref5;
|
|
73
|
+
return _ref5 = {}, _defineProperty(_ref5, EVENT.CREATED, function (_ref2) {
|
|
74
|
+
var node = _ref2.node,
|
|
75
|
+
nodeContext = _ref2.nodeContext,
|
|
76
|
+
metadata = _objectWithoutProperties(_ref2, _excluded);
|
|
77
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
78
|
+
var actions = attributes.actions,
|
|
79
|
+
inputMethod = attributes.inputMethod,
|
|
80
|
+
datasourceId = attributes.datasourceId,
|
|
81
|
+
display = attributes.display,
|
|
82
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
83
|
+
parameters = attributes.parameters,
|
|
84
|
+
searchMethod = attributes.searchMethod,
|
|
85
|
+
url = attributes.url;
|
|
86
|
+
datasourceCreated({
|
|
87
|
+
datasourceId: datasourceId,
|
|
88
|
+
parameters: parameters,
|
|
89
|
+
url: url
|
|
90
|
+
}, null, {
|
|
91
|
+
actions: actions,
|
|
92
|
+
creationMethod: inputMethod,
|
|
93
|
+
display: display,
|
|
94
|
+
displayedColumnCount: displayedColumnCount,
|
|
95
|
+
nodeContext: nodeContext,
|
|
96
|
+
searchMethod: searchMethod
|
|
97
|
+
});
|
|
98
|
+
}), _defineProperty(_ref5, EVENT.UPDATED, function (_ref3) {
|
|
99
|
+
var node = _ref3.node,
|
|
100
|
+
nodeContext = _ref3.nodeContext,
|
|
101
|
+
metadata = _objectWithoutProperties(_ref3, _excluded2);
|
|
102
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
103
|
+
var actions = attributes.actions,
|
|
104
|
+
datasourceId = attributes.datasourceId,
|
|
105
|
+
display = attributes.display,
|
|
106
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
107
|
+
inputMethod = attributes.inputMethod,
|
|
108
|
+
parameters = attributes.parameters,
|
|
109
|
+
searchMethod = attributes.searchMethod,
|
|
110
|
+
url = attributes.url;
|
|
111
|
+
datasourceUpdated({
|
|
112
|
+
datasourceId: datasourceId,
|
|
113
|
+
parameters: parameters,
|
|
114
|
+
url: url
|
|
115
|
+
}, null, {
|
|
116
|
+
actions: actions,
|
|
117
|
+
display: display,
|
|
118
|
+
displayedColumnCount: displayedColumnCount,
|
|
119
|
+
nodeContext: nodeContext,
|
|
120
|
+
searchMethod: searchMethod,
|
|
121
|
+
updateMethod: inputMethod
|
|
122
|
+
});
|
|
123
|
+
}), _defineProperty(_ref5, EVENT.DELETED, function (_ref4) {
|
|
124
|
+
var node = _ref4.node,
|
|
125
|
+
nodeContext = _ref4.nodeContext,
|
|
126
|
+
metadata = _objectWithoutProperties(_ref4, _excluded3);
|
|
127
|
+
var attributes = getAnalyticAttributesFromNode(node.attrs, metadata);
|
|
128
|
+
var datasourceId = attributes.datasourceId,
|
|
129
|
+
display = attributes.display,
|
|
130
|
+
displayedColumnCount = attributes.displayedColumnCount,
|
|
131
|
+
inputMethod = attributes.inputMethod,
|
|
132
|
+
parameters = attributes.parameters,
|
|
133
|
+
searchMethod = attributes.searchMethod,
|
|
134
|
+
url = attributes.url;
|
|
135
|
+
datasourceDeleted({
|
|
136
|
+
datasourceId: datasourceId,
|
|
137
|
+
parameters: parameters,
|
|
138
|
+
url: url
|
|
139
|
+
}, null, {
|
|
140
|
+
deleteMethod: inputMethod,
|
|
141
|
+
display: display,
|
|
142
|
+
displayedColumnCount: displayedColumnCount,
|
|
143
|
+
nodeContext: nodeContext,
|
|
144
|
+
searchMethod: searchMethod
|
|
145
|
+
});
|
|
146
|
+
}), _ref5;
|
|
147
|
+
}, [datasourceCreated, datasourceUpdated, datasourceDeleted]);
|
|
26
148
|
|
|
27
149
|
/**
|
|
28
150
|
* Subscribe to datasource events
|
|
29
151
|
*/
|
|
30
152
|
useEffect(function () {
|
|
31
|
-
var unsubscribe = cardPluginEvents.subscribe(function (
|
|
32
|
-
var event =
|
|
33
|
-
subject =
|
|
34
|
-
data =
|
|
153
|
+
var unsubscribe = cardPluginEvents.subscribe(function (_ref6) {
|
|
154
|
+
var event = _ref6.event,
|
|
155
|
+
subject = _ref6.subject,
|
|
156
|
+
data = _ref6.data;
|
|
35
157
|
if (subject === EVENT_SUBJECT.DATASOURCE) {
|
|
36
158
|
eventHandlers[event](data);
|
|
37
159
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { CardPluginEvent, Entity } from './types';
|
|
1
|
+
import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { CardPluginEvent, Entity } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Find the links, smartLinks, datasources that were changed in a transaction
|
|
5
5
|
*/
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import {
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
4
|
-
import { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
10
|
import type { InlineCardAdf } from '@atlaskit/smart-card';
|
|
10
|
-
import { Request } from '../types';
|
|
11
|
+
import type { Request } from '../types';
|
|
11
12
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent) => Command;
|
|
12
13
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
14
|
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Transaction;
|
|
@@ -22,5 +23,5 @@ export type LinkNodes = {
|
|
|
22
23
|
[key in 'inlineCard' | 'blockCard' | 'embedCard']: NodeType;
|
|
23
24
|
};
|
|
24
25
|
export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType;
|
|
25
|
-
export declare const updateExistingDatasource: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
26
|
-
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
26
|
+
export declare const updateExistingDatasource: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
27
|
+
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
type DatasourceModalProps = {
|
|
6
6
|
view: EditorView;
|
|
7
7
|
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
import { CardPluginEvent, Entity } from './types';
|
|
1
|
+
import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { CardPluginEvent, Entity } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Find the links, smartLinks, datasources that were changed in a transaction
|
|
5
5
|
*/
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
-
import {
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
4
|
-
import { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
|
-
import { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
10
|
import type { InlineCardAdf } from '@atlaskit/smart-card';
|
|
10
|
-
import { Request } from '../types';
|
|
11
|
+
import type { Request } from '../types';
|
|
11
12
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent) => Command;
|
|
12
13
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
14
|
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Transaction;
|
|
@@ -22,5 +23,5 @@ export type LinkNodes = {
|
|
|
22
23
|
[key in 'inlineCard' | 'blockCard' | 'embedCard']: NodeType;
|
|
23
24
|
};
|
|
24
25
|
export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType;
|
|
25
|
-
export declare const updateExistingDatasource: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
26
|
-
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
26
|
+
export declare const updateExistingDatasource: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
27
|
+
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
type DatasourceModalProps = {
|
|
6
6
|
view: EditorView;
|
|
7
7
|
editorAnalyticsApi?: EditorAnalyticsAPI;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
46
46
|
"@atlaskit/icon": "^21.12.0",
|
|
47
|
-
"@atlaskit/link-analytics": "^8.
|
|
47
|
+
"@atlaskit/link-analytics": "^8.3.0",
|
|
48
48
|
"@atlaskit/link-datasource": "^1.1.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
50
|
-
"@atlaskit/smart-card": "^26.
|
|
50
|
+
"@atlaskit/smart-card": "^26.26.0",
|
|
51
51
|
"@atlaskit/theme": "^12.6.0",
|
|
52
52
|
"@atlaskit/tokens": "^1.22.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
package/report.api.md
CHANGED
|
@@ -31,7 +31,7 @@ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
|
31
31
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
32
32
|
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
33
33
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
34
|
-
import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
34
|
+
import type { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
35
35
|
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
36
36
|
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
37
37
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
|
20
20
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
21
21
|
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
22
22
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
23
|
-
import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
23
|
+
import type { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
24
24
|
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
25
25
|
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
26
26
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|