@atlaskit/react-ufo 4.5.8 → 4.5.10

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,19 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.5.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`071602112aa5e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/071602112aa5e) -
8
+ Set default unknown interaction rate when it is not configured
9
+
10
+ ## 4.5.9
11
+
12
+ ### Patch Changes
13
+
14
+ - [`7cd8d49ea4953`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7cd8d49ea4953) -
15
+ update parameters for useUFOReportError callback
16
+
3
17
  ## 4.5.8
4
18
 
5
19
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.DEFAULT_TTVC_REVISION = exports.CLEANUP_TIMEOUT = void 0;
7
+ exports.UNKNOWN_INTERACTION_RATE = exports.DEFAULT_TTVC_REVISION = exports.CLEANUP_TIMEOUT = void 0;
8
8
  exports.getAwaitBM3TTIList = getAwaitBM3TTIList;
9
9
  exports.getCapabilityRate = getCapabilityRate;
10
10
  exports.getConfig = getConfig;
@@ -30,6 +30,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
30
30
  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) { (0, _defineProperty2.default)(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; }
31
31
  var config;
32
32
  var DEFAULT_TTVC_REVISION = exports.DEFAULT_TTVC_REVISION = 'fy25.03';
33
+ var UNKNOWN_INTERACTION_RATE = exports.UNKNOWN_INTERACTION_RATE = 1000;
33
34
 
34
35
  // Defensively typed, since this is directly user-editable
35
36
  // and they could delete empty members
@@ -123,6 +124,14 @@ function getInteractionRate(name, interactionKind) {
123
124
  return 0;
124
125
  }
125
126
  }
127
+ var isUnknown = name === 'unknown';
128
+ if (isUnknown) {
129
+ if ((rates === null || rates === void 0 ? void 0 : rates[name]) != null) {
130
+ return rates[name];
131
+ }
132
+ // Return default rate for unknown events when no explicit rate is configured
133
+ return UNKNOWN_INTERACTION_RATE;
134
+ }
126
135
  if (rates != null) {
127
136
  // Decide the rate explicitly
128
137
  if (rates[name] != null) {
@@ -22,9 +22,9 @@ var _interactionMetrics = require("../interaction-metrics");
22
22
  * @returns `reportError` function
23
23
  */
24
24
  function useUFOReportError() {
25
- var interaction = (0, _interactionMetrics.getActiveInteraction)();
26
25
  var ufoContext = (0, _interactionContext.useInteractionContext)();
27
26
  var reportError = function reportError(error) {
27
+ var interaction = (0, _interactionMetrics.getActiveInteraction)();
28
28
  if (interaction !== null && interaction !== void 0 && interaction.id) {
29
29
  (0, _interactionMetrics.addError)(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
30
30
  } else {
@@ -1,6 +1,7 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
2
  let config;
3
3
  export const DEFAULT_TTVC_REVISION = 'fy25.03';
4
+ export const UNKNOWN_INTERACTION_RATE = 1000;
4
5
 
5
6
  // Defensively typed, since this is directly user-editable
6
7
  // and they could delete empty members
@@ -99,6 +100,14 @@ export function getInteractionRate(name, interactionKind) {
99
100
  return 0;
100
101
  }
101
102
  }
103
+ const isUnknown = name === 'unknown';
104
+ if (isUnknown) {
105
+ if ((rates === null || rates === void 0 ? void 0 : rates[name]) != null) {
106
+ return rates[name];
107
+ }
108
+ // Return default rate for unknown events when no explicit rate is configured
109
+ return UNKNOWN_INTERACTION_RATE;
110
+ }
102
111
  if (rates != null) {
103
112
  // Decide the rate explicitly
104
113
  if (rates[name] != null) {
@@ -17,9 +17,9 @@ import { addError, addErrorToAll, getActiveInteraction } from '../interaction-me
17
17
  * @returns `reportError` function
18
18
  */
19
19
  export function useUFOReportError() {
20
- const interaction = getActiveInteraction();
21
20
  const ufoContext = useInteractionContext();
22
21
  const reportError = error => {
22
+ const interaction = getActiveInteraction();
23
23
  if (interaction !== null && interaction !== void 0 && interaction.id) {
24
24
  addError(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
25
25
  } else {
@@ -6,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
7
  var config;
8
8
  export var DEFAULT_TTVC_REVISION = 'fy25.03';
9
+ export var UNKNOWN_INTERACTION_RATE = 1000;
9
10
 
10
11
  // Defensively typed, since this is directly user-editable
11
12
  // and they could delete empty members
@@ -99,6 +100,14 @@ export function getInteractionRate(name, interactionKind) {
99
100
  return 0;
100
101
  }
101
102
  }
103
+ var isUnknown = name === 'unknown';
104
+ if (isUnknown) {
105
+ if ((rates === null || rates === void 0 ? void 0 : rates[name]) != null) {
106
+ return rates[name];
107
+ }
108
+ // Return default rate for unknown events when no explicit rate is configured
109
+ return UNKNOWN_INTERACTION_RATE;
110
+ }
102
111
  if (rates != null) {
103
112
  // Decide the rate explicitly
104
113
  if (rates[name] != null) {
@@ -17,9 +17,9 @@ import { addError, addErrorToAll, getActiveInteraction } from '../interaction-me
17
17
  * @returns `reportError` function
18
18
  */
19
19
  export function useUFOReportError() {
20
- var interaction = getActiveInteraction();
21
20
  var ufoContext = useInteractionContext();
22
21
  var reportError = function reportError(error) {
22
+ var interaction = getActiveInteraction();
23
23
  if (interaction !== null && interaction !== void 0 && interaction.id) {
24
24
  addError(interaction.id, error.name, (ufoContext === null || ufoContext === void 0 ? void 0 : ufoContext.labelStack) || null, error.name, error.errorMessage, error.errorStack, error.forcedError);
25
25
  } else {
@@ -37,6 +37,7 @@ type Rates = {
37
37
  };
38
38
  export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
39
39
  export declare const DEFAULT_TTVC_REVISION = "fy25.03";
40
+ export declare const UNKNOWN_INTERACTION_RATE = 1000;
40
41
  export type ReactHydrationStats = {
41
42
  /**
42
43
  * Indicates if hydration of SSR content failed, so React switching to client-side rendering and re-rendered from scratch.
@@ -14,4 +14,4 @@ import { type InteractionError } from '../interaction-metrics';
14
14
  * ```
15
15
  * @returns `reportError` function
16
16
  */
17
- export declare function useUFOReportError(): (error: InteractionError) => void;
17
+ export declare function useUFOReportError(): (error: Omit<InteractionError, "labelStack" | "errorType">) => void;
@@ -37,6 +37,7 @@ type Rates = {
37
37
  };
38
38
  export type TTVCRevision = 'fy25.01' | 'fy25.02' | 'fy25.03';
39
39
  export declare const DEFAULT_TTVC_REVISION = "fy25.03";
40
+ export declare const UNKNOWN_INTERACTION_RATE = 1000;
40
41
  export type ReactHydrationStats = {
41
42
  /**
42
43
  * Indicates if hydration of SSR content failed, so React switching to client-side rendering and re-rendered from scratch.
@@ -14,4 +14,4 @@ import { type InteractionError } from '../interaction-metrics';
14
14
  * ```
15
15
  * @returns `reportError` function
16
16
  */
17
- export declare function useUFOReportError(): (error: InteractionError) => void;
17
+ export declare function useUFOReportError(): (error: Omit<InteractionError, "labelStack" | "errorType">) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.5.8",
3
+ "version": "4.5.10",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",