@atlaskit/react-ufo 3.10.4 → 3.11.1
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/dist/cjs/config/index.js +51 -5
- package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/cjs/create-payload/utils/get-vc-metrics.js +41 -20
- package/dist/cjs/create-post-interaction-log-payload/index.js +11 -0
- package/dist/cjs/interaction-metrics/index.js +2 -1
- package/dist/cjs/interaction-metrics/post-interaction-log.js +15 -5
- package/dist/cjs/vc/index.js +125 -36
- package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +48 -23
- package/dist/cjs/vc/vc-observer/index.js +17 -6
- package/dist/es2019/config/index.js +49 -6
- package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/es2019/create-payload/utils/get-vc-metrics.js +36 -19
- package/dist/es2019/create-post-interaction-log-payload/index.js +11 -0
- package/dist/es2019/interaction-metrics/index.js +2 -1
- package/dist/es2019/interaction-metrics/post-interaction-log.js +14 -4
- package/dist/es2019/vc/index.js +99 -36
- package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +52 -25
- package/dist/es2019/vc/vc-observer/index.js +18 -6
- package/dist/esm/config/index.js +49 -5
- package/dist/esm/create-experimental-interaction-metrics-payload/index.js +2 -1
- package/dist/esm/create-payload/utils/get-vc-metrics.js +42 -21
- package/dist/esm/create-post-interaction-log-payload/index.js +11 -0
- package/dist/esm/interaction-metrics/index.js +2 -1
- package/dist/esm/interaction-metrics/post-interaction-log.js +15 -5
- package/dist/esm/vc/index.js +127 -37
- package/dist/esm/vc/vc-observer/getVCRevisionsData.js +48 -23
- package/dist/esm/vc/vc-observer/index.js +17 -6
- package/dist/types/common/common/types.d.ts +1 -1
- package/dist/types/common/react-ufo-payload-schema.d.ts +49 -3
- package/dist/types/config/index.d.ts +14 -3
- package/dist/types/create-post-interaction-log-payload/index.d.ts +3 -2
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +3 -4
- package/dist/types/vc/index.d.ts +17 -1
- package/dist/types/vc/types.d.ts +3 -1
- package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +5 -3
- package/dist/types/vc/vc-observer/index.d.ts +1 -1
- package/dist/types-ts4.5/common/common/types.d.ts +1 -1
- package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +51 -3
- package/dist/types-ts4.5/config/index.d.ts +14 -3
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +3 -2
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +3 -4
- package/dist/types-ts4.5/vc/index.d.ts +17 -1
- package/dist/types-ts4.5/vc/types.d.ts +3 -1
- package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +5 -3
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +1 -1
- package/package.json +7 -1
package/dist/esm/vc/index.js
CHANGED
|
@@ -7,74 +7,162 @@ var _process;
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { isVCRevisionEnabled } from '../config';
|
|
11
12
|
import { VCObserverNOOP } from './no-op-vc-observer';
|
|
12
13
|
import { VCObserver } from './vc-observer';
|
|
13
14
|
import VCObserverNew from './vc-observer-new';
|
|
14
|
-
var VCObserverWrapper = /*#__PURE__*/function () {
|
|
15
|
+
export var VCObserverWrapper = /*#__PURE__*/function () {
|
|
15
16
|
function VCObserverWrapper() {
|
|
16
17
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
18
|
_classCallCheck(this, VCObserverWrapper);
|
|
18
19
|
this.newVCObserver = null;
|
|
19
|
-
if (
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
21
|
+
this.oldVCObserver = null;
|
|
22
|
+
if (isVCRevisionEnabled('fy25.03')) {
|
|
23
|
+
this.newVCObserver = new VCObserverNew({
|
|
24
|
+
selectorConfig: opts.selectorConfig
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (isVCRevisionEnabled('fy25.01') || isVCRevisionEnabled('fy25.02')) {
|
|
28
|
+
this.oldVCObserver = new VCObserver(opts);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
if (isVCRevisionEnabled('fy25.03')) {
|
|
32
|
+
this.newVCObserver = new VCObserverNew({
|
|
33
|
+
selectorConfig: opts.selectorConfig
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
this.oldVCObserver = new VCObserver(opts);
|
|
23
37
|
}
|
|
24
|
-
this.oldVCObserver = new VCObserver(opts);
|
|
25
38
|
}
|
|
26
39
|
return _createClass(VCObserverWrapper, [{
|
|
27
40
|
key: "start",
|
|
28
|
-
value: function start(
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
(
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
value: function start(_ref) {
|
|
42
|
+
var startTime = _ref.startTime,
|
|
43
|
+
experienceKey = _ref.experienceKey;
|
|
44
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
45
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
46
|
+
var _this$oldVCObserver;
|
|
47
|
+
(_this$oldVCObserver = this.oldVCObserver) === null || _this$oldVCObserver === void 0 || _this$oldVCObserver.start({
|
|
48
|
+
startTime: startTime
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
52
|
+
var _this$newVCObserver;
|
|
53
|
+
(_this$newVCObserver = this.newVCObserver) === null || _this$newVCObserver === void 0 || _this$newVCObserver.start({
|
|
54
|
+
startTime: startTime
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
var _this$oldVCObserver2, _this$newVCObserver2;
|
|
59
|
+
(_this$oldVCObserver2 = this.oldVCObserver) === null || _this$oldVCObserver2 === void 0 || _this$oldVCObserver2.start({
|
|
60
|
+
startTime: startTime
|
|
61
|
+
});
|
|
62
|
+
(_this$newVCObserver2 = this.newVCObserver) === null || _this$newVCObserver2 === void 0 || _this$newVCObserver2.start({
|
|
63
|
+
startTime: startTime
|
|
64
|
+
});
|
|
65
|
+
}
|
|
34
66
|
}
|
|
35
67
|
}, {
|
|
36
68
|
key: "stop",
|
|
37
|
-
value: function stop() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
value: function stop(experienceKey) {
|
|
70
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
71
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
72
|
+
var _this$oldVCObserver3;
|
|
73
|
+
(_this$oldVCObserver3 = this.oldVCObserver) === null || _this$oldVCObserver3 === void 0 || _this$oldVCObserver3.stop();
|
|
74
|
+
}
|
|
75
|
+
if (isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
76
|
+
var _this$newVCObserver3;
|
|
77
|
+
(_this$newVCObserver3 = this.newVCObserver) === null || _this$newVCObserver3 === void 0 || _this$newVCObserver3.stop();
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
var _this$oldVCObserver4, _this$newVCObserver4;
|
|
81
|
+
(_this$oldVCObserver4 = this.oldVCObserver) === null || _this$oldVCObserver4 === void 0 || _this$oldVCObserver4.stop();
|
|
82
|
+
(_this$newVCObserver4 = this.newVCObserver) === null || _this$newVCObserver4 === void 0 || _this$newVCObserver4.stop();
|
|
83
|
+
}
|
|
41
84
|
}
|
|
42
85
|
}, {
|
|
43
86
|
key: "getVCRawData",
|
|
44
87
|
value: function getVCRawData() {
|
|
45
|
-
var _this$oldVCObserver$g, _this$
|
|
46
|
-
return (_this$oldVCObserver$g = (_this$
|
|
88
|
+
var _this$oldVCObserver$g, _this$oldVCObserver5;
|
|
89
|
+
return (_this$oldVCObserver$g = (_this$oldVCObserver5 = this.oldVCObserver) === null || _this$oldVCObserver5 === void 0 ? void 0 : _this$oldVCObserver5.getVCRawData()) !== null && _this$oldVCObserver$g !== void 0 ? _this$oldVCObserver$g : null;
|
|
47
90
|
}
|
|
48
91
|
}, {
|
|
49
92
|
key: "getVCResult",
|
|
50
93
|
value: function () {
|
|
51
94
|
var _getVCResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
52
|
-
var _this$
|
|
53
|
-
var oldResult, newResult;
|
|
95
|
+
var _this$oldVCObserver6, _this$newVCObserver5, _ref2, experienceKey, v1v2Result, v3Result, _this$oldVCObserver7, _this$newVCObserver6, _ref3, oldResult, newResult;
|
|
54
96
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
55
97
|
while (1) switch (_context.prev = _context.next) {
|
|
56
98
|
case 0:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
99
|
+
if (!fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
100
|
+
_context.next = 23;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
experienceKey = param.experienceKey;
|
|
104
|
+
if (!(isVCRevisionEnabled('fy25.01', experienceKey) || isVCRevisionEnabled('fy25.02', experienceKey))) {
|
|
105
|
+
_context.next = 8;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
61
108
|
_context.next = 5;
|
|
62
|
-
return (_this$
|
|
109
|
+
return (_this$oldVCObserver6 = this.oldVCObserver) === null || _this$oldVCObserver6 === void 0 ? void 0 : _this$oldVCObserver6.getVCResult(param);
|
|
110
|
+
case 5:
|
|
111
|
+
_context.t0 = _context.sent;
|
|
112
|
+
_context.next = 9;
|
|
113
|
+
break;
|
|
114
|
+
case 8:
|
|
115
|
+
_context.t0 = {};
|
|
116
|
+
case 9:
|
|
117
|
+
v1v2Result = _context.t0;
|
|
118
|
+
if (!isVCRevisionEnabled('fy25.03', experienceKey)) {
|
|
119
|
+
_context.next = 16;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
_context.next = 13;
|
|
123
|
+
return (_this$newVCObserver5 = this.newVCObserver) === null || _this$newVCObserver5 === void 0 ? void 0 : _this$newVCObserver5.getVCResult({
|
|
63
124
|
start: param.start,
|
|
64
125
|
stop: param.stop
|
|
65
126
|
});
|
|
66
|
-
case
|
|
127
|
+
case 13:
|
|
128
|
+
_context.t1 = _context.sent;
|
|
129
|
+
_context.next = 17;
|
|
130
|
+
break;
|
|
131
|
+
case 16:
|
|
132
|
+
_context.t1 = [];
|
|
133
|
+
case 17:
|
|
134
|
+
v3Result = _context.t1;
|
|
135
|
+
if (v3Result) {
|
|
136
|
+
_context.next = 20;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
return _context.abrupt("return", v1v2Result !== null && v1v2Result !== void 0 ? v1v2Result : {});
|
|
140
|
+
case 20:
|
|
141
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, v1v2Result), {}, {
|
|
142
|
+
'ufo:vc:rev': [].concat(_toConsumableArray((_ref2 = v1v2Result === null || v1v2Result === void 0 ? void 0 : v1v2Result['ufo:vc:rev']) !== null && _ref2 !== void 0 ? _ref2 : []), _toConsumableArray(v3Result !== null && v3Result !== void 0 ? v3Result : []))
|
|
143
|
+
}));
|
|
144
|
+
case 23:
|
|
145
|
+
_context.next = 25;
|
|
146
|
+
return (_this$oldVCObserver7 = this.oldVCObserver) === null || _this$oldVCObserver7 === void 0 ? void 0 : _this$oldVCObserver7.getVCResult(param);
|
|
147
|
+
case 25:
|
|
148
|
+
oldResult = _context.sent;
|
|
149
|
+
_context.next = 28;
|
|
150
|
+
return (_this$newVCObserver6 = this.newVCObserver) === null || _this$newVCObserver6 === void 0 ? void 0 : _this$newVCObserver6.getVCResult({
|
|
151
|
+
start: param.start,
|
|
152
|
+
stop: param.stop
|
|
153
|
+
});
|
|
154
|
+
case 28:
|
|
67
155
|
newResult = _context.sent;
|
|
68
156
|
if (!(oldResult && !newResult)) {
|
|
69
|
-
_context.next =
|
|
157
|
+
_context.next = 31;
|
|
70
158
|
break;
|
|
71
159
|
}
|
|
72
160
|
return _context.abrupt("return", oldResult);
|
|
73
|
-
case
|
|
161
|
+
case 31:
|
|
74
162
|
return _context.abrupt("return", _objectSpread(_objectSpread({}, oldResult !== null && oldResult !== void 0 ? oldResult : {}), {}, {
|
|
75
|
-
'ufo:vc:rev': [].concat(_toConsumableArray((
|
|
163
|
+
'ufo:vc:rev': [].concat(_toConsumableArray((_ref3 = oldResult === null || oldResult === void 0 ? void 0 : oldResult['ufo:vc:rev']) !== null && _ref3 !== void 0 ? _ref3 : []), _toConsumableArray(newResult !== null && newResult !== void 0 ? newResult : []))
|
|
76
164
|
}));
|
|
77
|
-
case
|
|
165
|
+
case 32:
|
|
78
166
|
case "end":
|
|
79
167
|
return _context.stop();
|
|
80
168
|
}
|
|
@@ -88,23 +176,25 @@ var VCObserverWrapper = /*#__PURE__*/function () {
|
|
|
88
176
|
}, {
|
|
89
177
|
key: "setSSRElement",
|
|
90
178
|
value: function setSSRElement(element) {
|
|
91
|
-
var _this$
|
|
92
|
-
(_this$
|
|
179
|
+
var _this$oldVCObserver8;
|
|
180
|
+
(_this$oldVCObserver8 = this.oldVCObserver) === null || _this$oldVCObserver8 === void 0 || _this$oldVCObserver8.setSSRElement(element);
|
|
93
181
|
}
|
|
94
182
|
}, {
|
|
95
183
|
key: "setReactRootRenderStart",
|
|
96
184
|
value: function setReactRootRenderStart(startTime) {
|
|
97
|
-
var _this$
|
|
98
|
-
(_this$
|
|
185
|
+
var _this$oldVCObserver9;
|
|
186
|
+
(_this$oldVCObserver9 = this.oldVCObserver) === null || _this$oldVCObserver9 === void 0 || _this$oldVCObserver9.setReactRootRenderStart(startTime || performance.now());
|
|
99
187
|
}
|
|
100
188
|
}, {
|
|
101
189
|
key: "setReactRootRenderStop",
|
|
102
190
|
value: function setReactRootRenderStop(stopTime) {
|
|
103
|
-
var _this$
|
|
104
|
-
(_this$
|
|
191
|
+
var _this$oldVCObserver10;
|
|
192
|
+
(_this$oldVCObserver10 = this.oldVCObserver) === null || _this$oldVCObserver10 === void 0 || _this$oldVCObserver10.setReactRootRenderStop(stopTime || performance.now());
|
|
105
193
|
}
|
|
106
194
|
}]);
|
|
107
|
-
}();
|
|
195
|
+
}();
|
|
196
|
+
|
|
197
|
+
// Some products set this variable to indicate it is running in SSR
|
|
108
198
|
var isServer = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__SERVER__);
|
|
109
199
|
// Other products set this other variable to indicate it is running in SSR
|
|
110
200
|
var isReactSSR = typeof process !== 'undefined' && Boolean(((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR) || false);
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; } } }; }
|
|
3
3
|
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; } }
|
|
4
4
|
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; }
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { isVCRevisionEnabled } from '../../config';
|
|
6
7
|
import { getPageVisibilityState } from '../../hidden-timing';
|
|
7
8
|
import { getRevisions } from './revisions/revisions';
|
|
@@ -24,7 +25,7 @@ function createVCDetails(calculatedVC, shouldHaveVCmetric) {
|
|
|
24
25
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25
26
|
var key = _step.value;
|
|
26
27
|
details[key] = {
|
|
27
|
-
t: VC[key],
|
|
28
|
+
t: VC[key] || -1,
|
|
28
29
|
e: VCBox[key] || READONLY_EMPTY_ARRAY
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -45,8 +46,13 @@ export function getVCRevisionsData(_ref) {
|
|
|
45
46
|
multiHeatmap = _ref.multiHeatmap,
|
|
46
47
|
ssr = _ref.ssr,
|
|
47
48
|
calculatedVC = _ref.calculatedVC,
|
|
48
|
-
calculatedVCNext = _ref.calculatedVCNext
|
|
49
|
-
|
|
49
|
+
calculatedVCNext = _ref.calculatedVCNext,
|
|
50
|
+
experienceKey = _ref.experienceKey;
|
|
51
|
+
var isTTVCv3Enabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? isVCRevisionEnabled('fy25.03', experienceKey) : isVCRevisionEnabled('fy25.03');
|
|
52
|
+
|
|
53
|
+
// As part of `platform_ufo_vc_enable_revisions_by_experience`, we are looking to turn off the `multiHeatmap` branch of code
|
|
54
|
+
// for calculating TTVC, and instead rely on existing values already available, e.g. `calculatedVC` and `calculatedVCNext`
|
|
55
|
+
if (!isTTVCv3Enabled && !fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
50
56
|
if (!multiHeatmap) {
|
|
51
57
|
return null;
|
|
52
58
|
}
|
|
@@ -69,29 +75,48 @@ export function getVCRevisionsData(_ref) {
|
|
|
69
75
|
clean: isVCClean
|
|
70
76
|
}));
|
|
71
77
|
}
|
|
72
|
-
|
|
73
|
-
// Calculate these conditions once
|
|
74
78
|
var pageVisibilityUpToTTAI = getPageVisibilityState(interaction.start, interaction.end);
|
|
75
79
|
var isVisiblePageVisibleUpToTTAI = pageVisibilityUpToTTAI === 'visible';
|
|
76
80
|
var shouldHaveVCmetric = isVCClean && !isEventAborted && isVisiblePageVisibleUpToTTAI;
|
|
81
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
82
|
+
var availableVCRevisionPayloads = [];
|
|
83
|
+
if (isVCRevisionEnabled('fy25.01', experienceKey)) {
|
|
84
|
+
availableVCRevisionPayloads.push({
|
|
85
|
+
revision: 'fy25.01',
|
|
86
|
+
clean: isVCClean,
|
|
87
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
88
|
+
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (isVCRevisionEnabled('fy25.02', experienceKey)) {
|
|
92
|
+
availableVCRevisionPayloads.push({
|
|
93
|
+
revision: 'fy25.02',
|
|
94
|
+
clean: isVCClean,
|
|
95
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
96
|
+
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), availableVCRevisionPayloads);
|
|
100
|
+
} else {
|
|
101
|
+
// Create the V2 revision object which is always needed
|
|
102
|
+
var ttvcV2Revision = {
|
|
103
|
+
revision: 'fy25.02',
|
|
104
|
+
clean: isVCClean,
|
|
105
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVCNext.VC['90'] : null,
|
|
106
|
+
vcDetails: createVCDetails(calculatedVCNext, shouldHaveVCmetric)
|
|
107
|
+
};
|
|
108
|
+
var isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01');
|
|
109
|
+
if (isTTVCv1Disabled) {
|
|
110
|
+
return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
|
|
111
|
+
}
|
|
77
112
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV2Revision]);
|
|
113
|
+
// Only create ttvcV1Revision when we're actually going to use it
|
|
114
|
+
var ttvcV1Revision = {
|
|
115
|
+
revision: 'fy25.01',
|
|
116
|
+
clean: isVCClean,
|
|
117
|
+
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
118
|
+
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
119
|
+
};
|
|
120
|
+
return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV1Revision, ttvcV2Revision]);
|
|
87
121
|
}
|
|
88
|
-
|
|
89
|
-
// Only create ttvcV1Revision when we're actually going to use it
|
|
90
|
-
var ttvcV1Revision = {
|
|
91
|
-
revision: 'fy25.01',
|
|
92
|
-
clean: isVCClean,
|
|
93
|
-
'metric:vc90': shouldHaveVCmetric ? calculatedVC.VC['90'] : null,
|
|
94
|
-
vcDetails: createVCDetails(calculatedVC, shouldHaveVCmetric)
|
|
95
|
-
};
|
|
96
|
-
return _defineProperty({}, "".concat(fullPrefix, "vc:rev"), [ttvcV1Revision, ttvcV2Revision]);
|
|
97
122
|
}
|
|
@@ -11,6 +11,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
11
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
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { isVCRevisionEnabled } from '../../config';
|
|
14
|
+
import { getActiveInteraction } from '../../interaction-metrics';
|
|
14
15
|
import { attachAbortListeners } from './attachAbortListeners';
|
|
15
16
|
import { getVCRevisionsData } from './getVCRevisionsData';
|
|
16
17
|
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
@@ -98,11 +99,11 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
98
99
|
});
|
|
99
100
|
_defineProperty(this, "getVCResult", /*#__PURE__*/function () {
|
|
100
101
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
101
|
-
var start, stop, tti, prefix, ssr, vc, isEventAborted, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, speedIndex, isTTVCv3Enabled;
|
|
102
|
+
var start, stop, tti, prefix, ssr, vc, isEventAborted, experienceKey, startTime, fullPrefix, rawData, abortReason, abortReasonInfo, heatmap, heatmapNext, outOfBoundaryInfo, totalTime, componentsLog, viewport, devToolsEnabled, ratios, multiHeatmap, isTTVCv1Disabled, vcAbortedResultWithRevisions, ttvcV1Result, VC, VCBox, VCEntries, totalPainted, _componentsLog, vcNext, outOfBoundary, stopTime, ttvcV1DevToolInfo, ttvcV2DevToolInfo, isVCClean, revisionsData, speedIndex, isTTVCv3Enabled;
|
|
102
103
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
103
104
|
while (1) switch (_context.prev = _context.next) {
|
|
104
105
|
case 0:
|
|
105
|
-
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc, isEventAborted = _ref3.isEventAborted;
|
|
106
|
+
start = _ref3.start, stop = _ref3.stop, tti = _ref3.tti, prefix = _ref3.prefix, ssr = _ref3.ssr, vc = _ref3.vc, isEventAborted = _ref3.isEventAborted, experienceKey = _ref3.experienceKey;
|
|
106
107
|
startTime = performance.now(); // add local measurement
|
|
107
108
|
fullPrefix = prefix !== undefined && prefix !== '' ? "".concat(prefix, ":") : '';
|
|
108
109
|
rawData = vc !== undefined ? vc : _this.getVCRawData();
|
|
@@ -113,7 +114,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
113
114
|
return _context.abrupt("return", {});
|
|
114
115
|
case 6:
|
|
115
116
|
abortReason = rawData.abortReason, abortReasonInfo = rawData.abortReasonInfo, heatmap = rawData.heatmap, heatmapNext = rawData.heatmapNext, outOfBoundaryInfo = rawData.outOfBoundaryInfo, totalTime = rawData.totalTime, componentsLog = rawData.componentsLog, viewport = rawData.viewport, devToolsEnabled = rawData.devToolsEnabled, ratios = rawData.ratios, multiHeatmap = rawData.multiHeatmap;
|
|
116
|
-
isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01'); // NOTE: as part of platform_ufo_add_vc_abort_reason_by_revisions feature,
|
|
117
|
+
isTTVCv1Disabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? !isVCRevisionEnabled('fy25.01', experienceKey) : !isVCRevisionEnabled('fy25.01'); // NOTE: as part of platform_ufo_add_vc_abort_reason_by_revisions feature,
|
|
117
118
|
// we want to report abort by scroll events the same way as other abort reasons
|
|
118
119
|
// i.e. not have the concept of `abortReason.blocking` anymore
|
|
119
120
|
if (!(abortReasonInfo !== null && fg('platform_ufo_add_vc_abort_reason_by_revisions'))) {
|
|
@@ -301,7 +302,8 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
301
302
|
VC: vcNext.VC,
|
|
302
303
|
VCBox: vcNext.VCBox
|
|
303
304
|
},
|
|
304
|
-
isEventAborted: isEventAborted
|
|
305
|
+
isEventAborted: isEventAborted,
|
|
306
|
+
experienceKey: experienceKey
|
|
305
307
|
});
|
|
306
308
|
speedIndex = _defineProperty(_defineProperty({}, "ufo:speedIndex", isTTVCv1Disabled ? vcNext.VCEntries.speedIndex : VCEntries.speedIndex), "ufo:next:speedIndex", vcNext.VCEntries.speedIndex);
|
|
307
309
|
if (!isTTVCv1Disabled) {
|
|
@@ -310,7 +312,7 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
310
312
|
}
|
|
311
313
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty({}, "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
|
|
312
314
|
case 32:
|
|
313
|
-
isTTVCv3Enabled = isVCRevisionEnabled('fy25.03');
|
|
315
|
+
isTTVCv3Enabled = fg('platform_ufo_vc_enable_revisions_by_experience') ? isVCRevisionEnabled('fy25.03', experienceKey) : isVCRevisionEnabled('fy25.03');
|
|
314
316
|
return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
315
317
|
'metrics:vc': VC
|
|
316
318
|
}, "".concat(fullPrefix, "vc:state"), true), "".concat(fullPrefix, "vc:clean"), isVCClean), "".concat(fullPrefix, "vc:dom"), VCBox), "".concat(fullPrefix, "vc:updates"), isTTVCv3Enabled ? undefined : VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:size"), viewport), "".concat(fullPrefix, "vc:time"), Math.round(totalTime + (stopTime - startTime))), "".concat(fullPrefix, "vc:total"), totalPainted), "".concat(fullPrefix, "vc:ratios"), ratios), outOfBoundary), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(fullPrefix, "vc:next"), vcNext.VC), "".concat(fullPrefix, "vc:next:updates"), isTTVCv3Enabled ? undefined : vcNext.VCEntries.rel.slice(0, 50)), "".concat(fullPrefix, "vc:next:dom"), vcNext.VCBox), "".concat(fullPrefix, "vc:ignored"), _this.getIgnoredElements(componentsLog)), revisionsData), speedIndex));
|
|
@@ -327,7 +329,12 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
327
329
|
_defineProperty(this, "handleUpdate", function (rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue) {
|
|
328
330
|
_this.measureStart();
|
|
329
331
|
_this.legacyHandleUpdate(rawTime, intersectionRect, targetName, element, type, ignoreReason, attributeName, oldValue, newValue);
|
|
330
|
-
|
|
332
|
+
var isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03');
|
|
333
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
334
|
+
var interaction = getActiveInteraction();
|
|
335
|
+
isTTVCv3Disabled = !isVCRevisionEnabled('fy25.03', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
336
|
+
}
|
|
337
|
+
if (isTTVCv3Disabled) {
|
|
331
338
|
_this.onViewportChangeDetected({
|
|
332
339
|
timestamp: rawTime,
|
|
333
340
|
intersectionRect: intersectionRect,
|
|
@@ -351,6 +358,10 @@ export var VCObserver = /*#__PURE__*/function () {
|
|
|
351
358
|
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmapNext);
|
|
352
359
|
}
|
|
353
360
|
var isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01');
|
|
361
|
+
if (fg('platform_ufo_vc_enable_revisions_by_experience')) {
|
|
362
|
+
var interaction = getActiveInteraction();
|
|
363
|
+
isTTVCv1Disabled = !isVCRevisionEnabled('fy25.01', interaction === null || interaction === void 0 ? void 0 : interaction.ufoName);
|
|
364
|
+
}
|
|
354
365
|
if (!isTTVCv1Disabled && (!ignoreReason || ignoreReason === 'not-visible') && type !== 'attr') {
|
|
355
366
|
_this.applyChangesToHeatMap(mappedValues, time, _this.heatmap);
|
|
356
367
|
}
|
|
@@ -202,7 +202,7 @@ export type BM3Event = {
|
|
|
202
202
|
pageVisibleState?: string;
|
|
203
203
|
type: string;
|
|
204
204
|
};
|
|
205
|
-
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type' | 'experimentalVC90' | 'experimentalTTAI'>;
|
|
205
|
+
export type LastInteractionFinishInfo = Pick<InteractionMetrics, 'ufoName' | 'start' | 'end' | 'id' | 'abortReason' | 'abortedByInteractionName' | 'routeName' | 'type' | 'experimentalVC90' | 'experimentalTTAI' | 'errors'>;
|
|
206
206
|
export type PostInteractionLogOutput = {
|
|
207
207
|
lastInteractionFinish: LastInteractionFinishInfo;
|
|
208
208
|
reactProfilerTimings?: ReactProfilerTiming[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPayloads } from '../create-payload';
|
|
2
2
|
import { LabelStack } from '../interaction-context';
|
|
3
3
|
import { VCObserver } from '../vc/vc-observer';
|
|
4
|
-
import type { AbortReasonType, ApdexType, InteractionType, SegmentInfo } from './common/types';
|
|
4
|
+
import type { AbortReasonType, ApdexType, InteractionError, InteractionType, SegmentInfo } from './common/types';
|
|
5
5
|
import type { RevisionPayload } from './vc/types';
|
|
6
6
|
type ExtractPromise<T> = T extends Promise<infer U> ? U : never;
|
|
7
7
|
export type PageVisibility = 'hidden' | 'mixed' | 'visible';
|
|
@@ -135,6 +135,7 @@ export type ReactUFOPayload = {
|
|
|
135
135
|
segments: SegmentInfo[] | RootSegment;
|
|
136
136
|
reactProfilerTimings: ReactProfilerTiming[];
|
|
137
137
|
holdInfo: HoldInfo[];
|
|
138
|
+
errors: InteractionError[];
|
|
138
139
|
};
|
|
139
140
|
'ufo:vc:rev': RevisionPayload;
|
|
140
141
|
'ufo:vc:ratios': Record<string, number>;
|
|
@@ -143,6 +144,8 @@ export type ReactUFOPayload = {
|
|
|
143
144
|
h: number;
|
|
144
145
|
};
|
|
145
146
|
'ufo:vc:time': number;
|
|
147
|
+
'ufo:speedIndex'?: number;
|
|
148
|
+
'ufo:vc:ignored'?: string[];
|
|
146
149
|
'ufo:vc:abort:reason'?: string;
|
|
147
150
|
'ufo:vc:state'?: boolean;
|
|
148
151
|
'ufo:vc:clean'?: boolean;
|
|
@@ -161,9 +164,7 @@ export type ReactUFOPayload = {
|
|
|
161
164
|
elements: string[];
|
|
162
165
|
}>;
|
|
163
166
|
'ufo:vc:next:dom'?: Record<VCParts, string[]>;
|
|
164
|
-
'ufo:vc:ignored'?: string[];
|
|
165
167
|
'metric:vc90'?: number;
|
|
166
|
-
'ufo:speedIndex'?: number;
|
|
167
168
|
'ufo:next:speedIndex'?: number;
|
|
168
169
|
'ufo:vc:updates:next'?: Array<{
|
|
169
170
|
time: number;
|
|
@@ -173,4 +174,49 @@ export type ReactUFOPayload = {
|
|
|
173
174
|
};
|
|
174
175
|
};
|
|
175
176
|
};
|
|
177
|
+
type LateElement = {
|
|
178
|
+
time: number;
|
|
179
|
+
element: string;
|
|
180
|
+
viewportHeatmapPercentage: number;
|
|
181
|
+
};
|
|
182
|
+
export type PostInteractionLogPayload = {
|
|
183
|
+
actionSubject: 'experience';
|
|
184
|
+
action: 'measured';
|
|
185
|
+
eventType: 'operational';
|
|
186
|
+
source: 'measured';
|
|
187
|
+
tags: ['observability'];
|
|
188
|
+
attributes: {
|
|
189
|
+
properties: {
|
|
190
|
+
'event:hostname': string;
|
|
191
|
+
'event:product': string;
|
|
192
|
+
'event:schema': '1.0.0';
|
|
193
|
+
'event:source': {
|
|
194
|
+
name: 'react-ufo/web';
|
|
195
|
+
version: '1.0.1';
|
|
196
|
+
};
|
|
197
|
+
'event:region': string;
|
|
198
|
+
'experience:key': 'custom.post-interaction-logs';
|
|
199
|
+
postInteractionLog: {
|
|
200
|
+
lastInteractionFinish: {
|
|
201
|
+
ufoName: string;
|
|
202
|
+
start: number;
|
|
203
|
+
end: number;
|
|
204
|
+
id: string;
|
|
205
|
+
routeName: string;
|
|
206
|
+
type: InteractionType;
|
|
207
|
+
errors: InteractionError[];
|
|
208
|
+
ttai: number;
|
|
209
|
+
vc90: number;
|
|
210
|
+
vcClean: boolean;
|
|
211
|
+
};
|
|
212
|
+
revisedEndTime: number;
|
|
213
|
+
revisedTtai: number;
|
|
214
|
+
revisedVC90: number;
|
|
215
|
+
vcClean: boolean;
|
|
216
|
+
lateMutations: LateElement[];
|
|
217
|
+
reactProfilerTimings: ReactProfilerTiming[];
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
176
222
|
export {};
|
|
@@ -74,7 +74,17 @@ export type Config = {
|
|
|
74
74
|
readonly ssr?: boolean;
|
|
75
75
|
readonly ssrWhitelist?: string[];
|
|
76
76
|
readonly stopVCAtInteractionFinish?: boolean;
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* The revisions of TTVC that will be calculated
|
|
79
|
+
* - `all` is the TTVC revisions that are used on a product level
|
|
80
|
+
* - `byExperience` is the version that is used on an experience level.
|
|
81
|
+
* Note that an entry in the `byExperience` config should only be a SUBSET of the `all` config,
|
|
82
|
+
* i.e. every element for all `byExperience` entry configs should exist in the `all` config
|
|
83
|
+
*/
|
|
84
|
+
readonly enabledVCRevisions?: {
|
|
85
|
+
all: readonly TTVCRevisions[];
|
|
86
|
+
byExperience?: Record<string, readonly TTVCRevisions[]>;
|
|
87
|
+
};
|
|
78
88
|
};
|
|
79
89
|
readonly postInteractionLog?: {
|
|
80
90
|
readonly enabled?: boolean;
|
|
@@ -99,8 +109,9 @@ export type Config = {
|
|
|
99
109
|
};
|
|
100
110
|
export declare function setUFOConfig(newConfig: Config): void;
|
|
101
111
|
export declare function getConfig(): Config | undefined;
|
|
102
|
-
export declare function getEnabledVCRevisions(): TTVCRevisions[];
|
|
103
|
-
export declare function isVCRevisionEnabled(revision: TTVCRevisions): boolean;
|
|
112
|
+
export declare function getEnabledVCRevisions(experienceKey?: string): readonly TTVCRevisions[];
|
|
113
|
+
export declare function isVCRevisionEnabled(revision: TTVCRevisions, experienceKey?: string): boolean;
|
|
114
|
+
export declare function getMostRecentVCRevision(experienceKey?: string): TTVCRevisions;
|
|
104
115
|
export declare function getInteractionRate(name: string, interactionKind: InteractionKind): number;
|
|
105
116
|
export declare function getExperimentalInteractionRate(name: string, interactionType: InteractionType): number;
|
|
106
117
|
export declare function getPostInteractionRate(name: string, interactionType: InteractionType): number;
|
|
@@ -26,12 +26,13 @@ declare function createPostInteractionLogPayload({ lastInteractionFinish, reactP
|
|
|
26
26
|
vc90: number | null;
|
|
27
27
|
vcClean: boolean;
|
|
28
28
|
type: import("../common").InteractionType;
|
|
29
|
-
id: string;
|
|
30
29
|
abortReason?: import("../common").AbortReasonType | undefined;
|
|
30
|
+
id: string;
|
|
31
31
|
abortedByInteractionName?: string | undefined;
|
|
32
32
|
routeName: string | null;
|
|
33
|
-
experimentalTTAI?: number | undefined;
|
|
34
33
|
experimentalVC90?: number | undefined;
|
|
34
|
+
experimentalTTAI?: number | undefined;
|
|
35
|
+
errors: import("../common").InteractionError[];
|
|
35
36
|
};
|
|
36
37
|
revisedEndTime: number;
|
|
37
38
|
revisedTtai: number;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type LastInteractionFinishInfo, type PostInteractionLogOutput, type ReactProfilerTiming } from '../common/common/types';
|
|
2
2
|
import type { VCResult } from '../common/vc/types';
|
|
3
3
|
import type { LabelStack } from '../interaction-context';
|
|
4
|
-
import type { VCObserverOptions } from '../vc/types';
|
|
5
|
-
import { VCObserver } from '../vc/vc-observer';
|
|
4
|
+
import type { VCObserverInterface, VCObserverOptions } from '../vc/types';
|
|
6
5
|
export default class PostInteractionLog {
|
|
7
6
|
/**
|
|
8
7
|
* Basic info about interaction that has just finished
|
|
@@ -19,7 +18,7 @@ export default class PostInteractionLog {
|
|
|
19
18
|
/**
|
|
20
19
|
* independent VC observer, that observes until `custom.post-interaction-logs` event is sent
|
|
21
20
|
*/
|
|
22
|
-
vcObserver:
|
|
21
|
+
vcObserver: VCObserverInterface | null;
|
|
23
22
|
vcObserverSSRConfig: {
|
|
24
23
|
ssr: number | undefined;
|
|
25
24
|
} | null;
|
|
@@ -62,7 +61,7 @@ export default class PostInteractionLog {
|
|
|
62
61
|
* Basic details about the finished interaction will be recorded
|
|
63
62
|
* A timeout will be setup to send the post interaction observation after some time.
|
|
64
63
|
*/
|
|
65
|
-
onInteractionComplete({ ufoName, start, end, id, abortReason, abortedByInteractionName, routeName, type, experimentalTTAI, experimentalVC90, }: LastInteractionFinishInfo): void;
|
|
64
|
+
onInteractionComplete({ ufoName, start, end, id, abortReason, abortedByInteractionName, routeName, type, experimentalTTAI, experimentalVC90, errors, }: LastInteractionFinishInfo): void;
|
|
66
65
|
/**
|
|
67
66
|
* This fn should be invoked when a React render happens after interaction has finished
|
|
68
67
|
*/
|
package/dist/types/vc/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VCRawDataType, VCResult } from '../common/vc/types';
|
|
2
|
+
import type { GetVCResultType, VCObserverInterface, VCObserverOptions } from './types';
|
|
2
3
|
declare global {
|
|
3
4
|
var __vcObserver: VCObserverInterface;
|
|
4
5
|
}
|
|
6
|
+
export declare class VCObserverWrapper implements VCObserverInterface {
|
|
7
|
+
private oldVCObserver;
|
|
8
|
+
private newVCObserver;
|
|
9
|
+
constructor(opts?: VCObserverOptions);
|
|
10
|
+
start({ startTime, experienceKey }: {
|
|
11
|
+
startTime: number;
|
|
12
|
+
experienceKey: string;
|
|
13
|
+
}): void;
|
|
14
|
+
stop(experienceKey?: string): void;
|
|
15
|
+
getVCRawData(): VCRawDataType | null;
|
|
16
|
+
getVCResult(param: GetVCResultType): Promise<VCResult>;
|
|
17
|
+
setSSRElement(element: HTMLElement): void;
|
|
18
|
+
setReactRootRenderStart(startTime: number): void;
|
|
19
|
+
setReactRootRenderStop(stopTime: number): void;
|
|
20
|
+
}
|
|
5
21
|
export declare function isEnvironmentSupported(): boolean;
|
|
6
22
|
export declare function getVCObserver(opts?: VCObserverOptions): VCObserverInterface;
|
package/dist/types/vc/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type GetVCResultType = {
|
|
|
7
7
|
prefix?: string;
|
|
8
8
|
ssr?: number;
|
|
9
9
|
vc?: VCRawDataType | null;
|
|
10
|
+
experienceKey: string;
|
|
10
11
|
};
|
|
11
12
|
export type SelectorConfig = {
|
|
12
13
|
id: boolean;
|
|
@@ -25,8 +26,9 @@ export type VCObserverOptions = {
|
|
|
25
26
|
export interface VCObserverInterface {
|
|
26
27
|
start(startArg: {
|
|
27
28
|
startTime: number;
|
|
29
|
+
experienceKey?: string;
|
|
28
30
|
}): void;
|
|
29
|
-
stop(): void;
|
|
31
|
+
stop(experienceKey?: string): void;
|
|
30
32
|
getVCRawData(): VCRawDataType | null;
|
|
31
33
|
getVCResult(param: GetVCResultType): Promise<VCResult>;
|
|
32
34
|
setSSRElement(element: HTMLElement): void;
|