@atlaskit/react-ufo 4.14.3 → 4.14.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/config/index.js +4 -0
  3. package/dist/cjs/create-payload/index.js +22 -2
  4. package/dist/cjs/create-payload/utils/get-vc-metrics.js +10 -6
  5. package/dist/cjs/interaction-metrics/index.js +20 -1
  6. package/dist/cjs/segment/segment.js +5 -0
  7. package/dist/cjs/vc/index.js +4 -3
  8. package/dist/cjs/vc/vc-observer-new/index.js +31 -7
  9. package/dist/cjs/vc/vc-observer-new/raw-data-handler/index.js +237 -0
  10. package/dist/es2019/config/index.js +3 -0
  11. package/dist/es2019/create-payload/index.js +17 -1
  12. package/dist/es2019/create-payload/utils/get-vc-metrics.js +5 -2
  13. package/dist/es2019/interaction-metrics/index.js +16 -0
  14. package/dist/es2019/segment/segment.js +6 -1
  15. package/dist/es2019/vc/index.js +4 -2
  16. package/dist/es2019/vc/vc-observer-new/index.js +20 -1
  17. package/dist/es2019/vc/vc-observer-new/raw-data-handler/index.js +173 -0
  18. package/dist/esm/config/index.js +3 -0
  19. package/dist/esm/create-payload/index.js +22 -2
  20. package/dist/esm/create-payload/utils/get-vc-metrics.js +11 -7
  21. package/dist/esm/interaction-metrics/index.js +17 -0
  22. package/dist/esm/segment/segment.js +6 -1
  23. package/dist/esm/vc/index.js +4 -3
  24. package/dist/esm/vc/vc-observer-new/index.js +31 -7
  25. package/dist/esm/vc/vc-observer-new/raw-data-handler/index.js +231 -0
  26. package/dist/types/common/common/types.d.ts +1 -1
  27. package/dist/types/common/vc/types.d.ts +20 -1
  28. package/dist/types/config/index.d.ts +6 -0
  29. package/dist/types/interaction-metrics/index.d.ts +1 -0
  30. package/dist/types/vc/types.d.ts +1 -0
  31. package/dist/types/vc/vc-observer-new/raw-data-handler/index.d.ts +20 -0
  32. package/dist/types/vc/vc-observer-new/types.d.ts +2 -0
  33. package/dist/types-ts4.5/common/common/types.d.ts +1 -1
  34. package/dist/types-ts4.5/common/vc/types.d.ts +25 -1
  35. package/dist/types-ts4.5/config/index.d.ts +6 -0
  36. package/dist/types-ts4.5/interaction-metrics/index.d.ts +1 -0
  37. package/dist/types-ts4.5/vc/types.d.ts +1 -0
  38. package/dist/types-ts4.5/vc/vc-observer-new/raw-data-handler/index.d.ts +20 -0
  39. package/dist/types-ts4.5/vc/vc-observer-new/types.d.ts +2 -0
  40. package/package.json +7 -1
@@ -0,0 +1,231 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/createClass";
5
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ 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; }
11
+ 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; }
12
+ import getViewportHeight from '../metric-calculator/utils/get-viewport-height';
13
+ import getViewportWidth from '../metric-calculator/utils/get-viewport-width';
14
+ var ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
15
+ var MAX_OBSERVATIONS = 100;
16
+ var RawDataHandler = /*#__PURE__*/function () {
17
+ function RawDataHandler() {
18
+ _classCallCheck(this, RawDataHandler);
19
+ _defineProperty(this, "revisionNo", 'raw-handler');
20
+ }
21
+ return _createClass(RawDataHandler, [{
22
+ key: "getVCCleanStatus",
23
+ value: function getVCCleanStatus(filteredEntries) {
24
+ var dirtyReason = '';
25
+ var abortTimestamp = -1;
26
+ var hasAbortEvent = filteredEntries.some(function (entry) {
27
+ if (entry.data.type === 'window:event') {
28
+ var data = entry.data;
29
+ if (ABORTING_WINDOW_EVENT.includes(data.eventType)) {
30
+ dirtyReason = data.eventType === 'keydown' ? 'keypress' : data.eventType;
31
+ abortTimestamp = Math.round(entry.time);
32
+ return true;
33
+ }
34
+ }
35
+ return false;
36
+ });
37
+ if (hasAbortEvent && dirtyReason) {
38
+ return {
39
+ isVCClean: false,
40
+ dirtyReason: dirtyReason,
41
+ abortTimestamp: abortTimestamp
42
+ };
43
+ }
44
+ return {
45
+ isVCClean: true
46
+ };
47
+ }
48
+ }, {
49
+ key: "getRawData",
50
+ value: function () {
51
+ var _getRawData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
52
+ var entries, startTime, stopTime, isPageVisible, isVCClean, dirtyReason, getVCCleanStatusResult, viewportEntries, targetNameToIdMap, elementMapEntriesMap, nextElementId, typeMap, typeMapEntriesMap, nextTypeId, attributeMap, attributeEntriesMap, nextAttributeId, rawObservations, firstObservation, lastObservations, referencedEids, referencedChgs, referencedAtts, _iterator, _step, observation, _iterator2, _step2, eid, _iterator3, _step3, chg, _iterator4, _step4, att, result;
53
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
54
+ while (1) switch (_context.prev = _context.next) {
55
+ case 0:
56
+ entries = _ref.entries, startTime = _ref.startTime, stopTime = _ref.stopTime, isPageVisible = _ref.isPageVisible;
57
+ getVCCleanStatusResult = this.getVCCleanStatus(entries);
58
+ isVCClean = getVCCleanStatusResult.isVCClean;
59
+ dirtyReason = getVCCleanStatusResult.dirtyReason;
60
+ if (isPageVisible) {
61
+ _context.next = 6;
62
+ break;
63
+ }
64
+ return _context.abrupt("return", {
65
+ revision: this.revisionNo,
66
+ clean: false,
67
+ 'metric:vc90': null,
68
+ abortReason: 'browser_backgrounded',
69
+ abortTimestamp: -1,
70
+ viewport: {
71
+ w: getViewportWidth(),
72
+ h: getViewportHeight()
73
+ }
74
+ });
75
+ case 6:
76
+ viewportEntries = entries.filter(function (entry) {
77
+ return entry.time >= startTime && entry.time <= stopTime && entry.data && entry.data.visible;
78
+ });
79
+ targetNameToIdMap = new Map();
80
+ elementMapEntriesMap = {};
81
+ nextElementId = 1;
82
+ typeMap = new Map();
83
+ typeMapEntriesMap = {};
84
+ nextTypeId = 1;
85
+ attributeMap = new Map();
86
+ attributeEntriesMap = {};
87
+ nextAttributeId = 1;
88
+ rawObservations = viewportEntries.map(function (entry) {
89
+ var viewportEntry = entry.data;
90
+ var targetName = viewportEntry.elementName || '';
91
+ var type = viewportEntry.type || '';
92
+ var rect = viewportEntry.rect;
93
+ var attributeName = viewportEntry.attributeName || '';
94
+ var eid = targetNameToIdMap.get(viewportEntry.elementName || '') || 0;
95
+ if (eid === 0) {
96
+ eid = nextElementId;
97
+ nextElementId += 1;
98
+ targetNameToIdMap.set(targetName, eid);
99
+ elementMapEntriesMap[eid] = targetName;
100
+ }
101
+ var chg = typeMap.get(type || '') || 0;
102
+ if (chg === 0) {
103
+ chg = nextTypeId;
104
+ nextTypeId += 1;
105
+ typeMap.set(type, chg);
106
+ typeMapEntriesMap[chg] = type;
107
+ }
108
+ var att = 0;
109
+ if (attributeName) {
110
+ att = attributeMap.get(attributeName) || 0;
111
+ if (att === 0) {
112
+ att = nextAttributeId;
113
+ nextAttributeId += 1;
114
+ attributeMap.set(attributeName, att);
115
+ attributeEntriesMap[att] = attributeName;
116
+ }
117
+ }
118
+ var observation = _objectSpread({
119
+ t: Math.round(entry.time),
120
+ r: [Math.round(rect.left * 10) / 10, Math.round(rect.top * 10) / 10, Math.round(rect.right * 10) / 10, Math.round(rect.bottom * 10) / 10],
121
+ chg: chg,
122
+ eid: eid || 0
123
+ }, att > 0 ? {
124
+ att: att
125
+ } : {});
126
+ return observation;
127
+ }); // If the number of observations is greater than the maximum allowed, we need to trim the observations to the maximum allowed.
128
+ // We do this by keeping the first observation and the last MAX_OBSERVATIONS observations.
129
+ // We then collect the referenced IDs from the remaining observations and remove the unreferenced entries from the maps
130
+ if (rawObservations.length > MAX_OBSERVATIONS) {
131
+ firstObservation = rawObservations[0];
132
+ lastObservations = rawObservations.slice(-MAX_OBSERVATIONS);
133
+ rawObservations = [firstObservation].concat(_toConsumableArray(lastObservations));
134
+
135
+ // Collect referenced IDs from remaining observations
136
+ referencedEids = new Set();
137
+ referencedChgs = new Set();
138
+ referencedAtts = new Set();
139
+ _iterator = _createForOfIteratorHelper(rawObservations);
140
+ try {
141
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
142
+ observation = _step.value;
143
+ if (observation.eid > 0) {
144
+ referencedEids.add(observation.eid);
145
+ }
146
+ if (typeof observation.chg === 'number' && observation.chg > 0) {
147
+ referencedChgs.add(observation.chg);
148
+ }
149
+ if (observation.att !== undefined && observation.att > 0) {
150
+ referencedAtts.add(observation.att);
151
+ }
152
+ }
153
+
154
+ // Remove unreferenced entries from maps
155
+ } catch (err) {
156
+ _iterator.e(err);
157
+ } finally {
158
+ _iterator.f();
159
+ }
160
+ _iterator2 = _createForOfIteratorHelper(Object.keys(elementMapEntriesMap).map(Number));
161
+ try {
162
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
163
+ eid = _step2.value;
164
+ if (!referencedEids.has(eid)) {
165
+ delete elementMapEntriesMap[eid];
166
+ }
167
+ }
168
+ } catch (err) {
169
+ _iterator2.e(err);
170
+ } finally {
171
+ _iterator2.f();
172
+ }
173
+ _iterator3 = _createForOfIteratorHelper(Object.keys(typeMapEntriesMap).map(Number));
174
+ try {
175
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
176
+ chg = _step3.value;
177
+ if (!referencedChgs.has(chg)) {
178
+ delete typeMapEntriesMap[chg];
179
+ }
180
+ }
181
+ } catch (err) {
182
+ _iterator3.e(err);
183
+ } finally {
184
+ _iterator3.f();
185
+ }
186
+ _iterator4 = _createForOfIteratorHelper(Object.keys(attributeEntriesMap).map(Number));
187
+ try {
188
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
189
+ att = _step4.value;
190
+ if (!referencedAtts.has(att)) {
191
+ delete attributeEntriesMap[att];
192
+ }
193
+ }
194
+ } catch (err) {
195
+ _iterator4.e(err);
196
+ } finally {
197
+ _iterator4.f();
198
+ }
199
+ }
200
+ result = {
201
+ revision: this.revisionNo,
202
+ clean: isVCClean,
203
+ 'metric:vc90': null,
204
+ rawData: {
205
+ obs: rawObservations !== null && rawObservations !== void 0 ? rawObservations : undefined,
206
+ eid: elementMapEntriesMap !== null && elementMapEntriesMap !== void 0 ? elementMapEntriesMap : undefined,
207
+ chg: typeMapEntriesMap !== null && typeMapEntriesMap !== void 0 ? typeMapEntriesMap : undefined,
208
+ att: attributeEntriesMap !== null && attributeEntriesMap !== void 0 ? attributeEntriesMap : undefined
209
+ },
210
+ abortReason: dirtyReason,
211
+ abortTimestamp: getVCCleanStatusResult.abortTimestamp,
212
+ viewport: {
213
+ w: getViewportWidth(),
214
+ h: getViewportHeight()
215
+ }
216
+ };
217
+ return _context.abrupt("return", result);
218
+ case 20:
219
+ case "end":
220
+ return _context.stop();
221
+ }
222
+ }, _callee, this);
223
+ }));
224
+ function getRawData(_x) {
225
+ return _getRawData.apply(this, arguments);
226
+ }
227
+ return getRawData;
228
+ }()
229
+ }]);
230
+ }();
231
+ export { RawDataHandler as default };
@@ -4,7 +4,7 @@ import type { LabelStack, UFOInteractionContextType } from '../../interaction-co
4
4
  import type { VCObserverInterface } from '../../vc/types';
5
5
  import { type VCRawDataType, type VCResult } from '../vc/types';
6
6
  export type LifecycleMarkType = 'render' | 'beforePaint' | 'afterPaint' | 'nextTick' | 'mount' | 'commit';
7
- export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom') | LifecycleMarkType;
7
+ export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom' | 'first_segment_load') | LifecycleMarkType;
8
8
  export type SpanType = 'placeholder' | 'relay' | 'hidden_timing' | 'bundle_load' | 'graphql' | 'fetch' | 'reducer' | 'custom';
9
9
  export type InteractionType = 'page_load' | 'press' | 'typing' | 'transition' | 'segment';
10
10
  export type AbortReasonType = 'new_interaction' | 'unload' | 'transition' | 'timeout' | 'excluded_by_sampling';
@@ -4,7 +4,7 @@ export declare const AbortEvent: {
4
4
  readonly keydown: "keydown";
5
5
  readonly resize: "resize";
6
6
  };
7
- export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel';
7
+ export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel' | 'browser_backgrounded';
8
8
  export type VCAbortReasonType = {
9
9
  reason: null | VCAbortReason;
10
10
  info: string;
@@ -118,6 +118,13 @@ export type CalculateTTVCResult = {
118
118
  vcDetails: RevisionPayloadVCDetails;
119
119
  ssrRatio: number;
120
120
  };
121
+ export type RawObservation = {
122
+ t: number;
123
+ r: [number, number, number, number];
124
+ chg: number | string;
125
+ eid: number;
126
+ att?: number;
127
+ };
121
128
  export type RevisionPayloadEntry = {
122
129
  'metric:vc90': number | null;
123
130
  revision: string;
@@ -128,6 +135,18 @@ export type RevisionPayloadEntry = {
128
135
  labelStacks?: VCLabelStacks;
129
136
  abortReason?: VCAbortReason | null;
130
137
  abortTimestamp?: number;
138
+ rawData?: {
139
+ obs?: Array<RawObservation>;
140
+ eid?: Record<number, string>;
141
+ chg?: Record<number, string>;
142
+ att?: Record<number, string>;
143
+ };
144
+ viewport?: {
145
+ w: number;
146
+ h: number;
147
+ };
148
+ feVCTime?: number;
149
+ rawVCTime?: number;
131
150
  };
132
151
  export type RevisionPayload = RevisionPayloadEntry[];
133
152
  export {};
@@ -161,6 +161,11 @@ export type Config = {
161
161
  readonly enabled: boolean;
162
162
  readonly searchPageMetricName: string;
163
163
  };
164
+ readonly enableVCRawDataRates?: {
165
+ readonly enabled?: boolean;
166
+ readonly rates?: Rates;
167
+ readonly kind?: Record<InteractionType, number>;
168
+ };
164
169
  };
165
170
  export declare function setUFOConfig(newConfig: Config): void;
166
171
  export declare function getConfig(): Config | undefined;
@@ -170,6 +175,7 @@ export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRev
170
175
  export declare function getReactHydrationStats(): ReactHydrationStats | undefined;
171
176
  export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
172
177
  export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
178
+ export declare function getVCRawDataInteractionRate(name: string, interactionType: InteractionType): number;
173
179
  export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
174
180
  export declare function getCapabilityRate(capability: Capability): number;
175
181
  export declare function getExtraInteractionRate(name: string, interactionType: InteractionType): number;
@@ -18,6 +18,7 @@ export declare function addCustomData(interactionId: string, labelStack: LabelSt
18
18
  export declare function addCohortingCustomData(interactionId: string, key: string, value: number | boolean | string | null | undefined): void;
19
19
  export declare function addCustomTiming(interactionId: string, labelStack: LabelStack, data: CustomTiming): void;
20
20
  export declare function addMark(interactionId: string, type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
21
+ export declare function markFirstSegmentLoad(interactionId: string, labelStack: LabelStack | null, time?: number): void;
21
22
  export declare function addMarkToAll(type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
22
23
  export declare function addSpan(interactionId: string, type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
23
24
  export declare function addSpanToAll(type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
@@ -17,6 +17,7 @@ export type GetVCResultType = {
17
17
  interactionType: InteractionType;
18
18
  isPageVisible: boolean;
19
19
  interactionAbortReason?: AbortReasonType;
20
+ includeRawData?: boolean;
20
21
  };
21
22
  export type SelectorConfig = {
22
23
  id: boolean;
@@ -0,0 +1,20 @@
1
+ import type { RevisionPayloadEntry } from '../../../common/vc/types';
2
+ import type { VCObserverEntry } from '../types';
3
+ export default class RawDataHandler {
4
+ private readonly revisionNo;
5
+ protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
6
+ isVCClean: boolean;
7
+ dirtyReason: never;
8
+ abortTimestamp: number;
9
+ } | {
10
+ isVCClean: boolean;
11
+ dirtyReason?: undefined;
12
+ abortTimestamp?: undefined;
13
+ };
14
+ getRawData({ entries, startTime, stopTime, isPageVisible, }: {
15
+ entries: ReadonlyArray<VCObserverEntry>;
16
+ startTime: number;
17
+ stopTime: number;
18
+ isPageVisible: boolean;
19
+ }): Promise<RevisionPayloadEntry | undefined>;
20
+ }
@@ -23,6 +23,7 @@ export type WindowEventEntryData = {
23
23
  export type VCObserverEntry = {
24
24
  readonly time: DOMHighResTimeStamp;
25
25
  readonly data: ViewportEntryData | WindowEventEntryData;
26
+ ignoredInRevision?: string[];
26
27
  };
27
28
  export type VCObserverGetVCResultParam = {
28
29
  start: number;
@@ -35,4 +36,5 @@ export type VCObserverGetVCResultParam = {
35
36
  interactionType: InteractionType;
36
37
  isPageVisible: boolean;
37
38
  interactionAbortReason?: AbortReasonType;
39
+ includeRawData?: boolean;
38
40
  };
@@ -4,7 +4,7 @@ import type { LabelStack, UFOInteractionContextType } from '../../interaction-co
4
4
  import type { VCObserverInterface } from '../../vc/types';
5
5
  import { type VCRawDataType, type VCResult } from '../vc/types';
6
6
  export type LifecycleMarkType = 'render' | 'beforePaint' | 'afterPaint' | 'nextTick' | 'mount' | 'commit';
7
- export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom') | LifecycleMarkType;
7
+ export type MarkType = ('placeholder' | 'bm3_stop' | 'bundle_preload' | 'custom' | 'first_segment_load') | LifecycleMarkType;
8
8
  export type SpanType = 'placeholder' | 'relay' | 'hidden_timing' | 'bundle_load' | 'graphql' | 'fetch' | 'reducer' | 'custom';
9
9
  export type InteractionType = 'page_load' | 'press' | 'typing' | 'transition' | 'segment';
10
10
  export type AbortReasonType = 'new_interaction' | 'unload' | 'transition' | 'timeout' | 'excluded_by_sampling';
@@ -4,7 +4,7 @@ export declare const AbortEvent: {
4
4
  readonly keydown: "keydown";
5
5
  readonly resize: "resize";
6
6
  };
7
- export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel';
7
+ export type VCAbortReason = 'custom' | 'scroll' | 'keypress' | 'resize' | 'error' | 'not-supported' | 'wheel' | 'browser_backgrounded';
8
8
  export type VCAbortReasonType = {
9
9
  reason: null | VCAbortReason;
10
10
  info: string;
@@ -118,6 +118,18 @@ export type CalculateTTVCResult = {
118
118
  vcDetails: RevisionPayloadVCDetails;
119
119
  ssrRatio: number;
120
120
  };
121
+ export type RawObservation = {
122
+ t: number;
123
+ r: [
124
+ number,
125
+ number,
126
+ number,
127
+ number
128
+ ];
129
+ chg: number | string;
130
+ eid: number;
131
+ att?: number;
132
+ };
121
133
  export type RevisionPayloadEntry = {
122
134
  'metric:vc90': number | null;
123
135
  revision: string;
@@ -128,6 +140,18 @@ export type RevisionPayloadEntry = {
128
140
  labelStacks?: VCLabelStacks;
129
141
  abortReason?: VCAbortReason | null;
130
142
  abortTimestamp?: number;
143
+ rawData?: {
144
+ obs?: Array<RawObservation>;
145
+ eid?: Record<number, string>;
146
+ chg?: Record<number, string>;
147
+ att?: Record<number, string>;
148
+ };
149
+ viewport?: {
150
+ w: number;
151
+ h: number;
152
+ };
153
+ feVCTime?: number;
154
+ rawVCTime?: number;
131
155
  };
132
156
  export type RevisionPayload = RevisionPayloadEntry[];
133
157
  export {};
@@ -161,6 +161,11 @@ export type Config = {
161
161
  readonly enabled: boolean;
162
162
  readonly searchPageMetricName: string;
163
163
  };
164
+ readonly enableVCRawDataRates?: {
165
+ readonly enabled?: boolean;
166
+ readonly rates?: Rates;
167
+ readonly kind?: Record<InteractionType, number>;
168
+ };
164
169
  };
165
170
  export declare function setUFOConfig(newConfig: Config): void;
166
171
  export declare function getConfig(): Config | undefined;
@@ -170,6 +175,7 @@ export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRev
170
175
  export declare function getReactHydrationStats(): ReactHydrationStats | undefined;
171
176
  export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
172
177
  export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
178
+ export declare function getVCRawDataInteractionRate(name: string, interactionType: InteractionType): number;
173
179
  export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
174
180
  export declare function getCapabilityRate(capability: Capability): number;
175
181
  export declare function getExtraInteractionRate(name: string, interactionType: InteractionType): number;
@@ -18,6 +18,7 @@ export declare function addCustomData(interactionId: string, labelStack: LabelSt
18
18
  export declare function addCohortingCustomData(interactionId: string, key: string, value: number | boolean | string | null | undefined): void;
19
19
  export declare function addCustomTiming(interactionId: string, labelStack: LabelStack, data: CustomTiming): void;
20
20
  export declare function addMark(interactionId: string, type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
21
+ export declare function markFirstSegmentLoad(interactionId: string, labelStack: LabelStack | null, time?: number): void;
21
22
  export declare function addMarkToAll(type: MarkType, name: string, labelStack: LabelStack | null, time?: number): void;
22
23
  export declare function addSpan(interactionId: string, type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
23
24
  export declare function addSpanToAll(type: SpanType, name: string, labelStack: LabelStack | null, start: number, end?: number, size?: number): void;
@@ -17,6 +17,7 @@ export type GetVCResultType = {
17
17
  interactionType: InteractionType;
18
18
  isPageVisible: boolean;
19
19
  interactionAbortReason?: AbortReasonType;
20
+ includeRawData?: boolean;
20
21
  };
21
22
  export type SelectorConfig = {
22
23
  id: boolean;
@@ -0,0 +1,20 @@
1
+ import type { RevisionPayloadEntry } from '../../../common/vc/types';
2
+ import type { VCObserverEntry } from '../types';
3
+ export default class RawDataHandler {
4
+ private readonly revisionNo;
5
+ protected getVCCleanStatus(filteredEntries: readonly VCObserverEntry[]): {
6
+ isVCClean: boolean;
7
+ dirtyReason: never;
8
+ abortTimestamp: number;
9
+ } | {
10
+ isVCClean: boolean;
11
+ dirtyReason?: undefined;
12
+ abortTimestamp?: undefined;
13
+ };
14
+ getRawData({ entries, startTime, stopTime, isPageVisible, }: {
15
+ entries: ReadonlyArray<VCObserverEntry>;
16
+ startTime: number;
17
+ stopTime: number;
18
+ isPageVisible: boolean;
19
+ }): Promise<RevisionPayloadEntry | undefined>;
20
+ }
@@ -23,6 +23,7 @@ export type WindowEventEntryData = {
23
23
  export type VCObserverEntry = {
24
24
  readonly time: DOMHighResTimeStamp;
25
25
  readonly data: ViewportEntryData | WindowEventEntryData;
26
+ ignoredInRevision?: string[];
26
27
  };
27
28
  export type VCObserverGetVCResultParam = {
28
29
  start: number;
@@ -35,4 +36,5 @@ export type VCObserverGetVCResultParam = {
35
36
  interactionType: InteractionType;
36
37
  isPageVisible: boolean;
37
38
  interactionAbortReason?: AbortReasonType;
39
+ includeRawData?: boolean;
38
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.14.3",
3
+ "version": "4.14.5",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -169,6 +169,12 @@
169
169
  },
170
170
  "platform_ufo_exclude_3p_attribute_changes": {
171
171
  "type": "boolean"
172
+ },
173
+ "platform_ufo_enable_vc_raw_data": {
174
+ "type": "boolean"
175
+ },
176
+ "platform_mark_ufo_segment_first_load": {
177
+ "type": "boolean"
172
178
  }
173
179
  }
174
180
  }