@atlaskit/editor-common 110.29.0 → 110.29.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 +16 -0
- package/afm-jira/tsconfig.json +1 -1
- package/dist/cjs/experiences/Experience.js +83 -33
- package/dist/cjs/experiences/ExperienceCheckDomMutation.js +2 -6
- package/dist/cjs/experiences/ExperienceCheckTimeout.js +1 -3
- package/dist/cjs/experiences/consts.js +18 -4
- package/dist/cjs/experiences/experience-state.js +0 -4
- package/dist/cjs/experiences/index.js +6 -0
- package/dist/cjs/experiences/types.js +1 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/annotation/index.js +0 -3
- package/dist/es2019/experiences/Experience.js +86 -33
- package/dist/es2019/experiences/ExperienceCheckDomMutation.js +2 -6
- package/dist/es2019/experiences/ExperienceCheckTimeout.js +1 -3
- package/dist/es2019/experiences/consts.js +17 -3
- package/dist/es2019/experiences/experience-state.js +0 -4
- package/dist/es2019/experiences/index.js +1 -1
- package/dist/es2019/experiences/types.js +0 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/annotation/index.js +0 -3
- package/dist/esm/experiences/Experience.js +84 -34
- package/dist/esm/experiences/ExperienceCheckDomMutation.js +2 -6
- package/dist/esm/experiences/ExperienceCheckTimeout.js +1 -3
- package/dist/esm/experiences/consts.js +17 -3
- package/dist/esm/experiences/experience-state.js +0 -4
- package/dist/esm/experiences/index.js +1 -1
- package/dist/esm/experiences/types.js +0 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/annotation/index.js +0 -3
- package/dist/types/analytics/types/experience-events.d.ts +27 -4
- package/dist/types/analytics/types/mention-events.d.ts +1 -0
- package/dist/types/experiences/Experience.d.ts +67 -15
- package/dist/types/experiences/ExperienceCheck.d.ts +3 -2
- package/dist/types/experiences/ExperienceCheckDomMutation.d.ts +2 -2
- package/dist/types/experiences/ExperienceCheckTimeout.d.ts +1 -1
- package/dist/types/experiences/consts.d.ts +16 -3
- package/dist/types/experiences/experience-state.d.ts +1 -4
- package/dist/types/experiences/index.d.ts +1 -1
- package/dist/types/experiences/types.d.ts +10 -0
- package/dist/types-ts4.5/analytics/types/experience-events.d.ts +27 -4
- package/dist/types-ts4.5/analytics/types/mention-events.d.ts +1 -0
- package/dist/types-ts4.5/experiences/Experience.d.ts +67 -15
- package/dist/types-ts4.5/experiences/ExperienceCheck.d.ts +3 -2
- package/dist/types-ts4.5/experiences/ExperienceCheckDomMutation.d.ts +2 -2
- package/dist/types-ts4.5/experiences/ExperienceCheckTimeout.d.ts +1 -1
- package/dist/types-ts4.5/experiences/consts.d.ts +16 -3
- package/dist/types-ts4.5/experiences/experience-state.d.ts +1 -4
- package/dist/types-ts4.5/experiences/index.d.ts +1 -1
- package/dist/types-ts4.5/experiences/types.d.ts +10 -0
- package/package.json +4 -7
|
@@ -19,13 +19,27 @@ export const EXPERIENCE_FAILURE_REASON = {
|
|
|
19
19
|
DOM_MUTATION_CHECK_ERROR: 'dom-mutation-check-error'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Built-in abort reasons for experiences.
|
|
24
|
+
*
|
|
25
|
+
* These may be used by various ExperienceCheck implementations to
|
|
26
|
+
* provide consistent, well-known abort reasons for analytics and debugging.
|
|
27
|
+
*/
|
|
28
|
+
export const EXPERIENCE_ABORT_REASON = {
|
|
29
|
+
/**
|
|
30
|
+
* Experience was aborted because it was restarted while already in progress
|
|
31
|
+
*/
|
|
32
|
+
RESTARTED: 'restarted'
|
|
33
|
+
};
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* Default sample rate for experienceSampled events.
|
|
24
37
|
* Set to 1 in 1000 (0.001) to balance data collection with event volume.
|
|
25
38
|
*
|
|
26
39
|
* Newly defined experiences should use this default unless they have data
|
|
27
|
-
* to justify a different rate.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
40
|
+
* to justify a different rate.
|
|
41
|
+
*
|
|
42
|
+
* The expectation is that measurements will be gathered after initial
|
|
43
|
+
* instrumentation, then the sample rate can be tuned up to a safe threshold.
|
|
30
44
|
*/
|
|
31
45
|
export const DEFAULT_EXPERIENCE_SAMPLE_RATE = 0.001;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
4
|
export { Experience } from './Experience';
|
|
5
|
-
export { EXPERIENCE_FAILURE_REASON } from './consts';
|
|
5
|
+
export { EXPERIENCE_ABORT_REASON, EXPERIENCE_FAILURE_REASON } from './consts';
|
|
6
6
|
export { ExperienceCheckComposite } from './ExperienceCheckComposite';
|
|
7
7
|
export { ExperienceCheckDomMutation } from './ExperienceCheckDomMutation';
|
|
8
8
|
export { ExperienceCheckTimeout } from './ExperienceCheckTimeout';
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "
|
|
4
|
+
const packageVersion = "0.0.0-development";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "
|
|
17
|
+
const packageVersion = "0.0.0-development";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -214,9 +214,6 @@ export function getAnnotationInlineNodeTypes(state, annotationId) {
|
|
|
214
214
|
Used with the creation of the inline nodes: emoji, status, dates, mentions & inlineCards.
|
|
215
215
|
*/
|
|
216
216
|
export function getAnnotationMarksForPos(pos) {
|
|
217
|
-
if (!fg('editor_inline_comments_paste_insert_nodes')) {
|
|
218
|
-
return undefined;
|
|
219
|
-
}
|
|
220
217
|
const annotationMarks = pos.marks().filter(mark => mark.type === pos.doc.type.schema.marks.annotation);
|
|
221
218
|
return annotationMarks;
|
|
222
219
|
}
|
|
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
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; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
|
|
7
|
-
import { DEFAULT_EXPERIENCE_SAMPLE_RATE } from './consts';
|
|
7
|
+
import { DEFAULT_EXPERIENCE_SAMPLE_RATE, EXPERIENCE_ABORT_REASON } from './consts';
|
|
8
8
|
import { canTransition } from './experience-state';
|
|
9
9
|
import { ExperienceCheckComposite } from './ExperienceCheckComposite';
|
|
10
10
|
export var Experience = /*#__PURE__*/function () {
|
|
@@ -16,14 +16,45 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
16
16
|
* Ensures that every tracked start has corresponding abort/fail/success tracked.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Timestamp (in milliseconds) when the experience transitioned to 'started' state.
|
|
21
|
+
*
|
|
22
|
+
* Used to calculate experience duration. Set via Date.now() when experience starts.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Metadata provided at experience start time to merge into subsequent events.
|
|
27
|
+
*
|
|
28
|
+
* Used to retain experienceStartMethod and other start-specific metadata.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new Experience instance for tracking user experiences.
|
|
33
|
+
*
|
|
34
|
+
* @param id - Unique identifier for the experience
|
|
35
|
+
* @param options - Configuration options for the experience
|
|
36
|
+
* @param options.checks - Experience checks to monitor for completion
|
|
37
|
+
* @param options.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
38
|
+
* @param options.sampleRate - Sample rate for experienceSampled events
|
|
39
|
+
* @param options.metadata - Global metadata to attach to all events
|
|
40
|
+
* @param options.action - Optional sub identifier for the specific experience action
|
|
41
|
+
*/
|
|
19
42
|
function Experience(id, options) {
|
|
20
43
|
var _options$sampleRate;
|
|
21
44
|
_classCallCheck(this, Experience);
|
|
22
45
|
_defineProperty(this, "currentState", 'pending');
|
|
46
|
+
/**
|
|
47
|
+
* Set of experience states that have been seen in the current session.
|
|
48
|
+
*
|
|
49
|
+
* Used to determine if experienceStatusFirstSeen flag should be set in events.
|
|
50
|
+
*/
|
|
23
51
|
_defineProperty(this, "statesSeen", new Set());
|
|
24
52
|
this.id = id;
|
|
25
53
|
this.dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
26
54
|
this.sampleRate = (_options$sampleRate = options.sampleRate) !== null && _options$sampleRate !== void 0 ? _options$sampleRate : DEFAULT_EXPERIENCE_SAMPLE_RATE;
|
|
55
|
+
this.globalMetadata = _objectSpread(_objectSpread({}, options.metadata), {}, {
|
|
56
|
+
experienceAction: options.action
|
|
57
|
+
});
|
|
27
58
|
this.check = new ExperienceCheckComposite(options.checks || []);
|
|
28
59
|
}
|
|
29
60
|
return _createClass(Experience, [{
|
|
@@ -33,17 +64,21 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
33
64
|
this.stopCheck();
|
|
34
65
|
this.check.start(function (_ref) {
|
|
35
66
|
var status = _ref.status,
|
|
67
|
+
reason = _ref.reason,
|
|
36
68
|
metadata = _ref.metadata;
|
|
37
69
|
if (status === 'success') {
|
|
38
70
|
_this.success({
|
|
71
|
+
reason: reason,
|
|
39
72
|
metadata: metadata
|
|
40
73
|
});
|
|
41
74
|
} else if (status === 'abort') {
|
|
42
75
|
_this.abort({
|
|
76
|
+
reason: reason,
|
|
43
77
|
metadata: metadata
|
|
44
78
|
});
|
|
45
79
|
} else if (status === 'failure') {
|
|
46
80
|
_this.failure({
|
|
81
|
+
reason: reason,
|
|
47
82
|
metadata: metadata
|
|
48
83
|
});
|
|
49
84
|
}
|
|
@@ -55,12 +90,13 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
55
90
|
this.check.stop();
|
|
56
91
|
}
|
|
57
92
|
}, {
|
|
58
|
-
key: "
|
|
59
|
-
value: function
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
metadata
|
|
63
|
-
}
|
|
93
|
+
key: "getEndStateMetadata",
|
|
94
|
+
value: function getEndStateMetadata(options) {
|
|
95
|
+
var metadata = _objectSpread({}, options === null || options === void 0 ? void 0 : options.metadata);
|
|
96
|
+
if (options !== null && options !== void 0 && options.reason) {
|
|
97
|
+
metadata.experienceEndReason = options.reason;
|
|
98
|
+
}
|
|
99
|
+
return metadata;
|
|
64
100
|
}
|
|
65
101
|
|
|
66
102
|
/**
|
|
@@ -80,12 +116,20 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
80
116
|
if (!canTransition(this.currentState, toState)) {
|
|
81
117
|
return false;
|
|
82
118
|
}
|
|
83
|
-
this.statesSeen.add(toState);
|
|
84
119
|
this.currentState = toState;
|
|
85
120
|
if (toState === 'started') {
|
|
86
121
|
this.isSampledTrackingEnabled = Math.random() < this.sampleRate;
|
|
122
|
+
this.startTimeMs = Date.now();
|
|
123
|
+
this.startMetadata = metadata;
|
|
87
124
|
}
|
|
88
125
|
this.trackTransition(toState, metadata);
|
|
126
|
+
if (toState === 'started') {
|
|
127
|
+
this.startCheck();
|
|
128
|
+
} else {
|
|
129
|
+
this.stopCheck();
|
|
130
|
+
this.startMetadata = undefined;
|
|
131
|
+
}
|
|
132
|
+
this.statesSeen.add(toState);
|
|
89
133
|
return true;
|
|
90
134
|
}
|
|
91
135
|
|
|
@@ -100,11 +144,13 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
100
144
|
}, {
|
|
101
145
|
key: "trackTransition",
|
|
102
146
|
value: function trackTransition(toState, metadata) {
|
|
103
|
-
var attributes = _objectSpread({
|
|
147
|
+
var attributes = _objectSpread(_objectSpread(_objectSpread({
|
|
104
148
|
experienceKey: this.id,
|
|
105
149
|
experienceStatus: toState,
|
|
106
|
-
|
|
107
|
-
|
|
150
|
+
experienceStatusFirstSeen: !this.statesSeen.has(toState),
|
|
151
|
+
experienceStartTime: this.startTimeMs || 0,
|
|
152
|
+
experienceDuration: this.startTimeMs ? Date.now() - this.startTimeMs : 0
|
|
153
|
+
}, this.globalMetadata), this.startMetadata), metadata);
|
|
108
154
|
var experienceMeasuredEvent = {
|
|
109
155
|
action: ACTION.EXPERIENCE_MEASURED,
|
|
110
156
|
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
@@ -131,31 +177,36 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
131
177
|
* Metadata from options will be merged with metadata provided in subsequent events.
|
|
132
178
|
*
|
|
133
179
|
* @param options - Configuration for starting the experience
|
|
134
|
-
* @param options.metadata - Optional metadata attached to all subsequent events for this started experience
|
|
180
|
+
* @param options.metadata - Optional custom metadata attached to all subsequent events for this started experience
|
|
181
|
+
* @param options.forceRestart - If true and experience already in progress will abort and restart
|
|
182
|
+
* @param options.method - Optional method for experience start, e.g., how the experience was initiated
|
|
135
183
|
*/
|
|
136
184
|
}, {
|
|
137
185
|
key: "start",
|
|
138
186
|
value: function start(options) {
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
|
|
187
|
+
if (options.forceRestart && this.currentState === 'started') {
|
|
188
|
+
this.abort({
|
|
189
|
+
reason: EXPERIENCE_ABORT_REASON.RESTARTED
|
|
190
|
+
});
|
|
142
191
|
}
|
|
192
|
+
return this.transitionTo('started', _objectSpread({
|
|
193
|
+
experienceStartMethod: options.method
|
|
194
|
+
}, options.metadata));
|
|
143
195
|
}
|
|
144
196
|
|
|
145
197
|
/**
|
|
146
198
|
* Marks the experience as successful and stops any ongoing checks.
|
|
147
199
|
*
|
|
148
200
|
* @param options - Configuration for the success event
|
|
149
|
-
* @param options.metadata - Optional metadata attached to the success event
|
|
201
|
+
* @param options.metadata - Optional custom metadata attached to the success event
|
|
202
|
+
* @param options.reason - Optional reason for success
|
|
203
|
+
* @returns false if transition to success state was not valid
|
|
150
204
|
*/
|
|
151
205
|
}, {
|
|
152
206
|
key: "success",
|
|
153
207
|
value: function success(options) {
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
this.stopCheck();
|
|
157
|
-
this.startOptions = undefined;
|
|
158
|
-
}
|
|
208
|
+
var metadata = this.getEndStateMetadata(options);
|
|
209
|
+
return this.transitionTo('succeeded', metadata);
|
|
159
210
|
}
|
|
160
211
|
|
|
161
212
|
/**
|
|
@@ -165,22 +216,22 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
165
216
|
* (e.g., component unmount, navigation). This is neither success nor failure.
|
|
166
217
|
*
|
|
167
218
|
* @param options - Configuration for the abort event
|
|
168
|
-
* @param options.metadata - Optional metadata attached to the abort event
|
|
219
|
+
* @param options.metadata - Optional custom metadata attached to the abort event
|
|
220
|
+
* @param options.reason - Optional reason for abort
|
|
169
221
|
*
|
|
170
222
|
* @example
|
|
171
223
|
* // Abort on component unmount
|
|
172
224
|
* useEffect(() => {
|
|
173
|
-
* return () => experience.abort({ metadata: {
|
|
225
|
+
* return () => experience.abort({ reason: 'unmount', metadata: { someKey: 'someValue' } });
|
|
174
226
|
* }, []);
|
|
227
|
+
*
|
|
228
|
+
* @returns false if transition to aborted state was not valid
|
|
175
229
|
*/
|
|
176
230
|
}, {
|
|
177
231
|
key: "abort",
|
|
178
232
|
value: function abort(options) {
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
this.stopCheck();
|
|
182
|
-
this.startOptions = undefined;
|
|
183
|
-
}
|
|
233
|
+
var metadata = this.getEndStateMetadata(options);
|
|
234
|
+
return this.transitionTo('aborted', metadata);
|
|
184
235
|
}
|
|
185
236
|
|
|
186
237
|
/**
|
|
@@ -189,16 +240,15 @@ export var Experience = /*#__PURE__*/function () {
|
|
|
189
240
|
* Use this for actual failures in the experience flow (e.g., timeout, error conditions).
|
|
190
241
|
*
|
|
191
242
|
* @param options - Configuration for the failure event
|
|
192
|
-
* @param options.metadata - Optional metadata attached to the failure event
|
|
243
|
+
* @param options.metadata - Optional custom metadata attached to the failure event
|
|
244
|
+
* @param options.reason - Optional reason for failure
|
|
245
|
+
* @returns false if transition to failed state was not valid
|
|
193
246
|
*/
|
|
194
247
|
}, {
|
|
195
248
|
key: "failure",
|
|
196
249
|
value: function failure(options) {
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
this.stopCheck();
|
|
200
|
-
this.startOptions = undefined;
|
|
201
|
-
}
|
|
250
|
+
var metadata = this.getEndStateMetadata(options);
|
|
251
|
+
return this.transitionTo('failed', metadata);
|
|
202
252
|
}
|
|
203
253
|
}]);
|
|
204
254
|
}();
|
|
@@ -26,9 +26,7 @@ export var ExperienceCheckDomMutation = /*#__PURE__*/function () {
|
|
|
26
26
|
if (!(config !== null && config !== void 0 && config.target)) {
|
|
27
27
|
callback({
|
|
28
28
|
status: 'failure',
|
|
29
|
-
|
|
30
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
31
|
-
}
|
|
29
|
+
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_TARGET_NOT_FOUND
|
|
32
30
|
});
|
|
33
31
|
return;
|
|
34
32
|
}
|
|
@@ -43,9 +41,7 @@ export var ExperienceCheckDomMutation = /*#__PURE__*/function () {
|
|
|
43
41
|
} catch (error) {
|
|
44
42
|
callback({
|
|
45
43
|
status: 'failure',
|
|
46
|
-
|
|
47
|
-
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_CHECK_ERROR
|
|
48
|
-
}
|
|
44
|
+
reason: EXPERIENCE_FAILURE_REASON.DOM_MUTATION_CHECK_ERROR
|
|
49
45
|
});
|
|
50
46
|
}
|
|
51
47
|
});
|
|
@@ -4,9 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
import { EXPERIENCE_FAILURE_REASON } from './consts';
|
|
5
5
|
var DEFAULT_FAILURE_RESULT = {
|
|
6
6
|
status: 'failure',
|
|
7
|
-
|
|
8
|
-
reason: EXPERIENCE_FAILURE_REASON.TIMEOUT
|
|
9
|
-
}
|
|
7
|
+
reason: EXPERIENCE_FAILURE_REASON.TIMEOUT
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -19,13 +19,27 @@ export var EXPERIENCE_FAILURE_REASON = {
|
|
|
19
19
|
DOM_MUTATION_CHECK_ERROR: 'dom-mutation-check-error'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Built-in abort reasons for experiences.
|
|
24
|
+
*
|
|
25
|
+
* These may be used by various ExperienceCheck implementations to
|
|
26
|
+
* provide consistent, well-known abort reasons for analytics and debugging.
|
|
27
|
+
*/
|
|
28
|
+
export var EXPERIENCE_ABORT_REASON = {
|
|
29
|
+
/**
|
|
30
|
+
* Experience was aborted because it was restarted while already in progress
|
|
31
|
+
*/
|
|
32
|
+
RESTARTED: 'restarted'
|
|
33
|
+
};
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* Default sample rate for experienceSampled events.
|
|
24
37
|
* Set to 1 in 1000 (0.001) to balance data collection with event volume.
|
|
25
38
|
*
|
|
26
39
|
* Newly defined experiences should use this default unless they have data
|
|
27
|
-
* to justify a different rate.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
40
|
+
* to justify a different rate.
|
|
41
|
+
*
|
|
42
|
+
* The expectation is that measurements will be gathered after initial
|
|
43
|
+
* instrumentation, then the sample rate can be tuned up to a safe threshold.
|
|
30
44
|
*/
|
|
31
45
|
export var DEFAULT_EXPERIENCE_SAMPLE_RATE = 0.001;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
4
|
export { Experience } from './Experience';
|
|
5
|
-
export { EXPERIENCE_FAILURE_REASON } from './consts';
|
|
5
|
+
export { EXPERIENCE_ABORT_REASON, EXPERIENCE_FAILURE_REASON } from './consts';
|
|
6
6
|
export { ExperienceCheckComposite } from './ExperienceCheckComposite';
|
|
7
7
|
export { ExperienceCheckDomMutation } from './ExperienceCheckDomMutation';
|
|
8
8
|
export { ExperienceCheckTimeout } from './ExperienceCheckTimeout';
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "
|
|
10
|
+
var packageVersion = "0.0.0-development";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "
|
|
24
|
+
var packageVersion = "0.0.0-development";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -203,9 +203,6 @@ export function getAnnotationInlineNodeTypes(state, annotationId) {
|
|
|
203
203
|
Used with the creation of the inline nodes: emoji, status, dates, mentions & inlineCards.
|
|
204
204
|
*/
|
|
205
205
|
export function getAnnotationMarksForPos(pos) {
|
|
206
|
-
if (!fg('editor_inline_comments_paste_insert_nodes')) {
|
|
207
|
-
return undefined;
|
|
208
|
-
}
|
|
209
206
|
var annotationMarks = pos.marks().filter(function (mark) {
|
|
210
207
|
return mark.type === pos.doc.type.schema.marks.annotation;
|
|
211
208
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ExperienceState } from '../../experiences/
|
|
1
|
+
import type { CustomExperienceMetadata, ExperienceState } from '../../experiences/types';
|
|
2
2
|
import type { ACTION, ACTION_SUBJECT } from './enums';
|
|
3
3
|
import type { OperationalAEP } from './utils';
|
|
4
4
|
/**
|
|
5
5
|
* Experience event attributes for tracking experience state transitions.
|
|
6
6
|
*/
|
|
7
|
-
type ExperienceEventAttributes = {
|
|
8
|
-
[key: string]: unknown;
|
|
7
|
+
export type ExperienceEventAttributes = CustomExperienceMetadata & {
|
|
9
8
|
/**
|
|
10
9
|
* The unique key identifying the experience being tracked.
|
|
11
10
|
*/
|
|
@@ -18,7 +17,31 @@ type ExperienceEventAttributes = {
|
|
|
18
17
|
* Whether this is the first transition to this status for this experience
|
|
19
18
|
* in the current editor session.
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
experienceStatusFirstSeen: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Timestamp when the experience started.
|
|
23
|
+
*
|
|
24
|
+
* Milliseconds since epoch.
|
|
25
|
+
*/
|
|
26
|
+
experienceStartTime: number;
|
|
27
|
+
/**
|
|
28
|
+
* Duration from experience start to current status transition.
|
|
29
|
+
*
|
|
30
|
+
* Measured in milliseconds.
|
|
31
|
+
*/
|
|
32
|
+
experienceDuration: number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional method for experience start, e.g., how the experience was initiated.
|
|
35
|
+
*/
|
|
36
|
+
experienceStartMethod?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional reason for experience end, e.g., abort or failure reason.
|
|
39
|
+
*/
|
|
40
|
+
experienceEndReason?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Optional action that triggered the experience, if applicable.
|
|
43
|
+
*/
|
|
44
|
+
experienceAction?: string;
|
|
22
45
|
};
|
|
23
46
|
/**
|
|
24
47
|
* Event fired on every successful experience state transition.
|
|
@@ -16,6 +16,7 @@ type MentionTypeaheadInviteItemViewedPayload = UIAEP<ACTION.RENDERED, ACTION_SUB
|
|
|
16
16
|
containerId: string;
|
|
17
17
|
objectId: string;
|
|
18
18
|
sessionId: string;
|
|
19
|
+
source: string;
|
|
19
20
|
userRole?: string;
|
|
20
21
|
}, undefined>;
|
|
21
22
|
type MentionTypeaheadInviteItemClickedPayload = UIAEP<ACTION.CLICKED | ACTION.PRESSED, ACTION_SUBJECT.INVITE_ITEM, undefined, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CustomData } from '@atlaskit/ufo';
|
|
2
1
|
import type { DispatchAnalyticsEvent } from '../analytics';
|
|
3
2
|
import type { ExperienceCheck } from './ExperienceCheck';
|
|
3
|
+
import type { CustomExperienceMetadata } from './types';
|
|
4
4
|
type ExperienceOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Checks used to control experience transition to various states.
|
|
@@ -25,20 +25,40 @@ type ExperienceOptions = {
|
|
|
25
25
|
* instrumentation, then the sample rate can be tuned up to a safe threshold.
|
|
26
26
|
*/
|
|
27
27
|
sampleRate?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Optional global metadata to attach to all analytics events for this experience.
|
|
30
|
+
*
|
|
31
|
+
* Can be overridden by metadata provided in individual start/abort/fail/success calls.
|
|
32
|
+
*/
|
|
33
|
+
metadata?: CustomExperienceMetadata;
|
|
34
|
+
/**
|
|
35
|
+
* An optional sub identifier to further classify the specific experience action taken
|
|
36
|
+
*
|
|
37
|
+
* e.g. 'bold' 'bullet' 'insert-table'
|
|
38
|
+
*/
|
|
39
|
+
action?: string;
|
|
28
40
|
};
|
|
29
41
|
type ExperienceStartOptions = {
|
|
30
|
-
metadata?:
|
|
42
|
+
metadata?: CustomExperienceMetadata;
|
|
43
|
+
method?: string;
|
|
44
|
+
forceRestart?: boolean;
|
|
31
45
|
};
|
|
32
46
|
type ExperienceEndOptions = {
|
|
33
|
-
|
|
47
|
+
reason?: string;
|
|
48
|
+
metadata?: CustomExperienceMetadata;
|
|
34
49
|
};
|
|
35
50
|
export declare class Experience {
|
|
36
51
|
private readonly id;
|
|
37
52
|
private readonly dispatchAnalyticsEvent;
|
|
38
53
|
private readonly sampleRate;
|
|
39
|
-
private
|
|
40
|
-
private
|
|
54
|
+
private readonly globalMetadata;
|
|
55
|
+
private readonly check;
|
|
41
56
|
private currentState;
|
|
57
|
+
/**
|
|
58
|
+
* Set of experience states that have been seen in the current session.
|
|
59
|
+
*
|
|
60
|
+
* Used to determine if experienceStatusFirstSeen flag should be set in events.
|
|
61
|
+
*/
|
|
42
62
|
private statesSeen;
|
|
43
63
|
/**
|
|
44
64
|
* Indicates whether sampled tracking is enabled for this current experience session.
|
|
@@ -48,10 +68,33 @@ export declare class Experience {
|
|
|
48
68
|
* Ensures that every tracked start has corresponding abort/fail/success tracked.
|
|
49
69
|
*/
|
|
50
70
|
private isSampledTrackingEnabled;
|
|
71
|
+
/**
|
|
72
|
+
* Timestamp (in milliseconds) when the experience transitioned to 'started' state.
|
|
73
|
+
*
|
|
74
|
+
* Used to calculate experience duration. Set via Date.now() when experience starts.
|
|
75
|
+
*/
|
|
76
|
+
private startTimeMs;
|
|
77
|
+
/**
|
|
78
|
+
* Metadata provided at experience start time to merge into subsequent events.
|
|
79
|
+
*
|
|
80
|
+
* Used to retain experienceStartMethod and other start-specific metadata.
|
|
81
|
+
*/
|
|
82
|
+
private startMetadata;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new Experience instance for tracking user experiences.
|
|
85
|
+
*
|
|
86
|
+
* @param id - Unique identifier for the experience
|
|
87
|
+
* @param options - Configuration options for the experience
|
|
88
|
+
* @param options.checks - Experience checks to monitor for completion
|
|
89
|
+
* @param options.dispatchAnalyticsEvent - Function to dispatch analytics events
|
|
90
|
+
* @param options.sampleRate - Sample rate for experienceSampled events
|
|
91
|
+
* @param options.metadata - Global metadata to attach to all events
|
|
92
|
+
* @param options.action - Optional sub identifier for the specific experience action
|
|
93
|
+
*/
|
|
51
94
|
constructor(id: string, options: ExperienceOptions);
|
|
52
95
|
private startCheck;
|
|
53
96
|
private stopCheck;
|
|
54
|
-
private
|
|
97
|
+
private getEndStateMetadata;
|
|
55
98
|
/**
|
|
56
99
|
* Transitions to a new experience state and tracks analytics events.
|
|
57
100
|
*
|
|
@@ -79,16 +122,20 @@ export declare class Experience {
|
|
|
79
122
|
* Metadata from options will be merged with metadata provided in subsequent events.
|
|
80
123
|
*
|
|
81
124
|
* @param options - Configuration for starting the experience
|
|
82
|
-
* @param options.metadata - Optional metadata attached to all subsequent events for this started experience
|
|
125
|
+
* @param options.metadata - Optional custom metadata attached to all subsequent events for this started experience
|
|
126
|
+
* @param options.forceRestart - If true and experience already in progress will abort and restart
|
|
127
|
+
* @param options.method - Optional method for experience start, e.g., how the experience was initiated
|
|
83
128
|
*/
|
|
84
|
-
start(options
|
|
129
|
+
start(options: ExperienceStartOptions): boolean;
|
|
85
130
|
/**
|
|
86
131
|
* Marks the experience as successful and stops any ongoing checks.
|
|
87
132
|
*
|
|
88
133
|
* @param options - Configuration for the success event
|
|
89
|
-
* @param options.metadata - Optional metadata attached to the success event
|
|
134
|
+
* @param options.metadata - Optional custom metadata attached to the success event
|
|
135
|
+
* @param options.reason - Optional reason for success
|
|
136
|
+
* @returns false if transition to success state was not valid
|
|
90
137
|
*/
|
|
91
|
-
success(options?: ExperienceEndOptions):
|
|
138
|
+
success(options?: ExperienceEndOptions): boolean;
|
|
92
139
|
/**
|
|
93
140
|
* Aborts the experience and stops any ongoing checks.
|
|
94
141
|
*
|
|
@@ -96,23 +143,28 @@ export declare class Experience {
|
|
|
96
143
|
* (e.g., component unmount, navigation). This is neither success nor failure.
|
|
97
144
|
*
|
|
98
145
|
* @param options - Configuration for the abort event
|
|
99
|
-
* @param options.metadata - Optional metadata attached to the abort event
|
|
146
|
+
* @param options.metadata - Optional custom metadata attached to the abort event
|
|
147
|
+
* @param options.reason - Optional reason for abort
|
|
100
148
|
*
|
|
101
149
|
* @example
|
|
102
150
|
* // Abort on component unmount
|
|
103
151
|
* useEffect(() => {
|
|
104
|
-
* return () => experience.abort({ metadata: {
|
|
152
|
+
* return () => experience.abort({ reason: 'unmount', metadata: { someKey: 'someValue' } });
|
|
105
153
|
* }, []);
|
|
154
|
+
*
|
|
155
|
+
* @returns false if transition to aborted state was not valid
|
|
106
156
|
*/
|
|
107
|
-
abort(options?: ExperienceEndOptions):
|
|
157
|
+
abort(options?: ExperienceEndOptions): boolean;
|
|
108
158
|
/**
|
|
109
159
|
* Manually marks the experience as failed and stops any ongoing checks.
|
|
110
160
|
*
|
|
111
161
|
* Use this for actual failures in the experience flow (e.g., timeout, error conditions).
|
|
112
162
|
*
|
|
113
163
|
* @param options - Configuration for the failure event
|
|
114
|
-
* @param options.metadata - Optional metadata attached to the failure event
|
|
164
|
+
* @param options.metadata - Optional custom metadata attached to the failure event
|
|
165
|
+
* @param options.reason - Optional reason for failure
|
|
166
|
+
* @returns false if transition to failed state was not valid
|
|
115
167
|
*/
|
|
116
|
-
failure(options?: ExperienceEndOptions):
|
|
168
|
+
failure(options?: ExperienceEndOptions): boolean;
|
|
117
169
|
}
|
|
118
170
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CustomExperienceMetadata } from './types';
|
|
2
2
|
type ExperienceCheckResultStatus = 'success' | 'failure' | 'abort';
|
|
3
3
|
export type ExperienceCheckResult = {
|
|
4
|
-
metadata?:
|
|
4
|
+
metadata?: CustomExperienceMetadata;
|
|
5
|
+
reason?: string;
|
|
5
6
|
status: ExperienceCheckResultStatus;
|
|
6
7
|
};
|
|
7
8
|
export type ExperienceCheckCallback = (result: ExperienceCheckResult) => void;
|