@atlaskit/react-ufo 5.0.13 → 5.1.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 +14 -0
- package/dist/cjs/experience-trace-id-context/context-manager.js +180 -0
- package/dist/cjs/experience-trace-id-context/index.js +67 -11
- package/dist/cjs/interaction-metrics-init/index.js +15 -6
- package/dist/cjs/vc/index.js +6 -6
- package/dist/es2019/experience-trace-id-context/context-manager.js +142 -0
- package/dist/es2019/experience-trace-id-context/index.js +65 -9
- package/dist/es2019/interaction-metrics-init/index.js +15 -6
- package/dist/es2019/vc/index.js +6 -6
- package/dist/esm/experience-trace-id-context/context-manager.js +172 -0
- package/dist/esm/experience-trace-id-context/index.js +67 -11
- package/dist/esm/interaction-metrics-init/index.js +15 -6
- package/dist/esm/vc/index.js +6 -6
- package/dist/types/common/react-ufo-payload-schema.d.ts +5 -0
- package/dist/types/config/index.d.ts +6 -0
- package/dist/types/experience-trace-id-context/context-manager.d.ts +65 -0
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +5 -0
- package/dist/types-ts4.5/config/index.d.ts +6 -0
- package/dist/types-ts4.5/experience-trace-id-context/context-manager.d.ts +65 -0
- package/package.json +6 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Context, type ContextManager } from '@opentelemetry/api';
|
|
2
|
+
export declare function setContextManager(ctxMgr: ContextManager): void;
|
|
3
|
+
export declare function getContextManager(): ContextManager;
|
|
4
|
+
/**
|
|
5
|
+
* The below is shamelessly borrowed from StackContextManager from @opentelemetry/sdk-trace-web
|
|
6
|
+
* Using this rather than importing the entire package because this is all we need for now
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* UFO Context Manager for managing the state in web
|
|
10
|
+
* it doesn't fully support the async calls though
|
|
11
|
+
*/
|
|
12
|
+
export declare class UFOContextManager implements ContextManager {
|
|
13
|
+
/**
|
|
14
|
+
* whether the context manager is enabled or not
|
|
15
|
+
*/
|
|
16
|
+
private _enabled;
|
|
17
|
+
/**
|
|
18
|
+
* Keeps the reference to current context
|
|
19
|
+
*/
|
|
20
|
+
_currentContext: Context;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param context
|
|
24
|
+
* @param target Function to be executed within the context
|
|
25
|
+
*/
|
|
26
|
+
private _bindFunction;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the active context
|
|
29
|
+
*/
|
|
30
|
+
active(): Context;
|
|
31
|
+
/**
|
|
32
|
+
* Binds a the certain context or the active one to the target function and then returns the target
|
|
33
|
+
* @param context A context (span) to be bind to target
|
|
34
|
+
* @param target a function or event emitter. When target or one of its callbacks is called,
|
|
35
|
+
* the provided context will be used as the active context for the duration of the call.
|
|
36
|
+
*/
|
|
37
|
+
bind<T>(context: Context, target: T): T;
|
|
38
|
+
/**
|
|
39
|
+
* Disable the context manager (clears the current context)
|
|
40
|
+
*/
|
|
41
|
+
disable(): this;
|
|
42
|
+
/**
|
|
43
|
+
* Enables the context manager and creates a default(root) context
|
|
44
|
+
*/
|
|
45
|
+
enable(): this;
|
|
46
|
+
/**
|
|
47
|
+
* Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.
|
|
48
|
+
* The context will be set as active
|
|
49
|
+
* @param context
|
|
50
|
+
* @param fn Callback function
|
|
51
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
52
|
+
* @param args optional arguments forwarded to fn
|
|
53
|
+
*/
|
|
54
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: Context | null, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the active context.
|
|
57
|
+
* This function is an extension of the OTel spec, in order to facilitate the current API of React UFO trace context handling.
|
|
58
|
+
* It doesn't keep track of any previously set active contexts, because it's assumed (for now) that only one trace context
|
|
59
|
+
* will ever exist at a time.
|
|
60
|
+
* The next step in the work to improve tracing in the FE will likely remove this function as we need to track the
|
|
61
|
+
* hierarchy of contexts (likely using the `with()` function above).
|
|
62
|
+
* @param context The context to be made the globally active one
|
|
63
|
+
*/
|
|
64
|
+
setActive(context: Context): void;
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@atlaskit/interaction-context": "^3.1.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
|
+
"@opentelemetry/api": "^1.9.0",
|
|
35
36
|
"bind-event-listener": "^3.0.0",
|
|
36
37
|
"bowser-ultralight": "^1.0.6",
|
|
37
38
|
"scheduler": "0.23.2",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@af/integration-testing": "workspace:^",
|
|
45
|
-
"@atlassian/a11y-jest-testing": "^0.
|
|
46
|
+
"@atlassian/a11y-jest-testing": "^0.9.0",
|
|
46
47
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
47
48
|
"@testing-library/react": "^16.3.0",
|
|
48
49
|
"@types/is-ci": "^3.0.0",
|
|
@@ -193,6 +194,9 @@
|
|
|
193
194
|
"platform_ufo_keypress_interaction_abort": {
|
|
194
195
|
"type": "boolean"
|
|
195
196
|
},
|
|
197
|
+
"platform_ufo_enable_otel_context_manager": {
|
|
198
|
+
"type": "boolean"
|
|
199
|
+
},
|
|
196
200
|
"platform_ufo_raw_data_thirdparty": {
|
|
197
201
|
"type": "boolean"
|
|
198
202
|
},
|