@atlaskit/react-ufo 4.5.3 → 4.5.5
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 +14 -0
- package/dist/cjs/create-payload/index.js +1 -1
- package/dist/cjs/interaction-metrics/index.js +3 -1
- package/dist/cjs/report-error/index.js +35 -0
- package/dist/es2019/create-payload/index.js +1 -1
- package/dist/es2019/interaction-metrics/index.js +3 -1
- package/dist/es2019/report-error/index.js +30 -0
- package/dist/esm/create-payload/index.js +1 -1
- package/dist/esm/interaction-metrics/index.js +3 -1
- package/dist/esm/report-error/index.js +30 -0
- package/dist/types/report-error/index.d.ts +17 -0
- package/dist/types-ts4.5/report-error/index.d.ts +17 -0
- package/package.json +1 -50
- package/report-error/package.json +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d2a5fe501a90f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2a5fe501a90f) -
|
|
8
|
+
useUFOReportError hook for centrally managed error reporting for UFO
|
|
9
|
+
|
|
10
|
+
## 4.5.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`f438ecb761bb1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f438ecb761bb1) -
|
|
15
|
+
Move check for initial page load earlier for React hydration stats
|
|
16
|
+
|
|
3
17
|
## 4.5.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -714,7 +714,7 @@ function _createInteractionMetricsPayload() {
|
|
|
714
714
|
(0, _addPerformanceMeasures.addPerformanceMeasures)(interaction.start, (0, _toConsumableArray2.default)((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
715
715
|
}
|
|
716
716
|
getReactHydrationStats = function getReactHydrationStats() {
|
|
717
|
-
if (!
|
|
717
|
+
if (!hydration) {
|
|
718
718
|
return {};
|
|
719
719
|
}
|
|
720
720
|
return {
|
|
@@ -696,7 +696,9 @@ function finishInteraction(id, data) {
|
|
|
696
696
|
data.vc = observer.getVCRawData();
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
data.
|
|
699
|
+
if (data.type === 'page_load') {
|
|
700
|
+
data.hydration = (0, _config.getReactHydrationStats)();
|
|
701
|
+
}
|
|
700
702
|
|
|
701
703
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
702
704
|
var sanitisedUfoName = (0, _utils.sanitizeUfoName)(data.ufoName);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useUFOReportError = useUFOReportError;
|
|
7
|
+
var _interactionContext = require("../interaction-context");
|
|
8
|
+
var _interactionMetrics = require("../interaction-metrics");
|
|
9
|
+
/**
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```
|
|
12
|
+
* import { useUFOReportError } from '@atlaskit/react-ufo/use-error-handler';
|
|
13
|
+
*
|
|
14
|
+
* const reportError = useUFOReportError();
|
|
15
|
+
*
|
|
16
|
+
* try {
|
|
17
|
+
* // something that can throw an error
|
|
18
|
+
* } catch (error) {
|
|
19
|
+
* reportError(error)
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
* @returns `reportError` function
|
|
23
|
+
*/
|
|
24
|
+
function useUFOReportError() {
|
|
25
|
+
var interaction = (0, _interactionMetrics.getActiveInteraction)();
|
|
26
|
+
var ufoContext = (0, _interactionContext.useInteractionContext)();
|
|
27
|
+
var reportError = function reportError(error) {
|
|
28
|
+
if (interaction !== null && interaction !== void 0 && interaction.id) {
|
|
29
|
+
(0, _interactionMetrics.addError)(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
|
|
30
|
+
} else {
|
|
31
|
+
(0, _interactionMetrics.addErrorToAll)(error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return reportError;
|
|
35
|
+
}
|
|
@@ -699,7 +699,7 @@ async function createInteractionMetricsPayload(interaction, interactionId, exper
|
|
|
699
699
|
addPerformanceMeasures(interaction.start, [...((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || [])]);
|
|
700
700
|
}
|
|
701
701
|
const getReactHydrationStats = () => {
|
|
702
|
-
if (!
|
|
702
|
+
if (!hydration) {
|
|
703
703
|
return {};
|
|
704
704
|
}
|
|
705
705
|
return {
|
|
@@ -614,7 +614,9 @@ function finishInteraction(id, data, endTime = performance.now()) {
|
|
|
614
614
|
data.vc = observer.getVCRawData();
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
data.
|
|
617
|
+
if (data.type === 'page_load') {
|
|
618
|
+
data.hydration = getReactHydrationStats();
|
|
619
|
+
}
|
|
618
620
|
|
|
619
621
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
620
622
|
const sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useInteractionContext } from '../interaction-context';
|
|
2
|
+
import { addError, addErrorToAll, getActiveInteraction } from '../interaction-metrics';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Usage:
|
|
6
|
+
* ```
|
|
7
|
+
* import { useUFOReportError } from '@atlaskit/react-ufo/use-error-handler';
|
|
8
|
+
*
|
|
9
|
+
* const reportError = useUFOReportError();
|
|
10
|
+
*
|
|
11
|
+
* try {
|
|
12
|
+
* // something that can throw an error
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* reportError(error)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* @returns `reportError` function
|
|
18
|
+
*/
|
|
19
|
+
export function useUFOReportError() {
|
|
20
|
+
const interaction = getActiveInteraction();
|
|
21
|
+
const ufoContext = useInteractionContext();
|
|
22
|
+
const reportError = error => {
|
|
23
|
+
if (interaction !== null && interaction !== void 0 && interaction.id) {
|
|
24
|
+
addError(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
|
|
25
|
+
} else {
|
|
26
|
+
addErrorToAll(error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return reportError;
|
|
30
|
+
}
|
|
@@ -705,7 +705,7 @@ function _createInteractionMetricsPayload() {
|
|
|
705
705
|
addPerformanceMeasures(interaction.start, _toConsumableArray((finalVCMetrics === null || finalVCMetrics === void 0 ? void 0 : finalVCMetrics['ufo:vc:rev']) || []));
|
|
706
706
|
}
|
|
707
707
|
getReactHydrationStats = function getReactHydrationStats() {
|
|
708
|
-
if (!
|
|
708
|
+
if (!hydration) {
|
|
709
709
|
return {};
|
|
710
710
|
}
|
|
711
711
|
return {
|
|
@@ -650,7 +650,9 @@ function finishInteraction(id, data) {
|
|
|
650
650
|
data.vc = observer.getVCRawData();
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
data.
|
|
653
|
+
if (data.type === 'page_load') {
|
|
654
|
+
data.hydration = getReactHydrationStats();
|
|
655
|
+
}
|
|
654
656
|
|
|
655
657
|
// By this time, stop the post interaction log observer if coinflip rate is 0
|
|
656
658
|
var sanitisedUfoName = sanitizeUfoName(data.ufoName);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useInteractionContext } from '../interaction-context';
|
|
2
|
+
import { addError, addErrorToAll, getActiveInteraction } from '../interaction-metrics';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Usage:
|
|
6
|
+
* ```
|
|
7
|
+
* import { useUFOReportError } from '@atlaskit/react-ufo/use-error-handler';
|
|
8
|
+
*
|
|
9
|
+
* const reportError = useUFOReportError();
|
|
10
|
+
*
|
|
11
|
+
* try {
|
|
12
|
+
* // something that can throw an error
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* reportError(error)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* @returns `reportError` function
|
|
18
|
+
*/
|
|
19
|
+
export function useUFOReportError() {
|
|
20
|
+
var interaction = getActiveInteraction();
|
|
21
|
+
var ufoContext = useInteractionContext();
|
|
22
|
+
var reportError = function reportError(error) {
|
|
23
|
+
if (interaction !== null && interaction !== void 0 && interaction.id) {
|
|
24
|
+
addError(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
|
|
25
|
+
} else {
|
|
26
|
+
addErrorToAll(error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return reportError;
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type InteractionError } from '../interaction-metrics';
|
|
2
|
+
/**
|
|
3
|
+
* Usage:
|
|
4
|
+
* ```
|
|
5
|
+
* import { useUFOReportError } from '@atlaskit/react-ufo/use-error-handler';
|
|
6
|
+
*
|
|
7
|
+
* const reportError = useUFOReportError();
|
|
8
|
+
*
|
|
9
|
+
* try {
|
|
10
|
+
* // something that can throw an error
|
|
11
|
+
* } catch (error) {
|
|
12
|
+
* reportError(error)
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
* @returns `reportError` function
|
|
16
|
+
*/
|
|
17
|
+
export declare function useUFOReportError(): (error: InteractionError) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type InteractionError } from '../interaction-metrics';
|
|
2
|
+
/**
|
|
3
|
+
* Usage:
|
|
4
|
+
* ```
|
|
5
|
+
* import { useUFOReportError } from '@atlaskit/react-ufo/use-error-handler';
|
|
6
|
+
*
|
|
7
|
+
* const reportError = useUFOReportError();
|
|
8
|
+
*
|
|
9
|
+
* try {
|
|
10
|
+
* // something that can throw an error
|
|
11
|
+
* } catch (error) {
|
|
12
|
+
* reportError(error)
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
* @returns `reportError` function
|
|
16
|
+
*/
|
|
17
|
+
export declare function useUFOReportError(): (error: InteractionError) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.5",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,55 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"atlaskit:src": "src/index.ts",
|
|
28
|
-
"af:exports": {
|
|
29
|
-
"./additional-payload": "./src/additional-payload/index.ts",
|
|
30
|
-
"./bundle-eval-timing": "./src/bundle-eval-timing/index.ts",
|
|
31
|
-
"./coinflip": "./src/coinflip/index.ts",
|
|
32
|
-
"./common": "./src/common/index.ts",
|
|
33
|
-
"./config": "./src/config/index.ts",
|
|
34
|
-
"./create-experimental-interaction-metrics-payload": "./src/create-experimental-interaction-metrics-payload/index.ts",
|
|
35
|
-
"./create-payload": "./src/create-payload/index.ts",
|
|
36
|
-
"./create-post-interaction-log-payload": "./src/create-post-interaction-log-payload/index.ts",
|
|
37
|
-
"./custom-data": "./src/custom-data/index.ts",
|
|
38
|
-
"./custom-cohort-data": "./src/custom-cohort-data/index.ts",
|
|
39
|
-
"./custom-mark": "./src/custom-mark/index.ts",
|
|
40
|
-
"./custom-spans": "./src/custom-spans/index.ts",
|
|
41
|
-
"./custom-timings": "./src/custom-timings/index.ts",
|
|
42
|
-
"./experience-trace-id-context": "./src/experience-trace-id-context/index.ts",
|
|
43
|
-
"./feature-flags-accessed": "./src/feature-flags-accessed/index.ts",
|
|
44
|
-
"./generate-id": "./src/generate-id/index.ts",
|
|
45
|
-
"./global-error-handler": "./src/global-error-handler/index.ts",
|
|
46
|
-
"./hidden-timing": "./src/hidden-timing/index.ts",
|
|
47
|
-
"./initial-page-load-extra-timing": "./src/initial-page-load-extra-timing/index.ts",
|
|
48
|
-
"./interaction-context": "./src/interaction-context/index.ts",
|
|
49
|
-
"./interaction-id-context": "./src/interaction-id-context/index.ts",
|
|
50
|
-
"./interaction-ignore": "./src/interaction-ignore/index.ts",
|
|
51
|
-
"./interaction-metrics": "./src/interaction-metrics/index.ts",
|
|
52
|
-
"./interaction-metrics-init": "./src/interaction-metrics-init/index.ts",
|
|
53
|
-
"./label": "./src/label/index.ts",
|
|
54
|
-
"./load-hold": "./src/load-hold/index.ts",
|
|
55
|
-
"./placeholder": "./src/placeholder/index.ts",
|
|
56
|
-
"./resource-timing": "./src/resource-timing/index.ts",
|
|
57
|
-
"./round-number": "./src/round-number/index.ts",
|
|
58
|
-
"./route-name": "./src/route-name/index.ts",
|
|
59
|
-
"./route-name-context": "./src/route-name-context/index.ts",
|
|
60
|
-
"./segment": "./src/segment/index.ts",
|
|
61
|
-
"./set-interaction-error": "./src/set-interaction-error/index.ts",
|
|
62
|
-
"./short-id": "./src/short-id/index.ts",
|
|
63
|
-
"./ssr": "./src/ssr/index.ts",
|
|
64
|
-
"./ssr-scripts": "./src/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.ts",
|
|
65
|
-
"./suspense": "./src/suspense/index.ts",
|
|
66
|
-
"./trace-interaction": "./src/trace-interaction/index.ts",
|
|
67
|
-
"./trace-pageload": "./src/trace-pageload/index.ts",
|
|
68
|
-
"./trace-press": "./src/trace-press/index.ts",
|
|
69
|
-
"./trace-redirect": "./src/trace-redirect/index.ts",
|
|
70
|
-
"./trace-transition": "./src/trace-transition/index.ts",
|
|
71
|
-
"./typing-performance-tracing": "./src/typing-performance-tracing/index.ts",
|
|
72
|
-
"./use-press-tracing": "./src/use-press-tracing/index.ts",
|
|
73
|
-
"./vc": "./src/vc/index.ts",
|
|
74
|
-
"./vc-media": "./src/vc/vc-observer/media-wrapper/index.ts",
|
|
75
|
-
".": "./src/index.ts"
|
|
76
|
-
},
|
|
77
28
|
"dependencies": {
|
|
78
29
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
79
30
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/react-ufo/report-error",
|
|
3
|
+
"main": "../dist/cjs/report-error/index.js",
|
|
4
|
+
"module": "../dist/esm/report-error/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/report-error/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/report-error/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/report-error/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|