@atlaskit/editor-synced-block-renderer 10.2.1 → 10.2.3

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,23 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 10.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b1ff8c881a4aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b1ff8c881a4aa) -
14
+ [ux] Synced Blocks: de-opaque the renderer error-boundary fetch analytics event. The event now
15
+ routes through the shared fetch-error attribution builder (emitting structured
16
+ `reason`/`benign`/`sourceProduct`/`statusCode`, gated on `platform_editor_blocks_patch_4`) and a
17
+ PII-safe original error message is threaded from the upstream fetch catch so previously-opaque
18
+ `errored` failures can be classified and inspected.
19
+ - Updated dependencies
20
+
3
21
  ## 10.2.1
4
22
 
5
23
  ### Patch Changes
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.SyncedBlockErrorComponent = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _analytics = require("@atlaskit/editor-common/analytics");
10
9
  var _monitoring = require("@atlaskit/editor-common/monitoring");
11
10
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
12
11
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
12
+ var _errorHandling = require("@atlaskit/editor-synced-block-provider/errorHandling");
13
13
  var _utils = require("@atlaskit/editor-synced-block-provider/utils");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _SyncedBlockEntityNotFoundError = require("./SyncedBlockEntityNotFoundError");
15
16
  var _SyncedBlockGenericError = require("./SyncedBlockGenericError");
16
17
  var _SyncedBlockLoadError = require("./SyncedBlockLoadError");
@@ -50,17 +51,14 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
50
51
  sourceURL = _ref.sourceURL,
51
52
  getAccountId = _ref.getAccountId;
52
53
  (0, _react.useEffect)(function () {
53
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
54
- action: _analytics.ACTION.ERROR,
55
- actionSubject: _analytics.ACTION_SUBJECT.SYNCED_BLOCK,
56
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
57
- attributes: {
58
- error: "".concat((error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type), ": error component rendered"),
59
- resourceId: resourceId
60
- },
61
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
62
- });
63
- }, [error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, resourceId, fireAnalyticsEvent]);
54
+ // Emit structured attribution via the shared builder instead of an opaque
55
+ // `errored`-only blob. Prefer the PII-safe `originalMessage` so the classifier
56
+ // can bucket the real cause; fall back to `reason` then the bare `type`.
57
+ // Gate-off is a no-op (builder returns undefined → no new attributes).
58
+ var gateEnabled = (0, _platformFeatureFlags.fg)('platform_editor_blocks_patch_4');
59
+ var rawError = (error === null || error === void 0 ? void 0 : error.originalMessage) || (error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type) || 'unknown';
60
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent((0, _editorSyncedBlockProvider.fetchErrorPayload)("".concat(rawError, ": error component rendered"), resourceId, (0, _utils.getSourceProductFromResourceIdSafe)(resourceId), (0, _errorHandling.buildFetchErrorAttribution)(gateEnabled, rawError, error === null || error === void 0 ? void 0 : error.statusCode)));
61
+ }, [error === null || error === void 0 ? void 0 : error.originalMessage, error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, error === null || error === void 0 ? void 0 : error.statusCode, resourceId, fireAnalyticsEvent]);
64
62
  var getErrorContent = (0, _react.useMemo)(function () {
65
63
  switch (error === null || error === void 0 ? void 0 : error.type) {
66
64
  case _editorSyncedBlockProvider.SyncBlockError.EntityNotFound:
@@ -77,7 +77,10 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
77
77
  reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
78
78
  } : {
79
79
  type: _editorSyncedBlockProvider.SyncBlockError.Errored,
80
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
80
+ // Keep `reason` static — the block's `resourceId` is emitted as its own
81
+ // analytics attribute, so interpolating it here would only leak the
82
+ // identifier into the `error` string.
83
+ reason: !resourceId ? 'missing resource id' : 'missing data'
81
84
  };
82
85
  var result = (0, _renderSyncedBlockContent.renderSyncedBlockContent)({
83
86
  syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
@@ -1,9 +1,10 @@
1
1
  import React, { useMemo, useEffect } from 'react';
2
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
2
  import { logException } from '@atlaskit/editor-common/monitoring';
4
3
  import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
5
4
  import { fetchErrorPayload, getContentIdAndProductFromResourceId, SyncBlockError } from '@atlaskit/editor-synced-block-provider';
5
+ import { buildFetchErrorAttribution } from '@atlaskit/editor-synced-block-provider/errorHandling';
6
6
  import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { SyncedBlockEntityNotFoundError } from './SyncedBlockEntityNotFoundError';
8
9
  import { SyncedBlockGenericError } from './SyncedBlockGenericError';
9
10
  import { SyncedBlockLoadError } from './SyncedBlockLoadError';
@@ -44,17 +45,14 @@ export const SyncedBlockErrorComponent = ({
44
45
  getAccountId
45
46
  }) => {
46
47
  useEffect(() => {
47
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent({
48
- action: ACTION.ERROR,
49
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
50
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
51
- attributes: {
52
- error: `${(error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type)}: error component rendered`,
53
- resourceId: resourceId
54
- },
55
- eventType: EVENT_TYPE.OPERATIONAL
56
- });
57
- }, [error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, resourceId, fireAnalyticsEvent]);
48
+ // Emit structured attribution via the shared builder instead of an opaque
49
+ // `errored`-only blob. Prefer the PII-safe `originalMessage` so the classifier
50
+ // can bucket the real cause; fall back to `reason` then the bare `type`.
51
+ // Gate-off is a no-op (builder returns undefined → no new attributes).
52
+ const gateEnabled = fg('platform_editor_blocks_patch_4');
53
+ const rawError = (error === null || error === void 0 ? void 0 : error.originalMessage) || (error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type) || 'unknown';
54
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(fetchErrorPayload(`${rawError}: error component rendered`, resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(gateEnabled, rawError, error === null || error === void 0 ? void 0 : error.statusCode)));
55
+ }, [error === null || error === void 0 ? void 0 : error.originalMessage, error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, error === null || error === void 0 ? void 0 : error.statusCode, resourceId, fireAnalyticsEvent]);
58
56
  const getErrorContent = useMemo(() => {
59
57
  switch (error === null || error === void 0 ? void 0 : error.type) {
60
58
  case SyncBlockError.EntityNotFound:
@@ -70,7 +70,10 @@ export const SyncedBlockNodeComponentRenderer = ({
70
70
  reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
71
71
  } : {
72
72
  type: SyncBlockError.Errored,
73
- reason: !resourceId ? 'missing resource id' : `missing data for block ${resourceId}`
73
+ // Keep `reason` static — the block's `resourceId` is emitted as its own
74
+ // analytics attribute, so interpolating it here would only leak the
75
+ // identifier into the `error` string.
76
+ reason: !resourceId ? 'missing resource id' : 'missing data'
74
77
  };
75
78
  const result = renderSyncedBlockContent({
76
79
  syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
@@ -1,9 +1,10 @@
1
1
  import React, { useMemo, useEffect } from 'react';
2
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
2
  import { logException } from '@atlaskit/editor-common/monitoring';
4
3
  import { SyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
5
4
  import { fetchErrorPayload, getContentIdAndProductFromResourceId, SyncBlockError } from '@atlaskit/editor-synced-block-provider';
5
+ import { buildFetchErrorAttribution } from '@atlaskit/editor-synced-block-provider/errorHandling';
6
6
  import { getSourceProductFromResourceIdSafe } from '@atlaskit/editor-synced-block-provider/utils';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { SyncedBlockEntityNotFoundError } from './SyncedBlockEntityNotFoundError';
8
9
  import { SyncedBlockGenericError } from './SyncedBlockGenericError';
9
10
  import { SyncedBlockLoadError } from './SyncedBlockLoadError';
@@ -42,17 +43,14 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
42
43
  sourceURL = _ref.sourceURL,
43
44
  getAccountId = _ref.getAccountId;
44
45
  useEffect(function () {
45
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
46
- action: ACTION.ERROR,
47
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
48
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
49
- attributes: {
50
- error: "".concat((error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type), ": error component rendered"),
51
- resourceId: resourceId
52
- },
53
- eventType: EVENT_TYPE.OPERATIONAL
54
- });
55
- }, [error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, resourceId, fireAnalyticsEvent]);
46
+ // Emit structured attribution via the shared builder instead of an opaque
47
+ // `errored`-only blob. Prefer the PII-safe `originalMessage` so the classifier
48
+ // can bucket the real cause; fall back to `reason` then the bare `type`.
49
+ // Gate-off is a no-op (builder returns undefined → no new attributes).
50
+ var gateEnabled = fg('platform_editor_blocks_patch_4');
51
+ var rawError = (error === null || error === void 0 ? void 0 : error.originalMessage) || (error === null || error === void 0 ? void 0 : error.reason) || (error === null || error === void 0 ? void 0 : error.type) || 'unknown';
52
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(fetchErrorPayload("".concat(rawError, ": error component rendered"), resourceId, getSourceProductFromResourceIdSafe(resourceId), buildFetchErrorAttribution(gateEnabled, rawError, error === null || error === void 0 ? void 0 : error.statusCode)));
53
+ }, [error === null || error === void 0 ? void 0 : error.originalMessage, error === null || error === void 0 ? void 0 : error.reason, error === null || error === void 0 ? void 0 : error.type, error === null || error === void 0 ? void 0 : error.statusCode, resourceId, fireAnalyticsEvent]);
56
54
  var getErrorContent = useMemo(function () {
57
55
  switch (error === null || error === void 0 ? void 0 : error.type) {
58
56
  case SyncBlockError.EntityNotFound:
@@ -68,7 +68,10 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
68
68
  reason: (_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.deletionReason
69
69
  } : {
70
70
  type: SyncBlockError.Errored,
71
- reason: !resourceId ? 'missing resource id' : "missing data for block ".concat(resourceId)
71
+ // Keep `reason` static — the block's `resourceId` is emitted as its own
72
+ // analytics attribute, so interpolating it here would only leak the
73
+ // identifier into the `error` string.
74
+ reason: !resourceId ? 'missing resource id' : 'missing data'
72
75
  };
73
76
  var result = renderSyncedBlockContent({
74
77
  syncBlockInstance: syncBlockInstance !== null && syncBlockInstance !== void 0 ? syncBlockInstance : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "10.2.1",
3
+ "version": "10.2.3",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,18 +32,18 @@
32
32
  "dependencies": {
33
33
  "@atlaskit/button": "^24.3.0",
34
34
  "@atlaskit/css": "^1.0.0",
35
- "@atlaskit/editor-plugin-synced-block": "^10.1.0",
36
- "@atlaskit/editor-synced-block-provider": "^8.5.0",
37
- "@atlaskit/heading": "^6.1.0",
38
- "@atlaskit/icon": "^36.1.0",
39
- "@atlaskit/icon-lab": "^7.2.0",
35
+ "@atlaskit/editor-plugin-synced-block": "^10.2.0",
36
+ "@atlaskit/editor-synced-block-provider": "^8.6.0",
37
+ "@atlaskit/heading": "^6.2.0",
38
+ "@atlaskit/icon": "^37.0.0",
39
+ "@atlaskit/icon-lab": "^7.3.0",
40
40
  "@atlaskit/image": "^4.1.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.0.0",
42
- "@atlaskit/primitives": "^20.3.0",
42
+ "@atlaskit/primitives": "^20.5.0",
43
43
  "@atlaskit/react-compiler-gating": "^0.2.0",
44
- "@atlaskit/renderer": "^133.7.0",
44
+ "@atlaskit/renderer": "^133.10.0",
45
45
  "@atlaskit/spinner": "^20.1.0",
46
- "@atlaskit/tokens": "^15.3.0",
46
+ "@atlaskit/tokens": "^15.5.0",
47
47
  "@atlaskit/tooltip": "^23.1.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@compiled/react": "^0.20.0",
@@ -51,7 +51,7 @@
51
51
  "relay-runtime": "^20.1.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "@atlaskit/editor-common": "^116.20.0",
54
+ "@atlaskit/editor-common": "^116.25.0",
55
55
  "react": "^18.2.0",
56
56
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
57
57
  },
@@ -97,6 +97,10 @@
97
97
  "platform_editor_blocks_patch_3": {
98
98
  "type": "boolean",
99
99
  "referenceOnly": true
100
+ },
101
+ "platform_editor_blocks_patch_4": {
102
+ "type": "boolean",
103
+ "referenceOnly": true
100
104
  }
101
105
  }
102
106
  }