@atlaskit/react-ufo 3.14.8 → 3.14.9
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 +8 -0
- package/dist/cjs/trace-interaction/index.js +10 -32
- package/dist/cjs/trace-interaction/internal/map-to-interaction-type.js +16 -0
- package/dist/cjs/trace-interaction/internal/trace-ufo-interaction.js +46 -0
- package/dist/cjs/trace-press/index.js +2 -25
- package/dist/es2019/trace-interaction/index.js +4 -31
- package/dist/es2019/trace-interaction/internal/map-to-interaction-type.js +10 -0
- package/dist/es2019/trace-interaction/internal/trace-ufo-interaction.js +39 -0
- package/dist/es2019/trace-press/index.js +2 -25
- package/dist/esm/trace-interaction/index.js +4 -31
- package/dist/esm/trace-interaction/internal/map-to-interaction-type.js +10 -0
- package/dist/esm/trace-interaction/internal/trace-ufo-interaction.js +39 -0
- package/dist/esm/trace-press/index.js +2 -25
- package/dist/types/trace-interaction/index.d.ts +1 -0
- package/dist/types/trace-interaction/internal/map-to-interaction-type.d.ts +2 -0
- package/dist/types/trace-interaction/internal/trace-ufo-interaction.d.ts +3 -0
- package/dist/types-ts4.5/trace-interaction/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-interaction/internal/map-to-interaction-type.d.ts +2 -0
- package/dist/types-ts4.5/trace-interaction/internal/trace-ufo-interaction.d.ts +3 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 3.14.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#180517](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180517)
|
|
8
|
+
[`cba15052f7278`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cba15052f7278) -
|
|
9
|
+
AFO-4101 properly aborting previous interacttion
|
|
10
|
+
|
|
3
11
|
## 3.14.8
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4,46 +4,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _interactionIdContext = require("../interaction-id-context");
|
|
12
|
-
var _interactionMetrics = require("../interaction-metrics");
|
|
13
|
-
var _routeNameContext = _interopRequireDefault(require("../route-name-context"));
|
|
14
|
-
function mapToInteractionType(eventType) {
|
|
15
|
-
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
16
|
-
return 'press';
|
|
17
|
-
}
|
|
18
|
-
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
19
|
-
return 'hover';
|
|
7
|
+
Object.defineProperty(exports, "UNSAFE__DO_NOT_USE_traceUFOInteraction", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _traceUfoInteraction.default;
|
|
20
11
|
}
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
});
|
|
13
|
+
exports.default = void 0;
|
|
14
|
+
var _mapToInteractionType = _interopRequireDefault(require("./internal/map-to-interaction-type"));
|
|
15
|
+
var _traceUfoInteraction = _interopRequireDefault(require("./internal/trace-ufo-interaction"));
|
|
23
16
|
function traceUFOInteraction(name, event) {
|
|
24
17
|
if (!event || !event.isTrusted) {
|
|
25
18
|
return;
|
|
26
19
|
}
|
|
27
|
-
var interactionType =
|
|
20
|
+
var interactionType = (0, _mapToInteractionType.default)(event.type);
|
|
28
21
|
if (!interactionType) {
|
|
29
22
|
// when interactionType is falsy we do not yet support this type of event. should we blow up with throwing error instead?
|
|
30
23
|
return;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
|
-
var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
|
|
34
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
35
|
-
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
36
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if ((0, _coinflip.default)(rate)) {
|
|
41
|
-
var _event$timeStamp;
|
|
42
|
-
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
43
|
-
var startTimestamp = (_event$timeStamp = event.timeStamp) !== null && _event$timeStamp !== void 0 ? _event$timeStamp : performance.now();
|
|
44
|
-
var newId = (0, _uuid.v4)();
|
|
45
|
-
_interactionIdContext.DefaultInteractionID.current = newId;
|
|
46
|
-
(0, _interactionMetrics.addNewInteraction)(newId, name, 'press', startTimestamp, rate, [], _routeNameContext.default.current);
|
|
47
|
-
}
|
|
25
|
+
return (0, _traceUfoInteraction.default)(name, interactionType, event.timeStamp);
|
|
48
26
|
}
|
|
49
27
|
var _default = exports.default = traceUFOInteraction;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function mapToInteractionType(eventType) {
|
|
8
|
+
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
9
|
+
return 'press';
|
|
10
|
+
}
|
|
11
|
+
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
12
|
+
return 'hover';
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
var _default = exports.default = mapToInteractionType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _uuid = require("uuid");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _coinflip = _interopRequireDefault(require("../../coinflip"));
|
|
11
|
+
var _config = require("../../config");
|
|
12
|
+
var _experienceTraceIdContext = require("../../experience-trace-id-context");
|
|
13
|
+
var _interactionIdContext = require("../../interaction-id-context");
|
|
14
|
+
var _interactionMetrics = require("../../interaction-metrics");
|
|
15
|
+
var _routeNameContext = _interopRequireDefault(require("../../route-name-context"));
|
|
16
|
+
function traceUFOInteraction(name, interactionType, startTime) {
|
|
17
|
+
var rate = (0, _config.getInteractionRate)(name, interactionType);
|
|
18
|
+
var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
|
|
19
|
+
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
20
|
+
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
21
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
if ((0, _platformFeatureFlags.fg)('platform_ufo_abort_measurement_fix')) {
|
|
26
|
+
// abort any existing interaction regardless if the next interaction's coinflip returns true or false
|
|
27
|
+
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if ((0, _coinflip.default)(rate)) {
|
|
31
|
+
if (!(0, _platformFeatureFlags.fg)('platform_ufo_abort_measurement_fix')) {
|
|
32
|
+
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
33
|
+
}
|
|
34
|
+
var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
35
|
+
var newId = (0, _uuid.v4)();
|
|
36
|
+
_interactionIdContext.DefaultInteractionID.current = newId;
|
|
37
|
+
|
|
38
|
+
// covered experiences with tracing instrumentation:
|
|
39
|
+
// inline-result.inline-card-create-submit
|
|
40
|
+
(0, _experienceTraceIdContext.setInteractionActiveTrace)(newId, interactionType);
|
|
41
|
+
(0, _interactionMetrics.addNewInteraction)(newId, name, interactionType === 'hover' ? 'press' : interactionType,
|
|
42
|
+
// TODO add dedicated type for hover, might change backend though
|
|
43
|
+
startTimestamp, rate, [], _routeNameContext.default.current, (0, _experienceTraceIdContext.getActiveTrace)());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
var _default = exports.default = traceUFOInteraction;
|
|
@@ -5,31 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _coinflip = _interopRequireDefault(require("../coinflip"));
|
|
10
|
-
var _config = require("../config");
|
|
11
|
-
var _experienceTraceIdContext = require("../experience-trace-id-context");
|
|
12
|
-
var _interactionIdContext = require("../interaction-id-context");
|
|
13
|
-
var _interactionMetrics = require("../interaction-metrics");
|
|
14
|
-
var _routeNameContext = _interopRequireDefault(require("../route-name-context"));
|
|
8
|
+
var _traceUfoInteraction = _interopRequireDefault(require("../trace-interaction/internal/trace-ufo-interaction"));
|
|
15
9
|
function traceUFOPress(name, timestamp) {
|
|
16
|
-
|
|
17
|
-
var pressInteractionsList = (0, _config.getDoNotAbortActivePressInteraction)();
|
|
18
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
19
|
-
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
20
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if ((0, _coinflip.default)(rate)) {
|
|
25
|
-
(0, _interactionMetrics.abortAll)('new_interaction', name);
|
|
26
|
-
var startTimestamp = timestamp !== null && timestamp !== void 0 ? timestamp : performance.now();
|
|
27
|
-
var newId = (0, _uuid.v4)();
|
|
28
|
-
// covered experiences with tracing instrumentation:
|
|
29
|
-
// inline-result.inline-card-create-submit
|
|
30
|
-
(0, _experienceTraceIdContext.setInteractionActiveTrace)(newId, 'press');
|
|
31
|
-
_interactionIdContext.DefaultInteractionID.current = newId;
|
|
32
|
-
(0, _interactionMetrics.addNewInteraction)(newId, name, 'press', startTimestamp, rate, [], _routeNameContext.default.current, (0, _experienceTraceIdContext.getActiveTrace)());
|
|
33
|
-
}
|
|
10
|
+
return (0, _traceUfoInteraction.default)(name, 'press', timestamp);
|
|
34
11
|
}
|
|
35
12
|
var _default = exports.default = traceUFOPress;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { DefaultInteractionID } from '../interaction-id-context';
|
|
5
|
-
import { abortAll, addNewInteraction, getActiveInteraction } from '../interaction-metrics';
|
|
6
|
-
import UFORouteName from '../route-name-context';
|
|
7
|
-
function mapToInteractionType(eventType) {
|
|
8
|
-
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
9
|
-
return 'press';
|
|
10
|
-
}
|
|
11
|
-
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
12
|
-
return 'hover';
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
1
|
+
import mapToInteractionType from './internal/map-to-interaction-type';
|
|
2
|
+
import internal_traceUFOInteraction from './internal/trace-ufo-interaction';
|
|
3
|
+
export { default as UNSAFE__DO_NOT_USE_traceUFOInteraction } from './internal/trace-ufo-interaction';
|
|
16
4
|
function traceUFOInteraction(name, event) {
|
|
17
5
|
if (!event || !event.isTrusted) {
|
|
18
6
|
return;
|
|
@@ -22,21 +10,6 @@ function traceUFOInteraction(name, event) {
|
|
|
22
10
|
// when interactionType is falsy we do not yet support this type of event. should we blow up with throwing error instead?
|
|
23
11
|
return;
|
|
24
12
|
}
|
|
25
|
-
|
|
26
|
-
const pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
27
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
28
|
-
const interaction = getActiveInteraction();
|
|
29
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (coinflip(rate)) {
|
|
34
|
-
var _event$timeStamp;
|
|
35
|
-
abortAll('new_interaction', name);
|
|
36
|
-
const startTimestamp = (_event$timeStamp = event.timeStamp) !== null && _event$timeStamp !== void 0 ? _event$timeStamp : performance.now();
|
|
37
|
-
const newId = createUUID();
|
|
38
|
-
DefaultInteractionID.current = newId;
|
|
39
|
-
addNewInteraction(newId, name, 'press', startTimestamp, rate, [], UFORouteName.current);
|
|
40
|
-
}
|
|
13
|
+
return internal_traceUFOInteraction(name, interactionType, event.timeStamp);
|
|
41
14
|
}
|
|
42
15
|
export default traceUFOInteraction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function mapToInteractionType(eventType) {
|
|
2
|
+
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
3
|
+
return 'press';
|
|
4
|
+
}
|
|
5
|
+
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
6
|
+
return 'hover';
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
export default mapToInteractionType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { v4 as createUUID } from 'uuid';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import coinflip from '../../coinflip';
|
|
4
|
+
import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../../config';
|
|
5
|
+
import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
|
|
6
|
+
import { DefaultInteractionID } from '../../interaction-id-context';
|
|
7
|
+
import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
|
|
8
|
+
import UFORouteName from '../../route-name-context';
|
|
9
|
+
function traceUFOInteraction(name, interactionType, startTime) {
|
|
10
|
+
const rate = getInteractionRate(name, interactionType);
|
|
11
|
+
const pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
12
|
+
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
13
|
+
const interaction = getActiveInteraction();
|
|
14
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (fg('platform_ufo_abort_measurement_fix')) {
|
|
19
|
+
// abort any existing interaction regardless if the next interaction's coinflip returns true or false
|
|
20
|
+
abortAll('new_interaction', name);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (coinflip(rate)) {
|
|
24
|
+
if (!fg('platform_ufo_abort_measurement_fix')) {
|
|
25
|
+
abortAll('new_interaction', name);
|
|
26
|
+
}
|
|
27
|
+
const startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
28
|
+
const newId = createUUID();
|
|
29
|
+
DefaultInteractionID.current = newId;
|
|
30
|
+
|
|
31
|
+
// covered experiences with tracing instrumentation:
|
|
32
|
+
// inline-result.inline-card-create-submit
|
|
33
|
+
setInteractionActiveTrace(newId, interactionType);
|
|
34
|
+
addNewInteraction(newId, name, interactionType === 'hover' ? 'press' : interactionType,
|
|
35
|
+
// TODO add dedicated type for hover, might change backend though
|
|
36
|
+
startTimestamp, rate, [], UFORouteName.current, getActiveTrace());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export default traceUFOInteraction;
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import coinflip from '../coinflip';
|
|
3
|
-
import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../config';
|
|
4
|
-
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
5
|
-
import { DefaultInteractionID } from '../interaction-id-context';
|
|
6
|
-
import { abortAll, addNewInteraction, getActiveInteraction } from '../interaction-metrics';
|
|
7
|
-
import UFORouteName from '../route-name-context';
|
|
1
|
+
import { default as internal_traceUFOInteraction } from '../trace-interaction/internal/trace-ufo-interaction';
|
|
8
2
|
function traceUFOPress(name, timestamp) {
|
|
9
|
-
|
|
10
|
-
const pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
11
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
12
|
-
const interaction = getActiveInteraction();
|
|
13
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (coinflip(rate)) {
|
|
18
|
-
abortAll('new_interaction', name);
|
|
19
|
-
const startTimestamp = timestamp !== null && timestamp !== void 0 ? timestamp : performance.now();
|
|
20
|
-
const newId = createUUID();
|
|
21
|
-
// covered experiences with tracing instrumentation:
|
|
22
|
-
// inline-result.inline-card-create-submit
|
|
23
|
-
setInteractionActiveTrace(newId, 'press');
|
|
24
|
-
DefaultInteractionID.current = newId;
|
|
25
|
-
addNewInteraction(newId, name, 'press', startTimestamp, rate, [], UFORouteName.current, getActiveTrace());
|
|
26
|
-
}
|
|
3
|
+
return internal_traceUFOInteraction(name, 'press', timestamp);
|
|
27
4
|
}
|
|
28
5
|
export default traceUFOPress;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { DefaultInteractionID } from '../interaction-id-context';
|
|
5
|
-
import { abortAll, addNewInteraction, getActiveInteraction } from '../interaction-metrics';
|
|
6
|
-
import UFORouteName from '../route-name-context';
|
|
7
|
-
function mapToInteractionType(eventType) {
|
|
8
|
-
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
9
|
-
return 'press';
|
|
10
|
-
}
|
|
11
|
-
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
12
|
-
return 'hover';
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
1
|
+
import mapToInteractionType from './internal/map-to-interaction-type';
|
|
2
|
+
import internal_traceUFOInteraction from './internal/trace-ufo-interaction';
|
|
3
|
+
export { default as UNSAFE__DO_NOT_USE_traceUFOInteraction } from './internal/trace-ufo-interaction';
|
|
16
4
|
function traceUFOInteraction(name, event) {
|
|
17
5
|
if (!event || !event.isTrusted) {
|
|
18
6
|
return;
|
|
@@ -22,21 +10,6 @@ function traceUFOInteraction(name, event) {
|
|
|
22
10
|
// when interactionType is falsy we do not yet support this type of event. should we blow up with throwing error instead?
|
|
23
11
|
return;
|
|
24
12
|
}
|
|
25
|
-
|
|
26
|
-
var pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
27
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
28
|
-
var interaction = getActiveInteraction();
|
|
29
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (coinflip(rate)) {
|
|
34
|
-
var _event$timeStamp;
|
|
35
|
-
abortAll('new_interaction', name);
|
|
36
|
-
var startTimestamp = (_event$timeStamp = event.timeStamp) !== null && _event$timeStamp !== void 0 ? _event$timeStamp : performance.now();
|
|
37
|
-
var newId = createUUID();
|
|
38
|
-
DefaultInteractionID.current = newId;
|
|
39
|
-
addNewInteraction(newId, name, 'press', startTimestamp, rate, [], UFORouteName.current);
|
|
40
|
-
}
|
|
13
|
+
return internal_traceUFOInteraction(name, interactionType, event.timeStamp);
|
|
41
14
|
}
|
|
42
15
|
export default traceUFOInteraction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function mapToInteractionType(eventType) {
|
|
2
|
+
if (eventType === 'click' || eventType === 'dblclick' || eventType === 'mousedown') {
|
|
3
|
+
return 'press';
|
|
4
|
+
}
|
|
5
|
+
if (eventType === 'mouseenter' || eventType === 'mouseover') {
|
|
6
|
+
return 'hover';
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
export default mapToInteractionType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { v4 as createUUID } from 'uuid';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import coinflip from '../../coinflip';
|
|
4
|
+
import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../../config';
|
|
5
|
+
import { getActiveTrace, setInteractionActiveTrace } from '../../experience-trace-id-context';
|
|
6
|
+
import { DefaultInteractionID } from '../../interaction-id-context';
|
|
7
|
+
import { abortAll, addNewInteraction, getActiveInteraction } from '../../interaction-metrics';
|
|
8
|
+
import UFORouteName from '../../route-name-context';
|
|
9
|
+
function traceUFOInteraction(name, interactionType, startTime) {
|
|
10
|
+
var rate = getInteractionRate(name, interactionType);
|
|
11
|
+
var pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
12
|
+
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
13
|
+
var interaction = getActiveInteraction();
|
|
14
|
+
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (fg('platform_ufo_abort_measurement_fix')) {
|
|
19
|
+
// abort any existing interaction regardless if the next interaction's coinflip returns true or false
|
|
20
|
+
abortAll('new_interaction', name);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (coinflip(rate)) {
|
|
24
|
+
if (!fg('platform_ufo_abort_measurement_fix')) {
|
|
25
|
+
abortAll('new_interaction', name);
|
|
26
|
+
}
|
|
27
|
+
var startTimestamp = startTime !== null && startTime !== void 0 ? startTime : performance.now();
|
|
28
|
+
var newId = createUUID();
|
|
29
|
+
DefaultInteractionID.current = newId;
|
|
30
|
+
|
|
31
|
+
// covered experiences with tracing instrumentation:
|
|
32
|
+
// inline-result.inline-card-create-submit
|
|
33
|
+
setInteractionActiveTrace(newId, interactionType);
|
|
34
|
+
addNewInteraction(newId, name, interactionType === 'hover' ? 'press' : interactionType,
|
|
35
|
+
// TODO add dedicated type for hover, might change backend though
|
|
36
|
+
startTimestamp, rate, [], UFORouteName.current, getActiveTrace());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export default traceUFOInteraction;
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import coinflip from '../coinflip';
|
|
3
|
-
import { getDoNotAbortActivePressInteraction, getInteractionRate } from '../config';
|
|
4
|
-
import { getActiveTrace, setInteractionActiveTrace } from '../experience-trace-id-context';
|
|
5
|
-
import { DefaultInteractionID } from '../interaction-id-context';
|
|
6
|
-
import { abortAll, addNewInteraction, getActiveInteraction } from '../interaction-metrics';
|
|
7
|
-
import UFORouteName from '../route-name-context';
|
|
1
|
+
import { default as internal_traceUFOInteraction } from '../trace-interaction/internal/trace-ufo-interaction';
|
|
8
2
|
function traceUFOPress(name, timestamp) {
|
|
9
|
-
|
|
10
|
-
var pressInteractionsList = getDoNotAbortActivePressInteraction();
|
|
11
|
-
if (pressInteractionsList !== null && pressInteractionsList !== void 0 && pressInteractionsList.includes(name)) {
|
|
12
|
-
var interaction = getActiveInteraction();
|
|
13
|
-
if ((interaction === null || interaction === void 0 ? void 0 : interaction.ufoName) !== 'unknown' && (interaction === null || interaction === void 0 ? void 0 : interaction.type) === 'press') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (coinflip(rate)) {
|
|
18
|
-
abortAll('new_interaction', name);
|
|
19
|
-
var startTimestamp = timestamp !== null && timestamp !== void 0 ? timestamp : performance.now();
|
|
20
|
-
var newId = createUUID();
|
|
21
|
-
// covered experiences with tracing instrumentation:
|
|
22
|
-
// inline-result.inline-card-create-submit
|
|
23
|
-
setInteractionActiveTrace(newId, 'press');
|
|
24
|
-
DefaultInteractionID.current = newId;
|
|
25
|
-
addNewInteraction(newId, name, 'press', startTimestamp, rate, [], UFORouteName.current, getActiveTrace());
|
|
26
|
-
}
|
|
3
|
+
return internal_traceUFOInteraction(name, 'press', timestamp);
|
|
27
4
|
}
|
|
28
5
|
export default traceUFOPress;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.9",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -213,6 +213,9 @@
|
|
|
213
213
|
},
|
|
214
214
|
"platform_ufo_enable_vc_observer_per_interaction": {
|
|
215
215
|
"type": "boolean"
|
|
216
|
+
},
|
|
217
|
+
"platform_ufo_abort_measurement_fix": {
|
|
218
|
+
"type": "boolean"
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
}
|