@atlaskit/react-ufo 3.13.25 → 3.13.27

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 3.13.27
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175316](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175316)
8
+ [`a2a93696df1b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2a93696df1b8) -
9
+ Add extra non-visual attributes to UFO ignore list
10
+ - [#173438](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/173438)
11
+ [`03117ec2ea74c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/03117ec2ea74c) -
12
+ Update README
13
+
14
+ ## 3.13.26
15
+
16
+ ### Patch Changes
17
+
18
+ - [#175577](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175577)
19
+ [`ab132e5fd6642`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ab132e5fd6642) -
20
+ ensure post-interaction-log events are only for page_load and transition events
21
+ - [#175545](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175545)
22
+ [`b16b0a70a3516`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b16b0a70a3516) -
23
+ bugfix: correctly layout shift entry sources being undefined in TTVC v3 logic
24
+
3
25
  ## 3.13.25
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -10,7 +10,7 @@ Parts of React UFO that need to be scoped within @atlaskit
10
10
 
11
11
  In one terminal:
12
12
 
13
- ```
13
+ ```shell
14
14
  cd platform && nvm use && yarn
15
15
  yarn start:rspack react-ufo
16
16
  ```
@@ -19,7 +19,7 @@ This will start the dev server, accessible via http://localhost:9000.
19
19
 
20
20
  Then in a separate terminal:
21
21
 
22
- ```
22
+ ```shell
23
23
  cd platform && nvm use
24
24
  yarn test:integration packages/react-ufo/atlaskit/__tests__/ --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0
25
25
  ```
@@ -35,6 +35,6 @@ increase the following:
35
35
 
36
36
  Example:
37
37
 
38
- ```
38
+ ```shell
39
39
  yarn test:integration packages/react-ufo/atlaskit/__tests__/playwright/base.spec.ts --retries 0 --reporter list --reuse-dev-server --project=desktop-chromium --max-failures=0 --repeat-each 50 --workers 50
40
40
  ```
@@ -177,6 +177,9 @@ function getPostInteractionRate(name, interactionType) {
177
177
  if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
178
178
  return 0;
179
179
  }
180
+ if (interactionType !== 'page_load' && interactionType !== 'transition') {
181
+ return 0;
182
+ }
180
183
  if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
181
184
  return postInteractionLog.rates[name];
182
185
  }
@@ -124,6 +124,9 @@ function createPostInteractionLogPayload(_ref2) {
124
124
  if (!config) {
125
125
  throw Error('UFO Configuration not provided');
126
126
  }
127
+ if (!lastInteractionFinish) {
128
+ return null;
129
+ }
127
130
  var ufoName = (0, _utils.sanitizeUfoName)(lastInteractionFinish.ufoName);
128
131
  var rate = (0, _config.getPostInteractionRate)(ufoName, lastInteractionFinish.type);
129
132
  if (!(0, _coinflip.default)(rate)) {
@@ -45,6 +45,6 @@ function getActiveTraceHttpRequestHeaders(_url) {
45
45
  return (0, _makeTraceHttpRequestHeaders.makeTraceHttpRequestHeaders)(traceId, spanId);
46
46
  }
47
47
  function getActiveTraceAsQueryParams(_url) {
48
- var traceHeaders = getActiveTraceHttpRequestHeaders(_url);
48
+ var traceHeaders = getActiveTraceHttpRequestHeaders();
49
49
  return traceHeaders ? new URLSearchParams(traceHeaders).toString().toLowerCase() : null;
50
50
  }
@@ -25,7 +25,7 @@ var CONSIDERED_ENTRY_TYPE = ['mutation:child-element', 'mutation:element', 'muta
25
25
  var KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = exports.KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = ['data-drop-target-for-element', 'draggable'];
26
26
 
27
27
  // Common aria attributes that don't cause visual layout shifts
28
- var NON_VISUAL_ARIA_ATTRIBUTES = exports.NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-live'];
28
+ var NON_VISUAL_ARIA_ATTRIBUTES = exports.NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-atomic', 'aria-live'];
29
29
  var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCCalculator) {
30
30
  function VCCalculator_FY25_03() {
31
31
  (0, _classCallCheck2.default)(this, VCCalculator_FY25_03);
@@ -47,7 +47,7 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
47
47
  if (attributeName === 'data-aui-version' && (0, _platformFeatureFlags.fg)('platform_ufo_filter_out_aui_attribute_changes')) {
48
48
  return false;
49
49
  }
50
- if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
50
+ if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || (attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck') && (0, _platformFeatureFlags.fg)('platform_ufo_ignore_extra_attributes') || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
51
51
  return false;
52
52
  }
53
53
  return true;
@@ -31,9 +31,8 @@ function createPerformanceObserver(_ref) {
31
31
  try {
32
32
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
33
33
  var entry = _step.value;
34
- if (entry.entryType === 'layout-shift') {
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ if (entry.entryType === 'layout-shift' && 'sources' in entry) {
35
+ // see https://developer.mozilla.org/en-US/docs/Web/API/LayoutShiftAttribution for more info
37
36
  var changedRects = entry.sources.reduceRight(function (acc, attr) {
38
37
  acc.push({
39
38
  rect: convertPhysicalToLogicalResolution(attr.currentRect),
@@ -157,6 +157,9 @@ export function getPostInteractionRate(name, interactionType) {
157
157
  if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
158
158
  return 0;
159
159
  }
160
+ if (interactionType !== 'page_load' && interactionType !== 'transition') {
161
+ return 0;
162
+ }
160
163
  if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
161
164
  return postInteractionLog.rates[name];
162
165
  }
@@ -111,6 +111,9 @@ function createPostInteractionLogPayload({
111
111
  if (!config) {
112
112
  throw Error('UFO Configuration not provided');
113
113
  }
114
+ if (!lastInteractionFinish) {
115
+ return null;
116
+ }
114
117
  const ufoName = sanitizeUfoName(lastInteractionFinish.ufoName);
115
118
  const rate = getPostInteractionRate(ufoName, lastInteractionFinish.type);
116
119
  if (!coinflip(rate)) {
@@ -32,6 +32,6 @@ export function getActiveTraceHttpRequestHeaders(_url) {
32
32
  return makeTraceHttpRequestHeaders(traceId, spanId);
33
33
  }
34
34
  export function getActiveTraceAsQueryParams(_url) {
35
- const traceHeaders = getActiveTraceHttpRequestHeaders(_url);
35
+ const traceHeaders = getActiveTraceHttpRequestHeaders();
36
36
  return traceHeaders ? new URLSearchParams(traceHeaders).toString().toLowerCase() : null;
37
37
  }
@@ -11,7 +11,7 @@ const CONSIDERED_ENTRY_TYPE = ['mutation:child-element', 'mutation:element', 'mu
11
11
  export const KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = ['data-drop-target-for-element', 'draggable'];
12
12
 
13
13
  // Common aria attributes that don't cause visual layout shifts
14
- export const NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-live'];
14
+ export const NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-atomic', 'aria-live'];
15
15
  export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
16
16
  constructor() {
17
17
  super(REVISION_NO);
@@ -29,7 +29,7 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
29
29
  if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
30
30
  return false;
31
31
  }
32
- if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
32
+ if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || (attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck') && fg('platform_ufo_ignore_extra_attributes') || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
33
33
  return false;
34
34
  }
35
35
  return true;
@@ -18,9 +18,8 @@ function createPerformanceObserver({
18
18
  }
19
19
  const performanceObserverCallback = entries => {
20
20
  for (const entry of entries.getEntries()) {
21
- if (entry.entryType === 'layout-shift') {
22
- // Ignored via go/ees005
23
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ if (entry.entryType === 'layout-shift' && 'sources' in entry) {
22
+ // see https://developer.mozilla.org/en-US/docs/Web/API/LayoutShiftAttribution for more info
24
23
  const changedRects = entry.sources.reduceRight((acc, attr) => {
25
24
  acc.push({
26
25
  rect: convertPhysicalToLogicalResolution(attr.currentRect),
@@ -153,6 +153,9 @@ export function getPostInteractionRate(name, interactionType) {
153
153
  if (!(postInteractionLog !== null && postInteractionLog !== void 0 && postInteractionLog.enabled)) {
154
154
  return 0;
155
155
  }
156
+ if (interactionType !== 'page_load' && interactionType !== 'transition') {
157
+ return 0;
158
+ }
156
159
  if (postInteractionLog.rates && typeof postInteractionLog.rates[name] === 'number') {
157
160
  return postInteractionLog.rates[name];
158
161
  }
@@ -117,6 +117,9 @@ function createPostInteractionLogPayload(_ref2) {
117
117
  if (!config) {
118
118
  throw Error('UFO Configuration not provided');
119
119
  }
120
+ if (!lastInteractionFinish) {
121
+ return null;
122
+ }
120
123
  var ufoName = sanitizeUfoName(lastInteractionFinish.ufoName);
121
124
  var rate = getPostInteractionRate(ufoName, lastInteractionFinish.type);
122
125
  if (!coinflip(rate)) {
@@ -33,6 +33,6 @@ export function getActiveTraceHttpRequestHeaders(_url) {
33
33
  return makeTraceHttpRequestHeaders(traceId, spanId);
34
34
  }
35
35
  export function getActiveTraceAsQueryParams(_url) {
36
- var traceHeaders = getActiveTraceHttpRequestHeaders(_url);
36
+ var traceHeaders = getActiveTraceHttpRequestHeaders();
37
37
  return traceHeaders ? new URLSearchParams(traceHeaders).toString().toLowerCase() : null;
38
38
  }
@@ -18,7 +18,7 @@ var CONSIDERED_ENTRY_TYPE = ['mutation:child-element', 'mutation:element', 'muta
18
18
  export var KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = ['data-drop-target-for-element', 'draggable'];
19
19
 
20
20
  // Common aria attributes that don't cause visual layout shifts
21
- export var NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-live'];
21
+ export var NON_VISUAL_ARIA_ATTRIBUTES = ['aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-expanded', 'aria-controls', 'aria-selected', 'aria-checked', 'aria-disabled', 'aria-required', 'aria-current', 'aria-haspopup', 'aria-pressed', 'aria-atomic', 'aria-live'];
22
22
  var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
23
23
  function VCCalculator_FY25_03() {
24
24
  _classCallCheck(this, VCCalculator_FY25_03);
@@ -40,7 +40,7 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
40
40
  if (attributeName === 'data-aui-version' && fg('platform_ufo_filter_out_aui_attribute_changes')) {
41
41
  return false;
42
42
  }
43
- if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
43
+ if (attributeName === 'data-testid' || attributeName === 'data-vc' || attributeName === 'data-ssr-placeholder' || attributeName === 'data-ssr-placeholder-replace' || attributeName === 'data-vc-nvs' || attributeName === 'data-media-vc-wrapper' || (attributeName === 'data-renderer-start-pos' || attributeName === 'data-table-local-id' || attributeName === 'spellcheck') && fg('platform_ufo_ignore_extra_attributes') || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
44
44
  return false;
45
45
  }
46
46
  return true;
@@ -24,9 +24,8 @@ function createPerformanceObserver(_ref) {
24
24
  try {
25
25
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
26
  var entry = _step.value;
27
- if (entry.entryType === 'layout-shift') {
28
- // Ignored via go/ees005
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ if (entry.entryType === 'layout-shift' && 'sources' in entry) {
28
+ // see https://developer.mozilla.org/en-US/docs/Web/API/LayoutShiftAttribution for more info
30
29
  var changedRects = entry.sources.reduceRight(function (acc, attr) {
31
30
  acc.push({
32
31
  rect: convertPhysicalToLogicalResolution(attr.currentRect),
@@ -4,8 +4,8 @@ export declare function setInteractionActiveTrace(interactionId: string, experie
4
4
  export declare function setActiveTrace(traceId: string, spanId: string, type: string): void;
5
5
  export declare function getActiveTrace(): import("./types").TraceIdContext | undefined;
6
6
  export declare function clearActiveTrace(): void;
7
- export declare function getActiveTraceHttpRequestHeaders(_url: string): {
7
+ export declare function getActiveTraceHttpRequestHeaders(_url?: string): {
8
8
  'X-B3-TraceId': string;
9
9
  'X-B3-SpanId': string;
10
10
  } | null;
11
- export declare function getActiveTraceAsQueryParams(_url: string): string | null;
11
+ export declare function getActiveTraceAsQueryParams(_url?: string): string | null;
@@ -4,8 +4,8 @@ export declare function setInteractionActiveTrace(interactionId: string, experie
4
4
  export declare function setActiveTrace(traceId: string, spanId: string, type: string): void;
5
5
  export declare function getActiveTrace(): import("./types").TraceIdContext | undefined;
6
6
  export declare function clearActiveTrace(): void;
7
- export declare function getActiveTraceHttpRequestHeaders(_url: string): {
7
+ export declare function getActiveTraceHttpRequestHeaders(_url?: string): {
8
8
  'X-B3-TraceId': string;
9
9
  'X-B3-SpanId': string;
10
10
  } | null;
11
- export declare function getActiveTraceAsQueryParams(_url: string): string | null;
11
+ export declare function getActiveTraceAsQueryParams(_url?: string): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "3.13.25",
3
+ "version": "3.13.27",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -183,6 +183,9 @@
183
183
  },
184
184
  "platform_ufo_post_interaction_most_recent_vc_rev": {
185
185
  "type": "boolean"
186
+ },
187
+ "platform_ufo_ignore_extra_attributes": {
188
+ "type": "boolean"
186
189
  }
187
190
  }
188
191
  }