@atlaskit/react-ufo 4.2.0 → 4.2.2

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 (23) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/vc/vc-observer-new/get-element-name.js +29 -1
  3. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
  4. package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +1 -1
  5. package/dist/es2019/vc/vc-observer-new/get-element-name.js +29 -1
  6. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
  7. package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +1 -1
  8. package/dist/esm/vc/vc-observer-new/get-element-name.js +29 -1
  9. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +1 -1
  10. package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +1 -1
  11. package/dist/types/create-payload/index.d.ts +1664 -1664
  12. package/dist/types/create-payload/utils/get-browser-metadata.d.ts +5 -5
  13. package/dist/types/interaction-id-context/index.d.ts +0 -1
  14. package/dist/types/placeholder/loosely-lazy/wait-context.d.ts +0 -1
  15. package/dist/types/typing-performance-tracing/index.d.ts +0 -1
  16. package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -1
  17. package/dist/types-ts4.5/create-payload/index.d.ts +1664 -1664
  18. package/dist/types-ts4.5/create-payload/utils/get-browser-metadata.d.ts +5 -5
  19. package/dist/types-ts4.5/interaction-id-context/index.d.ts +0 -1
  20. package/dist/types-ts4.5/placeholder/loosely-lazy/wait-context.d.ts +0 -1
  21. package/dist/types-ts4.5/typing-performance-tracing/index.d.ts +0 -1
  22. package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +1 -1
  23. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9675be5a4df37`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9675be5a4df37) -
8
+ FG cleanup - platform_ufo_ttvc_exclude_data_test_attribute
9
+
10
+ ## 4.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`e4fd6ff836b97`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4fd6ff836b97) -
15
+ Update `error` selector return by TTVC offenders reporting
16
+
3
17
  ## 4.2.0
4
18
 
5
19
  ### Minor Changes
@@ -4,10 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
7
8
  var nameCache = new WeakMap();
8
9
  function getElementName(selectorConfig, element) {
9
10
  if (!(element instanceof HTMLElement)) {
10
- return 'error';
11
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_report_non_htmlelement_selectors')) {
12
+ var elementInstance = 'Unknown';
13
+
14
+ // Types of elements according to LLM
15
+ if (element instanceof Document) {
16
+ elementInstance = 'Document';
17
+ } else if (element instanceof DocumentFragment) {
18
+ elementInstance = 'DocumentFragment';
19
+ } else if (element instanceof Text) {
20
+ elementInstance = 'Text';
21
+ } else if (element instanceof Comment) {
22
+ elementInstance = 'Comment';
23
+ } else if (element instanceof ProcessingInstruction) {
24
+ elementInstance = 'ProcessingInstruction';
25
+ } else if (element instanceof Attr) {
26
+ elementInstance = 'Attr';
27
+ } else if (element instanceof CDATASection) {
28
+ elementInstance = 'CDATASection';
29
+ }
30
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
31
+ var parentElementSelector = getElementName(selectorConfig, element.parentElement);
32
+ return "".concat(parentElementSelector, " > ").concat(elementInstance);
33
+ } else {
34
+ return elementInstance;
35
+ }
36
+ } else {
37
+ return 'error';
38
+ }
11
39
  }
12
40
  var cachedName = nameCache.get(element);
13
41
  if (cachedName) {
@@ -56,7 +56,7 @@ var VCCalculator_FY25_03 = exports.default = /*#__PURE__*/function (_AbstractVCC
56
56
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
57
57
  return false;
58
58
  }
59
- if (attributeName.startsWith('data-test') && (0, _platformFeatureFlags.fg)('platform_ufo_ttvc_exclude_data_test_attribute') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
59
+ if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
60
60
  return false;
61
61
  }
62
62
  return true;
@@ -422,7 +422,7 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
422
422
  (_this$performanceObse = this.performanceObserver) === null || _this$performanceObse === void 0 || _this$performanceObse.observe({
423
423
  type: 'layout-shift',
424
424
  buffered: true,
425
- // @ts-ignore-error
425
+ // @ts-ignore -error
426
426
  durationThreshold: 30
427
427
  });
428
428
  this.isStarted = true;
@@ -1,7 +1,35 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  const nameCache = new WeakMap();
2
3
  function getElementName(selectorConfig, element) {
3
4
  if (!(element instanceof HTMLElement)) {
4
- return 'error';
5
+ if (fg('platform_ufo_report_non_htmlelement_selectors')) {
6
+ let elementInstance = 'Unknown';
7
+
8
+ // Types of elements according to LLM
9
+ if (element instanceof Document) {
10
+ elementInstance = 'Document';
11
+ } else if (element instanceof DocumentFragment) {
12
+ elementInstance = 'DocumentFragment';
13
+ } else if (element instanceof Text) {
14
+ elementInstance = 'Text';
15
+ } else if (element instanceof Comment) {
16
+ elementInstance = 'Comment';
17
+ } else if (element instanceof ProcessingInstruction) {
18
+ elementInstance = 'ProcessingInstruction';
19
+ } else if (element instanceof Attr) {
20
+ elementInstance = 'Attr';
21
+ } else if (element instanceof CDATASection) {
22
+ elementInstance = 'CDATASection';
23
+ }
24
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
25
+ const parentElementSelector = getElementName(selectorConfig, element.parentElement);
26
+ return `${parentElementSelector} > ${elementInstance}`;
27
+ } else {
28
+ return elementInstance;
29
+ }
30
+ } else {
31
+ return 'error';
32
+ }
5
33
  }
6
34
  const cachedName = nameCache.get(element);
7
35
  if (cachedName) {
@@ -38,7 +38,7 @@ export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
38
38
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
39
39
  return false;
40
40
  }
41
- if (attributeName.startsWith('data-test') && fg('platform_ufo_ttvc_exclude_data_test_attribute') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
41
+ if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
42
42
  return false;
43
43
  }
44
44
  return true;
@@ -316,7 +316,7 @@ export default class ViewportObserver {
316
316
  (_this$performanceObse = this.performanceObserver) === null || _this$performanceObse === void 0 ? void 0 : _this$performanceObse.observe({
317
317
  type: 'layout-shift',
318
318
  buffered: true,
319
- // @ts-ignore-error
319
+ // @ts-ignore -error
320
320
  durationThreshold: 30
321
321
  });
322
322
  this.isStarted = true;
@@ -1,7 +1,35 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
1
2
  var nameCache = new WeakMap();
2
3
  function getElementName(selectorConfig, element) {
3
4
  if (!(element instanceof HTMLElement)) {
4
- return 'error';
5
+ if (fg('platform_ufo_report_non_htmlelement_selectors')) {
6
+ var elementInstance = 'Unknown';
7
+
8
+ // Types of elements according to LLM
9
+ if (element instanceof Document) {
10
+ elementInstance = 'Document';
11
+ } else if (element instanceof DocumentFragment) {
12
+ elementInstance = 'DocumentFragment';
13
+ } else if (element instanceof Text) {
14
+ elementInstance = 'Text';
15
+ } else if (element instanceof Comment) {
16
+ elementInstance = 'Comment';
17
+ } else if (element instanceof ProcessingInstruction) {
18
+ elementInstance = 'ProcessingInstruction';
19
+ } else if (element instanceof Attr) {
20
+ elementInstance = 'Attr';
21
+ } else if (element instanceof CDATASection) {
22
+ elementInstance = 'CDATASection';
23
+ }
24
+ if (element.parentElement && element.parentElement instanceof HTMLElement) {
25
+ var parentElementSelector = getElementName(selectorConfig, element.parentElement);
26
+ return "".concat(parentElementSelector, " > ").concat(elementInstance);
27
+ } else {
28
+ return elementInstance;
29
+ }
30
+ } else {
31
+ return 'error';
32
+ }
5
33
  }
6
34
  var cachedName = nameCache.get(element);
7
35
  if (cachedName) {
@@ -49,7 +49,7 @@ var VCCalculator_FY25_03 = /*#__PURE__*/function (_AbstractVCCalculator) {
49
49
  if (!attributeName || KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS.includes(attributeName)) {
50
50
  return false;
51
51
  }
52
- if (attributeName.startsWith('data-test') && fg('platform_ufo_ttvc_exclude_data_test_attribute') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
52
+ if (attributeName.startsWith('data-test') || attributeName === 'data-aui-version' || 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' || attributeName === 'data-auto-scrollable' || attributeName === 'id' || attributeName === 'tabindex' || attributeName === 'data-is-ttvc-ready' || NON_VISUAL_ARIA_ATTRIBUTES.includes(attributeName)) {
53
53
  return false;
54
54
  }
55
55
  return true;
@@ -413,7 +413,7 @@ var ViewportObserver = /*#__PURE__*/function () {
413
413
  (_this$performanceObse = this.performanceObserver) === null || _this$performanceObse === void 0 || _this$performanceObse.observe({
414
414
  type: 'layout-shift',
415
415
  buffered: true,
416
- // @ts-ignore-error
416
+ // @ts-ignore -error
417
417
  durationThreshold: 30
418
418
  });
419
419
  this.isStarted = true;