@atlaskit/editor-synced-block-renderer 5.8.5 → 5.9.0

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,16 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 5.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1a363f7706a2f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1a363f7706a2f) -
8
+ EDITOR-4193 add anaytics for ssr errors
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 5.8.5
4
15
 
5
16
  ### Patch Changes
@@ -27,6 +27,15 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
27
27
  var resourceId = nodeProps.resourceId,
28
28
  localId = nodeProps.localId,
29
29
  fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
30
+ (0, _react.useEffect)(function () {
31
+ var timeoutId = setTimeout(function () {
32
+ (0, _syncBlock.handleSSRErrorsAnalytics)(fireAnalyticsEvent);
33
+ }, 0);
34
+ return function () {
35
+ clearTimeout(timeoutId);
36
+ };
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
+ }, []);
30
39
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
31
40
  var _useFetchSyncBlockDat = (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(syncBlockStoreManager, resourceId, localId, fireAnalyticsEvent),
32
41
  syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
12
12
  var _hooks = require("@atlaskit/editor-common/hooks");
13
+ var _syncBlock = require("@atlaskit/editor-common/sync-block");
13
14
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
14
15
  var _AKRendererWrapper = require("./AKRendererWrapper");
15
16
  var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
@@ -22,6 +23,16 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
22
23
  var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
23
24
  syncBlockFetchResult = _ref.syncBlockFetchResult,
24
25
  api = _ref.api;
26
+ (0, _react.useEffect)(function () {
27
+ var timeoutId = setTimeout(function () {
28
+ var _api$analytics;
29
+ (0, _syncBlock.handleSSRErrorsAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent);
30
+ }, 0);
31
+ return function () {
32
+ clearTimeout(timeoutId);
33
+ };
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ }, []);
25
36
  var isLoading = syncBlockFetchResult.isLoading,
26
37
  providerFactory = syncBlockFetchResult.providerFactory,
27
38
  reloadData = syncBlockFetchResult.reloadData,
@@ -71,7 +82,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
71
82
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
72
83
  }
73
84
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
74
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
85
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics2;
75
86
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
76
87
  error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
77
88
  type: _editorSyncedBlockProvider.SyncBlockError.NotFound
@@ -81,20 +92,20 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
81
92
  resourceId: syncBlockInstance.resourceId,
82
93
  onRetry: reloadData,
83
94
  isLoading: isLoading,
84
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
95
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
85
96
  });
86
97
  }
87
98
 
88
99
  // Check for unpublished status
89
100
  if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
90
- var _syncBlockInstance$da3, _api$analytics2;
101
+ var _syncBlockInstance$da3, _api$analytics3;
91
102
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
92
103
  error: {
93
104
  type: _editorSyncedBlockProvider.SyncBlockError.Unpublished
94
105
  },
95
106
  resourceId: syncBlockInstance.resourceId,
96
107
  sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
97
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
108
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
98
109
  });
99
110
  }
100
111
  var syncBlockDoc = {
@@ -1,6 +1,6 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useEffect, useMemo } from 'react';
2
2
  import { isSSR } from '@atlaskit/editor-common/core-utils';
3
- import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
3
+ import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName, handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
4
4
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { AKRendererWrapper } from './AKRendererWrapper';
@@ -17,6 +17,15 @@ export const SyncedBlockNodeComponentRenderer = ({
17
17
  localId,
18
18
  fireAnalyticsEvent
19
19
  } = nodeProps;
20
+ useEffect(() => {
21
+ const timeoutId = setTimeout(() => {
22
+ handleSSRErrorsAnalytics(fireAnalyticsEvent);
23
+ }, 0);
24
+ return () => {
25
+ clearTimeout(timeoutId);
26
+ };
27
+ // eslint-disable-next-line react-hooks/exhaustive-deps
28
+ }, []);
20
29
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
21
30
  const {
22
31
  syncBlockInstance,
@@ -1,6 +1,7 @@
1
- import React, { memo, useMemo } from 'react';
1
+ import React, { memo, useEffect, useMemo } from 'react';
2
2
  import { isSSR } from '@atlaskit/editor-common/core-utils';
3
3
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
4
5
  import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
5
6
  import { AKRendererWrapper } from './AKRendererWrapper';
6
7
  import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
@@ -11,6 +12,16 @@ const SyncedBlockRendererComponent = ({
11
12
  api
12
13
  }) => {
13
14
  var _syncBlockInstance$da2;
15
+ useEffect(() => {
16
+ const timeoutId = setTimeout(() => {
17
+ var _api$analytics;
18
+ handleSSRErrorsAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent);
19
+ }, 0);
20
+ return () => {
21
+ clearTimeout(timeoutId);
22
+ };
23
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24
+ }, []);
14
25
  const {
15
26
  isLoading,
16
27
  providerFactory,
@@ -64,7 +75,7 @@ const SyncedBlockRendererComponent = ({
64
75
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
65
76
  }
66
77
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
67
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
78
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics2;
68
79
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
69
80
  error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
70
81
  type: SyncBlockError.NotFound
@@ -74,20 +85,20 @@ const SyncedBlockRendererComponent = ({
74
85
  resourceId: syncBlockInstance.resourceId,
75
86
  onRetry: reloadData,
76
87
  isLoading: isLoading,
77
- fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
88
+ fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
78
89
  });
79
90
  }
80
91
 
81
92
  // Check for unpublished status
82
93
  if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
83
- var _syncBlockInstance$da3, _api$analytics2;
94
+ var _syncBlockInstance$da3, _api$analytics3;
84
95
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
85
96
  error: {
86
97
  type: SyncBlockError.Unpublished
87
98
  },
88
99
  resourceId: syncBlockInstance.resourceId,
89
100
  sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
90
- fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
101
+ fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
91
102
  });
92
103
  }
93
104
  const syncBlockDoc = {
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  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; }
4
4
  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; }
5
- import React, { useMemo } from 'react';
5
+ import React, { useEffect, useMemo } from 'react';
6
6
  import { isSSR } from '@atlaskit/editor-common/core-utils';
7
- import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
7
+ import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName, handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
8
8
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { AKRendererWrapper } from './AKRendererWrapper';
@@ -18,6 +18,15 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
18
18
  var resourceId = nodeProps.resourceId,
19
19
  localId = nodeProps.localId,
20
20
  fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
21
+ useEffect(function () {
22
+ var timeoutId = setTimeout(function () {
23
+ handleSSRErrorsAnalytics(fireAnalyticsEvent);
24
+ }, 0);
25
+ return function () {
26
+ clearTimeout(timeoutId);
27
+ };
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ }, []);
21
30
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
22
31
  var _useFetchSyncBlockDat = useFetchSyncBlockData(syncBlockStoreManager, resourceId, localId, fireAnalyticsEvent),
23
32
  syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
@@ -1,9 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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; }
4
- import React, { memo, useMemo } from 'react';
4
+ import React, { memo, useEffect, useMemo } from 'react';
5
5
  import { isSSR } from '@atlaskit/editor-common/core-utils';
6
6
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
+ import { handleSSRErrorsAnalytics } from '@atlaskit/editor-common/sync-block';
7
8
  import { SyncBlockError } from '@atlaskit/editor-synced-block-provider';
8
9
  import { AKRendererWrapper } from './AKRendererWrapper';
9
10
  import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
@@ -13,6 +14,16 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
13
14
  var syncBlockRendererOptions = _ref.syncBlockRendererOptions,
14
15
  syncBlockFetchResult = _ref.syncBlockFetchResult,
15
16
  api = _ref.api;
17
+ useEffect(function () {
18
+ var timeoutId = setTimeout(function () {
19
+ var _api$analytics;
20
+ handleSSRErrorsAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent);
21
+ }, 0);
22
+ return function () {
23
+ clearTimeout(timeoutId);
24
+ };
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ }, []);
16
27
  var isLoading = syncBlockFetchResult.isLoading,
17
28
  providerFactory = syncBlockFetchResult.providerFactory,
18
29
  reloadData = syncBlockFetchResult.reloadData,
@@ -62,7 +73,7 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
62
73
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
63
74
  }
64
75
  if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted') {
65
- var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
76
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics2;
66
77
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
67
78
  error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : (syncBlockInstance === null || syncBlockInstance === void 0 || (_syncBlockInstance$da = syncBlockInstance.data) === null || _syncBlockInstance$da === void 0 ? void 0 : _syncBlockInstance$da.status) === 'deleted' ? {
68
79
  type: SyncBlockError.NotFound
@@ -72,20 +83,20 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
72
83
  resourceId: syncBlockInstance.resourceId,
73
84
  onRetry: reloadData,
74
85
  isLoading: isLoading,
75
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
86
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
76
87
  });
77
88
  }
78
89
 
79
90
  // Check for unpublished status
80
91
  if (((_syncBlockInstance$da2 = syncBlockInstance.data) === null || _syncBlockInstance$da2 === void 0 ? void 0 : _syncBlockInstance$da2.status) === 'unpublished') {
81
- var _syncBlockInstance$da3, _api$analytics2;
92
+ var _syncBlockInstance$da3, _api$analytics3;
82
93
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
83
94
  error: {
84
95
  type: SyncBlockError.Unpublished
85
96
  },
86
97
  resourceId: syncBlockInstance.resourceId,
87
98
  sourceURL: (_syncBlockInstance$da3 = syncBlockInstance.data) === null || _syncBlockInstance$da3 === void 0 ? void 0 : _syncBlockInstance$da3.sourceURL,
88
- fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent
99
+ fireAnalyticsEvent: api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.fireAnalyticsEvent
89
100
  });
90
101
  }
91
102
  var syncBlockDoc = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "5.8.5",
3
+ "version": "5.9.0",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/image": "^3.0.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/primitives": "^18.0.0",
41
- "@atlaskit/renderer": "^126.9.0",
41
+ "@atlaskit/renderer": "^126.11.0",
42
42
  "@atlaskit/spinner": "^19.0.0",
43
43
  "@atlaskit/tokens": "^11.0.0",
44
44
  "@atlaskit/tooltip": "^20.14.0",
@@ -48,7 +48,7 @@
48
48
  "relay-runtime": "npm:atl-relay-runtime@0.0.0-main-39e79f66"
49
49
  },
50
50
  "peerDependencies": {
51
- "@atlaskit/editor-common": "^111.16.0",
51
+ "@atlaskit/editor-common": "^111.18.0",
52
52
  "react": "^18.2.0",
53
53
  "react-intl-next": "npm:react-intl@^5.18.1"
54
54
  },