@atlaskit/editor-synced-block-renderer 5.3.1 → 5.4.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,25 @@
1
1
  # @atlaskit/editor-synced-block-renderer
2
2
 
3
+ ## 5.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`870c3baec758b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/870c3baec758b) -
8
+ Enable consumers to use GraphQL subscription for fetching the block data when the block changes
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 5.3.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [`7f41011a1b0ff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7f41011a1b0ff) -
19
+ EDITOR-1665 update sync block experience events to use general experience ids, keep existing error
20
+ events and add success events
21
+ - Updated dependencies
22
+
3
23
  ## 5.3.1
4
24
 
5
25
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.jira.json",
2
+ "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
4
  "target": "es5",
5
5
  "outDir": "../../../../../jira/tsDist/@atlaskit__editor-synced-block-renderer/app",
@@ -11,7 +11,6 @@ var _react = _interopRequireDefault(require("react"));
11
11
  var _syncBlock = require("@atlaskit/editor-common/sync-block");
12
12
  var _editorSyncedBlockProvider = require("@atlaskit/editor-synced-block-provider");
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
- var _experienceTracking = require("../utils/experience-tracking");
15
14
  var _AKRendererWrapper = require("./AKRendererWrapper");
16
15
  var _SyncedBlockErrorComponent = require("./SyncedBlockErrorComponent");
17
16
  var _SyncedBlockLoadingState = require("./SyncedBlockLoadingState");
@@ -23,9 +22,6 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
23
22
  localId = nodeProps.localId,
24
23
  fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
25
24
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
26
- if ((0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
27
- (0, _experienceTracking.setupExperienceTracking)(syncBlockStoreManager, fireAnalyticsEvent);
28
- }
29
25
  var _useFetchSyncBlockDat = (0, _editorSyncedBlockProvider.useFetchSyncBlockData)(syncBlockStoreManager, resourceId, localId, fireAnalyticsEvent),
30
26
  syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
31
27
  isLoading = _useFetchSyncBlockDat.isLoading,
@@ -34,10 +30,10 @@ var SyncedBlockNodeComponentRenderer = exports.SyncedBlockNodeComponentRenderer
34
30
  if (isLoading && !syncBlockInstance) {
35
31
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
36
32
  }
37
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
38
- var _syncBlockInstance$er;
33
+ if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
34
+ var _syncBlockInstance$er, _syncBlockInstance$da;
39
35
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
40
- error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
36
+ error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : 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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? _editorSyncedBlockProvider.SyncBlockError.NotFound : _editorSyncedBlockProvider.SyncBlockError.Errored,
41
37
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
42
38
  onRetry: reloadData,
43
39
  isLoading: isLoading,
@@ -60,10 +60,10 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
60
60
  if (!syncBlockInstance) {
61
61
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockLoadingState.SyncedBlockLoadingState, null);
62
62
  }
63
- if (syncBlockInstance.error || !syncBlockInstance.data) {
64
- var _syncBlockInstance$er, _api$analytics;
63
+ if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding')) {
64
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
65
65
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
66
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : _editorSyncedBlockProvider.SyncBlockError.Errored,
66
+ 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' && (0, _platformFeatureFlags.fg)('platform_synced_block_dogfooding') ? _editorSyncedBlockProvider.SyncBlockError.NotFound : _editorSyncedBlockProvider.SyncBlockError.Errored,
67
67
  resourceId: syncBlockInstance.resourceId,
68
68
  onRetry: reloadData,
69
69
  isLoading: isLoading,
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
3
3
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { setupExperienceTracking } from '../utils/experience-tracking';
6
5
  import { AKRendererWrapper } from './AKRendererWrapper';
7
6
  import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
8
7
  import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
@@ -17,9 +16,6 @@ export const SyncedBlockNodeComponentRenderer = ({
17
16
  fireAnalyticsEvent
18
17
  } = nodeProps;
19
18
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
20
- if (fg('platform_synced_block_dogfooding')) {
21
- setupExperienceTracking(syncBlockStoreManager, fireAnalyticsEvent);
22
- }
23
19
  const {
24
20
  syncBlockInstance,
25
21
  isLoading,
@@ -29,10 +25,10 @@ export const SyncedBlockNodeComponentRenderer = ({
29
25
  if (isLoading && !syncBlockInstance) {
30
26
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
31
27
  }
32
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
33
- var _syncBlockInstance$er;
28
+ if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
29
+ var _syncBlockInstance$er, _syncBlockInstance$da;
34
30
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
35
- error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
31
+ error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
36
32
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
37
33
  onRetry: reloadData,
38
34
  isLoading: isLoading,
@@ -52,10 +52,10 @@ const SyncedBlockRendererComponent = ({
52
52
  if (!syncBlockInstance) {
53
53
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
54
54
  }
55
- if (syncBlockInstance.error || !syncBlockInstance.data) {
56
- var _syncBlockInstance$er, _api$analytics;
55
+ if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
56
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
57
57
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
58
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
58
+ 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
59
59
  resourceId: syncBlockInstance.resourceId,
60
60
  onRetry: reloadData,
61
61
  isLoading: isLoading,
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  import { SyncBlockSharedCssClassName, SyncBlockRendererDataAttributeName } from '@atlaskit/editor-common/sync-block';
5
5
  import { SyncBlockError, useFetchSyncBlockData } from '@atlaskit/editor-synced-block-provider';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
- import { setupExperienceTracking } from '../utils/experience-tracking';
8
7
  import { AKRendererWrapper } from './AKRendererWrapper';
9
8
  import { SyncedBlockErrorComponent } from './SyncedBlockErrorComponent';
10
9
  import { SyncedBlockLoadingState } from './SyncedBlockLoadingState';
@@ -16,9 +15,6 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
16
15
  localId = nodeProps.localId,
17
16
  fireAnalyticsEvent = nodeProps.fireAnalyticsEvent;
18
17
  syncBlockStoreManager.referenceManager.updateFireAnalyticsEvent(fireAnalyticsEvent);
19
- if (fg('platform_synced_block_dogfooding')) {
20
- setupExperienceTracking(syncBlockStoreManager, fireAnalyticsEvent);
21
- }
22
18
  var _useFetchSyncBlockDat = useFetchSyncBlockData(syncBlockStoreManager, resourceId, localId, fireAnalyticsEvent),
23
19
  syncBlockInstance = _useFetchSyncBlockDat.syncBlockInstance,
24
20
  isLoading = _useFetchSyncBlockDat.isLoading,
@@ -27,10 +23,10 @@ export var SyncedBlockNodeComponentRenderer = function SyncedBlockNodeComponentR
27
23
  if (isLoading && !syncBlockInstance) {
28
24
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
29
25
  }
30
- if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data)) {
31
- var _syncBlockInstance$er;
26
+ if (!resourceId || syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.error || !(syncBlockInstance !== null && syncBlockInstance !== void 0 && syncBlockInstance.data) || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
27
+ var _syncBlockInstance$er, _syncBlockInstance$da;
32
28
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
33
- error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
29
+ error: (_syncBlockInstance$er = syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
34
30
  resourceId: syncBlockInstance === null || syncBlockInstance === void 0 ? void 0 : syncBlockInstance.resourceId,
35
31
  onRetry: reloadData,
36
32
  isLoading: isLoading,
@@ -51,10 +51,10 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
51
51
  if (!syncBlockInstance) {
52
52
  return /*#__PURE__*/React.createElement(SyncedBlockLoadingState, null);
53
53
  }
54
- if (syncBlockInstance.error || !syncBlockInstance.data) {
55
- var _syncBlockInstance$er, _api$analytics;
54
+ if (syncBlockInstance.error || !syncBlockInstance.data || syncBlockInstance.data.status === 'deleted' && fg('platform_synced_block_dogfooding')) {
55
+ var _syncBlockInstance$er, _syncBlockInstance$da, _api$analytics;
56
56
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
57
- error: (_syncBlockInstance$er = syncBlockInstance.error) !== null && _syncBlockInstance$er !== void 0 ? _syncBlockInstance$er : SyncBlockError.Errored,
57
+ 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' && fg('platform_synced_block_dogfooding') ? SyncBlockError.NotFound : SyncBlockError.Errored,
58
58
  resourceId: syncBlockInstance.resourceId,
59
59
  onRetry: reloadData,
60
60
  isLoading: isLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,17 +30,17 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/button": "^23.9.0",
32
32
  "@atlaskit/css": "^0.19.0",
33
- "@atlaskit/editor-plugin-synced-block": "^5.1.0",
34
- "@atlaskit/editor-synced-block-provider": "^3.8.0",
33
+ "@atlaskit/editor-plugin-synced-block": "^5.3.0",
34
+ "@atlaskit/editor-synced-block-provider": "^3.13.0",
35
35
  "@atlaskit/heading": "^5.2.0",
36
36
  "@atlaskit/icon": "^29.4.0",
37
37
  "@atlaskit/icon-lab": "^5.14.0",
38
38
  "@atlaskit/image": "^3.0.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/primitives": "^17.1.0",
41
- "@atlaskit/renderer": "^126.0.0",
41
+ "@atlaskit/renderer": "^126.1.0",
42
42
  "@atlaskit/spinner": "^19.0.0",
43
- "@atlaskit/tokens": "^10.0.0",
43
+ "@atlaskit/tokens": "^10.1.0",
44
44
  "@atlaskit/tooltip": "^20.14.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "react-relay": "npm:atl-react-relay@0.0.0-main-39e79f66",
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setupExperienceTracking = exports.getSaveReferenceExperience = exports.getFetchSourceInfoExperience = exports.getFetchExperience = exports.createExperienceDispatcher = void 0;
7
- var _analytics = require("@atlaskit/editor-common/analytics");
8
- var _experiences = require("@atlaskit/editor-common/experiences");
9
- var setupExperienceTracking = exports.setupExperienceTracking = function setupExperienceTracking(syncBlockStoreManager, fireAnalyticsEvent) {
10
- if (!fireAnalyticsEvent) {
11
- return;
12
- }
13
- var dispatchAnalyticsEvent = createExperienceDispatcher(fireAnalyticsEvent);
14
- syncBlockStoreManager.referenceManager.setExperiences(getFetchExperience(dispatchAnalyticsEvent), getFetchSourceInfoExperience(dispatchAnalyticsEvent), getSaveReferenceExperience(dispatchAnalyticsEvent));
15
- };
16
- var createExperienceDispatcher = exports.createExperienceDispatcher = function createExperienceDispatcher(fireAnalyticsEvent) {
17
- return function (payload) {
18
- // Runtime type guard - only forward experience events
19
- if (payload.action === 'experienceMeasured' || payload.action === 'experienceSampled') {
20
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(payload);
21
- }
22
- };
23
- };
24
-
25
- /**
26
- * This experience tracks when a reference sync block data is fetched from the BE.
27
- *
28
- * Start: When the fetchNodesData function is called.
29
- * Success: When the fetching the data is successful within 1500ms of start.
30
- * Failure: When 1500ms passes without the data being successfully fetched, or the fetch fails
31
- */
32
- var getFetchExperience = exports.getFetchExperience = function getFetchExperience(dispatchAnalyticsEvent) {
33
- return new _experiences.Experience(_analytics.ACTION_SUBJECT.SYNCED_BLOCK, {
34
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
35
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
36
- checks: [new _experiences.ExperienceCheckTimeout({
37
- durationMs: 1500
38
- })]
39
- });
40
- };
41
-
42
- /**
43
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
44
- *
45
- * Start: When the fetchSourceInfo function is called.
46
- * Success: When the fetching the data is successful within 2500ms of start.
47
- * Failure: When 2500ms passes without the data being successfully fetched, or the fetch fails
48
- */
49
- var getFetchSourceInfoExperience = exports.getFetchSourceInfoExperience = function getFetchSourceInfoExperience(dispatchAnalyticsEvent) {
50
- return new _experiences.Experience(_analytics.ACTION_SUBJECT.SYNCED_BLOCK, {
51
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO,
52
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
53
- checks: [new _experiences.ExperienceCheckTimeout({
54
- durationMs: 2500
55
- })]
56
- });
57
- };
58
-
59
- /**
60
- * This experience tracks when a reference sync block is saved to the BE.
61
- *
62
- * Start: When the flush sync block function is called.
63
- * Success: When the sync block save is successful within 1500ms of start.
64
- * Failure: When 1500ms passes before the sync block save is marked as successful
65
- */
66
- var getSaveReferenceExperience = exports.getSaveReferenceExperience = function getSaveReferenceExperience(dispatchAnalyticsEvent) {
67
- return new _experiences.Experience(_analytics.ACTION_SUBJECT.SYNCED_BLOCK, {
68
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE,
69
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
70
- checks: [new _experiences.ExperienceCheckTimeout({
71
- durationMs: 1500
72
- })]
73
- });
74
- };
@@ -1,68 +0,0 @@
1
- import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
- import { Experience, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
3
- export const setupExperienceTracking = (syncBlockStoreManager, fireAnalyticsEvent) => {
4
- if (!fireAnalyticsEvent) {
5
- return;
6
- }
7
- const dispatchAnalyticsEvent = createExperienceDispatcher(fireAnalyticsEvent);
8
- syncBlockStoreManager.referenceManager.setExperiences(getFetchExperience(dispatchAnalyticsEvent), getFetchSourceInfoExperience(dispatchAnalyticsEvent), getSaveReferenceExperience(dispatchAnalyticsEvent));
9
- };
10
- export const createExperienceDispatcher = fireAnalyticsEvent => {
11
- return payload => {
12
- // Runtime type guard - only forward experience events
13
- if (payload.action === 'experienceMeasured' || payload.action === 'experienceSampled') {
14
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 ? void 0 : fireAnalyticsEvent(payload);
15
- }
16
- };
17
- };
18
-
19
- /**
20
- * This experience tracks when a reference sync block data is fetched from the BE.
21
- *
22
- * Start: When the fetchNodesData function is called.
23
- * Success: When the fetching the data is successful within 1500ms of start.
24
- * Failure: When 1500ms passes without the data being successfully fetched, or the fetch fails
25
- */
26
- export const getFetchExperience = dispatchAnalyticsEvent => {
27
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
28
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
29
- dispatchAnalyticsEvent,
30
- checks: [new ExperienceCheckTimeout({
31
- durationMs: 1500
32
- })]
33
- });
34
- };
35
-
36
- /**
37
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
38
- *
39
- * Start: When the fetchSourceInfo function is called.
40
- * Success: When the fetching the data is successful within 2500ms of start.
41
- * Failure: When 2500ms passes without the data being successfully fetched, or the fetch fails
42
- */
43
- export const getFetchSourceInfoExperience = dispatchAnalyticsEvent => {
44
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
45
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO,
46
- dispatchAnalyticsEvent,
47
- checks: [new ExperienceCheckTimeout({
48
- durationMs: 2500
49
- })]
50
- });
51
- };
52
-
53
- /**
54
- * This experience tracks when a reference sync block is saved to the BE.
55
- *
56
- * Start: When the flush sync block function is called.
57
- * Success: When the sync block save is successful within 1500ms of start.
58
- * Failure: When 1500ms passes before the sync block save is marked as successful
59
- */
60
- export const getSaveReferenceExperience = dispatchAnalyticsEvent => {
61
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
62
- actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE,
63
- dispatchAnalyticsEvent,
64
- checks: [new ExperienceCheckTimeout({
65
- durationMs: 1500
66
- })]
67
- });
68
- };
@@ -1,68 +0,0 @@
1
- import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
2
- import { Experience, ExperienceCheckTimeout } from '@atlaskit/editor-common/experiences';
3
- export var setupExperienceTracking = function setupExperienceTracking(syncBlockStoreManager, fireAnalyticsEvent) {
4
- if (!fireAnalyticsEvent) {
5
- return;
6
- }
7
- var dispatchAnalyticsEvent = createExperienceDispatcher(fireAnalyticsEvent);
8
- syncBlockStoreManager.referenceManager.setExperiences(getFetchExperience(dispatchAnalyticsEvent), getFetchSourceInfoExperience(dispatchAnalyticsEvent), getSaveReferenceExperience(dispatchAnalyticsEvent));
9
- };
10
- export var createExperienceDispatcher = function createExperienceDispatcher(fireAnalyticsEvent) {
11
- return function (payload) {
12
- // Runtime type guard - only forward experience events
13
- if (payload.action === 'experienceMeasured' || payload.action === 'experienceSampled') {
14
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent(payload);
15
- }
16
- };
17
- };
18
-
19
- /**
20
- * This experience tracks when a reference sync block data is fetched from the BE.
21
- *
22
- * Start: When the fetchNodesData function is called.
23
- * Success: When the fetching the data is successful within 1500ms of start.
24
- * Failure: When 1500ms passes without the data being successfully fetched, or the fetch fails
25
- */
26
- export var getFetchExperience = function getFetchExperience(dispatchAnalyticsEvent) {
27
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
28
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH,
29
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
30
- checks: [new ExperienceCheckTimeout({
31
- durationMs: 1500
32
- })]
33
- });
34
- };
35
-
36
- /**
37
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
38
- *
39
- * Start: When the fetchSourceInfo function is called.
40
- * Success: When the fetching the data is successful within 2500ms of start.
41
- * Failure: When 2500ms passes without the data being successfully fetched, or the fetch fails
42
- */
43
- export var getFetchSourceInfoExperience = function getFetchSourceInfoExperience(dispatchAnalyticsEvent) {
44
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
45
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO,
46
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
47
- checks: [new ExperienceCheckTimeout({
48
- durationMs: 2500
49
- })]
50
- });
51
- };
52
-
53
- /**
54
- * This experience tracks when a reference sync block is saved to the BE.
55
- *
56
- * Start: When the flush sync block function is called.
57
- * Success: When the sync block save is successful within 1500ms of start.
58
- * Failure: When 1500ms passes before the sync block save is marked as successful
59
- */
60
- export var getSaveReferenceExperience = function getSaveReferenceExperience(dispatchAnalyticsEvent) {
61
- return new Experience(ACTION_SUBJECT.SYNCED_BLOCK, {
62
- actionSubjectId: ACTION_SUBJECT_ID.REFERENCE_SYNCED_BLOCK_UPDATE,
63
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
64
- checks: [new ExperienceCheckTimeout({
65
- durationMs: 1500
66
- })]
67
- });
68
- };
@@ -1,30 +0,0 @@
1
- import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import { Experience } from '@atlaskit/editor-common/experiences';
3
- import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
4
- import type { AnalyticsEventPayload as RendererAnalyticsEventPayload } from '@atlaskit/renderer';
5
- export declare const setupExperienceTracking: (syncBlockStoreManager: SyncBlockStoreManager, fireAnalyticsEvent?: ((payload: RendererAnalyticsEventPayload) => void)) => void;
6
- export declare const createExperienceDispatcher: (fireAnalyticsEvent?: ((payload: RendererAnalyticsEventPayload) => void)) => DispatchAnalyticsEvent;
7
- /**
8
- * This experience tracks when a reference sync block data is fetched from the BE.
9
- *
10
- * Start: When the fetchNodesData function is called.
11
- * Success: When the fetching the data is successful within 1500ms of start.
12
- * Failure: When 1500ms passes without the data being successfully fetched, or the fetch fails
13
- */
14
- export declare const getFetchExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;
15
- /**
16
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
17
- *
18
- * Start: When the fetchSourceInfo function is called.
19
- * Success: When the fetching the data is successful within 2500ms of start.
20
- * Failure: When 2500ms passes without the data being successfully fetched, or the fetch fails
21
- */
22
- export declare const getFetchSourceInfoExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;
23
- /**
24
- * This experience tracks when a reference sync block is saved to the BE.
25
- *
26
- * Start: When the flush sync block function is called.
27
- * Success: When the sync block save is successful within 1500ms of start.
28
- * Failure: When 1500ms passes before the sync block save is marked as successful
29
- */
30
- export declare const getSaveReferenceExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;
@@ -1,30 +0,0 @@
1
- import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import { Experience } from '@atlaskit/editor-common/experiences';
3
- import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
4
- import type { AnalyticsEventPayload as RendererAnalyticsEventPayload } from '@atlaskit/renderer';
5
- export declare const setupExperienceTracking: (syncBlockStoreManager: SyncBlockStoreManager, fireAnalyticsEvent?: ((payload: RendererAnalyticsEventPayload) => void)) => void;
6
- export declare const createExperienceDispatcher: (fireAnalyticsEvent?: ((payload: RendererAnalyticsEventPayload) => void)) => DispatchAnalyticsEvent;
7
- /**
8
- * This experience tracks when a reference sync block data is fetched from the BE.
9
- *
10
- * Start: When the fetchNodesData function is called.
11
- * Success: When the fetching the data is successful within 1500ms of start.
12
- * Failure: When 1500ms passes without the data being successfully fetched, or the fetch fails
13
- */
14
- export declare const getFetchExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;
15
- /**
16
- * This experience tracks when a reference sync block source info data (title, url) is fetched from the BE.
17
- *
18
- * Start: When the fetchSourceInfo function is called.
19
- * Success: When the fetching the data is successful within 2500ms of start.
20
- * Failure: When 2500ms passes without the data being successfully fetched, or the fetch fails
21
- */
22
- export declare const getFetchSourceInfoExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;
23
- /**
24
- * This experience tracks when a reference sync block is saved to the BE.
25
- *
26
- * Start: When the flush sync block function is called.
27
- * Success: When the sync block save is successful within 1500ms of start.
28
- * Failure: When 1500ms passes before the sync block save is marked as successful
29
- */
30
- export declare const getSaveReferenceExperience: (dispatchAnalyticsEvent: DispatchAnalyticsEvent) => Experience;