@atlaskit/editor-plugin-synced-block 5.3.11 → 5.3.13

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 (62) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/afm-cc/tsconfig.json +0 -3
  3. package/afm-jira/tsconfig.json +0 -3
  4. package/afm-products/tsconfig.json +0 -3
  5. package/dist/cjs/editor-commands/index.js +99 -40
  6. package/dist/cjs/nodeviews/bodiedSyncedBlock.js +2 -7
  7. package/dist/cjs/nodeviews/syncedBlock.js +4 -18
  8. package/dist/cjs/pm-plugins/main.js +34 -43
  9. package/dist/cjs/pm-plugins/menu-and-toolbar-experiences.js +221 -81
  10. package/dist/cjs/pm-plugins/utils/track-sync-blocks.js +1 -2
  11. package/dist/cjs/pm-plugins/utils/utils.js +1 -46
  12. package/dist/cjs/syncedBlockPlugin.js +5 -7
  13. package/dist/cjs/types/index.js +5 -1
  14. package/dist/cjs/ui/CreateSyncedBlockDropdownItem.js +2 -1
  15. package/dist/cjs/ui/DeleteConfirmationModal.js +4 -20
  16. package/dist/cjs/ui/SyncBlockLabel.js +4 -10
  17. package/dist/cjs/ui/SyncBlockRefresher.js +7 -9
  18. package/dist/cjs/ui/SyncedLocationDropdown.js +32 -6
  19. package/dist/cjs/ui/floating-toolbar.js +11 -7
  20. package/dist/es2019/editor-commands/index.js +99 -40
  21. package/dist/es2019/nodeviews/bodiedSyncedBlock.js +2 -7
  22. package/dist/es2019/nodeviews/syncedBlock.js +4 -15
  23. package/dist/es2019/pm-plugins/main.js +33 -42
  24. package/dist/es2019/pm-plugins/menu-and-toolbar-experiences.js +206 -71
  25. package/dist/es2019/pm-plugins/utils/track-sync-blocks.js +1 -2
  26. package/dist/es2019/pm-plugins/utils/utils.js +0 -47
  27. package/dist/es2019/syncedBlockPlugin.js +4 -5
  28. package/dist/es2019/types/index.js +5 -1
  29. package/dist/es2019/ui/CreateSyncedBlockDropdownItem.js +2 -1
  30. package/dist/es2019/ui/DeleteConfirmationModal.js +4 -20
  31. package/dist/es2019/ui/SyncBlockLabel.js +4 -10
  32. package/dist/es2019/ui/SyncBlockRefresher.js +7 -9
  33. package/dist/es2019/ui/SyncedLocationDropdown.js +30 -6
  34. package/dist/es2019/ui/floating-toolbar.js +10 -6
  35. package/dist/esm/editor-commands/index.js +99 -40
  36. package/dist/esm/nodeviews/bodiedSyncedBlock.js +2 -7
  37. package/dist/esm/nodeviews/syncedBlock.js +4 -18
  38. package/dist/esm/pm-plugins/main.js +34 -43
  39. package/dist/esm/pm-plugins/menu-and-toolbar-experiences.js +221 -81
  40. package/dist/esm/pm-plugins/utils/track-sync-blocks.js +1 -2
  41. package/dist/esm/pm-plugins/utils/utils.js +0 -45
  42. package/dist/esm/syncedBlockPlugin.js +5 -7
  43. package/dist/esm/types/index.js +5 -1
  44. package/dist/esm/ui/CreateSyncedBlockDropdownItem.js +2 -1
  45. package/dist/esm/ui/DeleteConfirmationModal.js +4 -20
  46. package/dist/esm/ui/SyncBlockLabel.js +4 -10
  47. package/dist/esm/ui/SyncBlockRefresher.js +7 -9
  48. package/dist/esm/ui/SyncedLocationDropdown.js +32 -6
  49. package/dist/esm/ui/floating-toolbar.js +11 -7
  50. package/dist/types/editor-commands/index.d.ts +3 -2
  51. package/dist/types/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  52. package/dist/types/pm-plugins/utils/utils.d.ts +1 -3
  53. package/dist/types/syncedBlockPluginType.d.ts +2 -1
  54. package/dist/types/types/index.d.ts +4 -0
  55. package/dist/types/ui/SyncedLocationDropdown.d.ts +4 -1
  56. package/dist/types-ts4.5/editor-commands/index.d.ts +3 -2
  57. package/dist/types-ts4.5/pm-plugins/utils/handle-bodied-sync-block-removal.d.ts +1 -1
  58. package/dist/types-ts4.5/pm-plugins/utils/utils.d.ts +1 -3
  59. package/dist/types-ts4.5/syncedBlockPluginType.d.ts +2 -1
  60. package/dist/types-ts4.5/types/index.d.ts +4 -0
  61. package/dist/types-ts4.5/ui/SyncedLocationDropdown.d.ts +4 -1
  62. package/package.json +5 -6
@@ -8,7 +8,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
8
8
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
9
9
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
10
10
  import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { Text, Box } from '@atlaskit/primitives/compiled';
13
12
  import Spinner from '@atlaskit/spinner';
14
13
  import { syncedBlockPluginKey } from '../pm-plugins/main';
@@ -35,7 +34,7 @@ export const DeleteConfirmationModal = ({
35
34
  syncBlockStoreManager,
36
35
  api
37
36
  }) => {
38
- var _api$core2, _api$core4, _api$core6, _syncBlockIds$length;
37
+ var _api$core2, _api$core4, _api$core6;
39
38
  const [isOpen, setIsOpen] = useState(false);
40
39
  const [syncBlockIds, setSyncBlockIds] = useState(undefined);
41
40
  const [referenceCount, setReferenceCount] = useState(undefined);
@@ -119,7 +118,7 @@ export const DeleteConfirmationModal = ({
119
118
  }
120
119
  }, [api === null || api === void 0 ? void 0 : (_api$core6 = api.core) === null || _api$core6 === void 0 ? void 0 : _api$core6.actions, bodiedSyncBlockDeletionStatus, isOpen]);
121
120
  useEffect(() => {
122
- if (isOpen && syncBlockIds !== undefined && fg('platform_synced_block_dogfooding')) {
121
+ if (isOpen && syncBlockIds !== undefined) {
123
122
  const fetchReferences = async () => {
124
123
  try {
125
124
  const references = await Promise.all(syncBlockIds.map(async syncBlockId => {
@@ -144,7 +143,7 @@ export const DeleteConfirmationModal = ({
144
143
  onClose: handleClick(false),
145
144
  testId: "sync-block-delete-confirmation",
146
145
  height: 184
147
- }, fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(React.Fragment, null, referenceCount === undefined ? /*#__PURE__*/React.createElement(Box, {
146
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, referenceCount === undefined ? /*#__PURE__*/React.createElement(Box, {
148
147
  xcss: styles.spinner
149
148
  }, /*#__PURE__*/React.createElement(Spinner, {
150
149
  size: "large"
@@ -157,22 +156,7 @@ export const DeleteConfirmationModal = ({
157
156
  isDisabled: isOfflineMode(mode),
158
157
  deleteReason: deleteReason,
159
158
  sourceCount: (syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) || 0
160
- })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalHeader, {
161
- hasCloseButton: true
162
- }, /*#__PURE__*/React.createElement(ModalTitle, {
163
- appearance: "warning"
164
- }, formatMessage(messages.deleteConfirmationModalTitleSingle))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, null, formatMessage(messages.deleteConfirmationModalDescription, {
165
- syncBlockCount: (_syncBlockIds$length = syncBlockIds === null || syncBlockIds === void 0 ? void 0 : syncBlockIds.length) !== null && _syncBlockIds$length !== void 0 ? _syncBlockIds$length : 1
166
- }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
167
- appearance: "subtle",
168
- onClick: handleClick(false)
169
- }, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
170
- appearance: "warning",
171
- onClick: handleClick(true),
172
- autoFocus: true,
173
- isDisabled: isOfflineMode(mode),
174
- isLoading: bodiedSyncBlockDeletionStatus === 'processing'
175
- }, formatMessage(messages.deleteConfirmationModalDeleteButton))))));
159
+ }))));
176
160
  };
177
161
  const ModalContent = ({
178
162
  content,
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl-next';
3
3
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
4
  import { SyncBlockLabelSharedCssClassName } from '@atlaskit/editor-common/sync-block';
5
5
  import BlockSyncedIcon from '@atlaskit/icon-lab/core/block-synced';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { Text } from '@atlaskit/primitives/compiled';
8
7
  import Tooltip from '@atlaskit/tooltip';
9
8
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -22,17 +21,12 @@ const SyncBlockLabelComponent = ({
22
21
  } = intl;
23
22
  const [tooltipContent, setTooltipContent] = useState(formatMessage(messages.defaultSyncBlockTooltip));
24
23
  let tooltipMessage = formatMessage(messages.defaultSyncBlockTooltip);
25
- if (isSource && !fg('platform_synced_block_dogfooding')) {
26
- tooltipMessage = formatMessage(messages.sourceSyncBlockTooltip);
27
- } else if (title) {
24
+ if (title) {
28
25
  tooltipMessage = formatMessage(messages.referenceSyncBlockTooltip, {
29
26
  title
30
27
  });
31
28
  }
32
29
  const updateTooltipContent = useCallback(() => {
33
- if (!fg('platform_synced_block_dogfooding')) {
34
- return;
35
- }
36
30
  let tooltipContent = tooltipMessage;
37
31
  if (contentUpdatedAt) {
38
32
  const elapsedTime = formatElapsedTime(contentUpdatedAt, intl);
@@ -52,7 +46,7 @@ const SyncBlockLabelComponent = ({
52
46
  }, [contentUpdatedAt, formatMessage, intl, tooltipMessage]);
53
47
  const ariaDescribedById = `sync-block-label-description-${localId}`;
54
48
  const getLabelContent = useMemo(() => {
55
- if (isUnsyncedBlock && fg('platform_synced_block_dogfooding')) {
49
+ if (isUnsyncedBlock) {
56
50
  return /*#__PURE__*/React.createElement(Text, {
57
51
  size: "small",
58
52
  color: "color.text.subtle"
@@ -81,12 +75,12 @@ const SyncBlockLabelComponent = ({
81
75
  size: "small",
82
76
  label: ""
83
77
  }), getLabelContent);
84
- if ((isSource || isUnsyncedBlock) && fg('platform_synced_block_dogfooding')) {
78
+ if (isSource || isUnsyncedBlock) {
85
79
  return label;
86
80
  }
87
81
  return /*#__PURE__*/React.createElement(Tooltip, {
88
82
  position: "top",
89
- content: fg('platform_synced_block_dogfooding') ? tooltipContent : tooltipMessage
83
+ content: tooltipContent
90
84
  // workaround because tooltip adds aria-describedby with a new id every time the tooltip is opened
91
85
  // this causes an infinite rerender loop because of the forwardRef from the node view we are inside in bodiedSyncBlock
92
86
  // tooltip content is available for screen readers in visually hidden content after the label
@@ -1,13 +1,12 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  export const SYNC_BLOCK_FETCH_INTERVAL = 3000;
6
5
 
7
6
  // Component that manages synced block data synchronization.
8
- // When the feature flag 'platform_synced_block_dogfooding' is enabled,
9
- // it uses provider-based GraphQL subscriptions for updates.
10
- // When disabled, it falls back to polling at regular intervals.
7
+ // Component that manages synced block data synchronization.
8
+ // Uses provider-based GraphQL subscriptions for updates when online.
9
+ // Falls back to polling at regular intervals when offline.
11
10
  export const SyncBlockRefresher = ({
12
11
  syncBlockStoreManager,
13
12
  api
@@ -20,14 +19,13 @@ export const SyncBlockRefresher = ({
20
19
  mode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
21
20
  };
22
21
  });
23
- const featureFlagEnabled = fg('platform_synced_block_dogfooding');
24
22
  const isOnline = !isOfflineMode(mode);
25
23
  useEffect(() => {
26
- const useRealTimeSubscriptions = featureFlagEnabled && isOnline;
24
+ const useRealTimeSubscriptions = isOnline;
27
25
  syncBlockStoreManager.referenceManager.setRealTimeSubscriptionsEnabled(useRealTimeSubscriptions);
28
- }, [syncBlockStoreManager, featureFlagEnabled, isOnline]);
26
+ }, [syncBlockStoreManager, isOnline]);
29
27
  useEffect(() => {
30
- const useRealTimeSubscriptions = featureFlagEnabled && isOnline;
28
+ const useRealTimeSubscriptions = isOnline;
31
29
  if (useRealTimeSubscriptions) {
32
30
  return;
33
31
  }
@@ -46,6 +44,6 @@ export const SyncBlockRefresher = ({
46
44
  return () => {
47
45
  window.clearInterval(interval);
48
46
  };
49
- }, [syncBlockStoreManager, isOnline, featureFlagEnabled]);
47
+ }, [syncBlockStoreManager, isOnline]);
50
48
  return null;
51
49
  };
@@ -6,6 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useState, useEffect } from 'react';
7
7
  import { cx } from '@compiled/react';
8
8
  import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
9
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
9
10
  import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
10
11
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
11
12
  import { IconTile } from '@atlaskit/icon';
@@ -16,6 +17,7 @@ import QuotationMarkIcon from '@atlaskit/icon/core/quotation-mark';
16
17
  import StatusErrorIcon from '@atlaskit/icon/core/status-error';
17
18
  import { ConfluenceIcon, JiraIcon, AtlassianIcon } from '@atlaskit/logo';
18
19
  import Lozenge from '@atlaskit/lozenge';
20
+ import { fg } from '@atlaskit/platform-feature-flags';
19
21
  import { Box, Text, Inline, Anchor, Stack } from '@atlaskit/primitives/compiled';
20
22
  import Spinner from '@atlaskit/spinner';
21
23
  import Tooltip from '@atlaskit/tooltip';
@@ -147,7 +149,8 @@ export const SyncedLocationDropdown = ({
147
149
  resourceId,
148
150
  intl,
149
151
  isSource,
150
- localId
152
+ localId,
153
+ api
151
154
  }) => {
152
155
  const {
153
156
  formatMessage
@@ -159,12 +162,14 @@ export const SyncedLocationDropdown = ({
159
162
  onOpenChange: ({
160
163
  isOpen
161
164
  }) => setIsOpen(isOpen),
165
+ testId: fg('platform_synced_block_patch_1') ? 'synced-block-synced-locations-dropdown' : undefined,
162
166
  trigger: ({
163
167
  triggerRef,
164
168
  ...triggerProps
165
169
  }) => /*#__PURE__*/React.createElement(Button, _extends({
166
170
  ref: triggerRef,
167
171
  areAnyNewToolbarFlagsEnabled: true,
172
+ selected: fg('platform_synced_block_patch_1') ? isOpen : undefined,
168
173
  iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
169
174
  color: "currentColor",
170
175
  spacing: "spacious",
@@ -178,7 +183,8 @@ export const SyncedLocationDropdown = ({
178
183
  resourceId: resourceId,
179
184
  intl: intl,
180
185
  isSource: isSource,
181
- localId: localId
186
+ localId: localId,
187
+ api: api
182
188
  }));
183
189
  };
184
190
  const DropdownContent = ({
@@ -186,7 +192,8 @@ const DropdownContent = ({
186
192
  resourceId,
187
193
  intl,
188
194
  isSource,
189
- localId
195
+ localId,
196
+ api
190
197
  }) => {
191
198
  const {
192
199
  formatMessage
@@ -206,6 +213,20 @@ const DropdownContent = ({
206
213
  };
207
214
  getReferenceData();
208
215
  }, [syncBlockStore, intl, isSource, localId, resourceId]);
216
+ const handleLocationClick = () => {
217
+ if (fg('platform_synced_block_patch_1')) {
218
+ var _api$analytics, _api$analytics$action;
219
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent({
220
+ eventType: EVENT_TYPE.OPERATIONAL,
221
+ action: ACTION.CLICKED,
222
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
223
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CLICK_SYNCED_LOCATION,
224
+ attributes: {
225
+ resourceId
226
+ }
227
+ });
228
+ }
229
+ };
209
230
  const content = () => {
210
231
  switch (fetchStatus) {
211
232
  case 'loading':
@@ -234,7 +255,8 @@ const DropdownContent = ({
234
255
  }),
235
256
  href: reference.url,
236
257
  target: "_blank",
237
- key: reference.title
258
+ key: reference.title,
259
+ onClick: () => handleLocationClick()
238
260
  }, /*#__PURE__*/React.createElement(ItemTitle, {
239
261
  title: reference.title || reference.url || '',
240
262
  formatMessage: formatMessage,
@@ -261,7 +283,8 @@ const ErrorScreen = ({
261
283
  formatMessage
262
284
  }) => {
263
285
  return /*#__PURE__*/React.createElement(Box, {
264
- xcss: styles.errorContainer
286
+ xcss: styles.errorContainer,
287
+ testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-error' : undefined
265
288
  }, /*#__PURE__*/React.createElement(Box, {
266
289
  xcss: styles.errorIcon
267
290
  }, /*#__PURE__*/React.createElement(StatusErrorIcon, {
@@ -279,7 +302,8 @@ const NoResultScreen = ({
279
302
  }) => {
280
303
  return /*#__PURE__*/React.createElement(Stack, {
281
304
  xcss: styles.noResultsContainer,
282
- space: "space.100"
305
+ space: "space.100",
306
+ testId: fg('platform_synced_block_patch_1') ? 'synced-locations-dropdown-content-no-results' : undefined
283
307
  }, /*#__PURE__*/React.createElement(Text, {
284
308
  as: "p"
285
309
  }, formatMessage(messages.syncedLocationDropdownNoResults)), /*#__PURE__*/React.createElement(Text, {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import commonMessages, { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
3
4
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
4
5
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
@@ -52,12 +53,12 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
52
53
  title: formatMessage(commonMessages.delete),
53
54
  onClick: removeSyncedBlock(api),
54
55
  icon: DeleteIcon,
55
- testId: fg('platform_synced_block_dogfooding') ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined,
56
- ...hoverDecorationProps(nodeType, fg('platform_synced_block_dogfooding') ? undefined : akEditorSelectedNodeClassName)
56
+ testId: SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete,
57
+ ...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
57
58
  };
58
59
  items.push(deleteButton);
59
60
  } else {
60
- if (!isErroredBlock && fg('platform_synced_block_dogfooding')) {
61
+ if (!isErroredBlock) {
61
62
  const syncedLocation = {
62
63
  type: 'custom',
63
64
  fallback: [],
@@ -67,7 +68,8 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
67
68
  resourceId: resourceId,
68
69
  localId: localId,
69
70
  intl: intl,
70
- isSource: isBodiedSyncBlock
71
+ isSource: isBodiedSyncBlock,
72
+ api: api
71
73
  });
72
74
  }
73
75
  };
@@ -81,7 +83,8 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
81
83
  label: ""
82
84
  }),
83
85
  title: formatMessage(messages.unsyncButton),
84
- onClick: () => unsync(syncBlockStore, isBodiedSyncBlock, view)
86
+ onClick: () => unsync(syncBlockStore, isBodiedSyncBlock, view),
87
+ testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceUnsync : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceUnsync : undefined
85
88
  });
86
89
  }
87
90
  };
@@ -95,7 +98,7 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
95
98
  title: formatMessage(messages.copySyncBlockLabel),
96
99
  showTitle: false,
97
100
  tooltipContent: formatMessage(messages.copySyncedBlockTooltip),
98
- onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, api),
101
+ onClick: copySyncedBlockReferenceToClipboard(syncBlockStore, INPUT_METHOD.SYNCED_BLOCK_TB, api),
99
102
  ...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
100
103
  };
101
104
  items.push(copyButton);
@@ -128,6 +131,7 @@ export const getToolbarConfig = (state, intl, api, syncBlockStore) => {
128
131
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
129
132
  label: ""
130
133
  }),
134
+ testId: fg('platform_synced_block_patch_1') ? isBodiedSyncBlock ? SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarSourceDelete : SYNCED_BLOCK_BUTTON_TEST_ID.syncedBlockToolbarReferenceDelete : undefined,
131
135
  ...hoverDecorationProps(nodeType)
132
136
  }]
133
137
  }];
@@ -24,17 +24,15 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
24
24
  var paragraphNode = paragraph.createAndFill({});
25
25
  var newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(attrs, paragraphNode ? [paragraphNode] : []);
26
26
  if (!newBodiedSyncBlockNode) {
27
- if (fg('platform_synced_block_dogfooding')) {
28
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
29
- action: ACTION.ERROR,
30
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
31
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
32
- attributes: {
33
- error: 'Create and fill for empty content failed'
34
- },
35
- eventType: EVENT_TYPE.OPERATIONAL
36
- });
37
- }
27
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
28
+ action: ACTION.ERROR,
29
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
30
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
31
+ attributes: {
32
+ error: 'Create and fill for empty content failed'
33
+ },
34
+ eventType: EVENT_TYPE.OPERATIONAL
35
+ });
38
36
  return false;
39
37
  }
40
38
 
@@ -49,33 +47,29 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
49
47
  } else {
50
48
  var conversionInfo = canBeConvertedToSyncBlock(tr.selection);
51
49
  if (!conversionInfo) {
52
- if (fg('platform_synced_block_dogfooding')) {
53
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
54
- action: ACTION.ERROR,
55
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
56
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
57
- attributes: {
58
- error: 'Content cannot be converted to sync block'
59
- },
60
- eventType: EVENT_TYPE.OPERATIONAL
61
- });
62
- }
50
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
51
+ action: ACTION.ERROR,
52
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
53
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
54
+ attributes: {
55
+ error: 'Content cannot be converted to sync block'
56
+ },
57
+ eventType: EVENT_TYPE.OPERATIONAL
58
+ });
63
59
  return false;
64
60
  }
65
61
  var _attrs = syncBlockStore.sourceManager.generateBodiedSyncBlockAttrs();
66
62
  var _newBodiedSyncBlockNode = bodiedSyncBlock.createAndFill(_attrs, conversionInfo.contentToInclude);
67
63
  if (!_newBodiedSyncBlockNode) {
68
- if (fg('platform_synced_block_dogfooding')) {
69
- fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
70
- action: ACTION.ERROR,
71
- actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
72
- actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
73
- attributes: {
74
- error: 'Create and fill for content failed'
75
- },
76
- eventType: EVENT_TYPE.OPERATIONAL
77
- });
78
- }
64
+ fireAnalyticsEvent === null || fireAnalyticsEvent === void 0 || fireAnalyticsEvent({
65
+ action: ACTION.ERROR,
66
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
67
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_CREATE,
68
+ attributes: {
69
+ error: 'Create and fill for content failed'
70
+ },
71
+ eventType: EVENT_TYPE.OPERATIONAL
72
+ });
79
73
  return false;
80
74
  }
81
75
 
@@ -92,23 +86,36 @@ export var createSyncedBlock = function createSyncedBlock(_ref) {
92
86
  // see filterTransaction for more details
93
87
  return tr;
94
88
  };
95
- export var copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore, api) {
89
+ export var copySyncedBlockReferenceToClipboardEditorCommand = function copySyncedBlockReferenceToClipboardEditorCommand(syncBlockStore, inputMethod, api) {
96
90
  return function (_ref2) {
97
91
  var tr = _ref2.tr;
98
- if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection, syncBlockStore, api)) {
92
+ if (copySyncedBlockReferenceToClipboardInternal(tr.doc.type.schema, tr.selection, syncBlockStore, inputMethod, api)) {
99
93
  return tr;
100
94
  }
101
95
  return null;
102
96
  };
103
97
  };
104
- export var copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(syncBlockStore, api) {
98
+ export var copySyncedBlockReferenceToClipboard = function copySyncedBlockReferenceToClipboard(syncBlockStore, inputMethod, api) {
105
99
  return function (state, _dispatch, _view) {
106
- return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection, syncBlockStore, api);
100
+ return copySyncedBlockReferenceToClipboardInternal(state.tr.doc.type.schema, state.tr.selection, syncBlockStore, inputMethod, api);
107
101
  };
108
102
  };
109
- var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore, api) {
103
+ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockReferenceToClipboardInternal(schema, selection, syncBlockStore, inputMethod, api) {
110
104
  var syncBlockFindResult = findSyncBlockOrBodiedSyncBlock(schema, selection);
111
105
  if (!syncBlockFindResult) {
106
+ if (fg('platform_synced_block_patch_1')) {
107
+ var _api$analytics;
108
+ api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.fireAnalyticsEvent({
109
+ eventType: EVENT_TYPE.OPERATIONAL,
110
+ action: ACTION.ERROR,
111
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
112
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
113
+ attributes: {
114
+ error: 'No sync block found in selection',
115
+ inputMethod: inputMethod
116
+ }
117
+ });
118
+ }
112
119
  return false;
113
120
  }
114
121
  var isBodiedSyncBlock = isBodiedSyncBlockNode(syncBlockFindResult.node, schema.nodes.bodiedSyncBlock);
@@ -121,12 +128,39 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
121
128
  resourceId: syncBlockStore.referenceManager.generateResourceIdForReference(syncBlockFindResult.node.attrs.resourceId)
122
129
  });
123
130
  if (!referenceSyncBlockNode) {
131
+ if (fg('platform_synced_block_patch_1')) {
132
+ var _api$analytics2;
133
+ api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
134
+ eventType: EVENT_TYPE.OPERATIONAL,
135
+ action: ACTION.ERROR,
136
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
137
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
138
+ attributes: {
139
+ error: 'Failed to create reference sync block node',
140
+ resourceId: syncBlockFindResult.node.attrs.resourceId,
141
+ inputMethod: inputMethod
142
+ }
143
+ });
144
+ }
124
145
  return false;
125
146
  }
126
147
  } else {
127
148
  referenceSyncBlockNode = syncBlockFindResult.node;
128
149
  }
129
150
  if (!referenceSyncBlockNode) {
151
+ if (fg('platform_synced_block_patch_1')) {
152
+ var _api$analytics3;
153
+ api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || (_api$analytics3 = _api$analytics3.actions) === null || _api$analytics3 === void 0 || _api$analytics3.fireAnalyticsEvent({
154
+ eventType: EVENT_TYPE.OPERATIONAL,
155
+ action: ACTION.ERROR,
156
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
157
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
158
+ attributes: {
159
+ error: 'No reference sync block node available',
160
+ inputMethod: inputMethod
161
+ }
162
+ });
163
+ }
130
164
  return false;
131
165
  }
132
166
  var domNode = toDOM(referenceSyncBlockNode, schema);
@@ -136,6 +170,19 @@ var copySyncedBlockReferenceToClipboardInternal = function copySyncedBlockRefere
136
170
  setTimeout(function () {
137
171
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
138
172
  var tr = _ref3.tr;
173
+ if (fg('platform_synced_block_patch_1')) {
174
+ var _api$analytics4;
175
+ api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || (_api$analytics4 = _api$analytics4.actions) === null || _api$analytics4 === void 0 || _api$analytics4.fireAnalyticsEvent({
176
+ eventType: EVENT_TYPE.OPERATIONAL,
177
+ action: ACTION.COPIED,
178
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
179
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_COPY,
180
+ attributes: {
181
+ resourceId: referenceSyncBlockNode.attrs.resourceId,
182
+ inputMethod: inputMethod
183
+ }
184
+ });
185
+ }
139
186
  return tr.setMeta(syncedBlockPluginKey, {
140
187
  activeFlag: {
141
188
  id: FLAG_ID.SYNC_BLOCK_COPIED
@@ -155,11 +202,23 @@ export var editSyncedBlockSource = function editSyncedBlockSource(syncBlockStore
155
202
  }
156
203
  var syncBlockURL = syncBlockStore.referenceManager.getSyncBlockURL(resourceId);
157
204
  if (syncBlockURL) {
205
+ if (fg('platform_synced_block_patch_1')) {
206
+ var _api$analytics5;
207
+ api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
208
+ eventType: EVENT_TYPE.OPERATIONAL,
209
+ action: ACTION.SYNCED_BLOCK_EDIT_SOURCE,
210
+ actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
211
+ actionSubjectId: ACTION_SUBJECT_ID.SYNCED_BLOCK_SOURCE_URL,
212
+ attributes: {
213
+ resourceId: resourceId
214
+ }
215
+ });
216
+ }
158
217
  window.open(syncBlockURL, '_blank');
159
218
  } else {
160
- var _api$analytics;
219
+ var _api$analytics6;
161
220
  var tr = state.tr;
162
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
221
+ api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 || (_api$analytics6 = _api$analytics6.actions) === null || _api$analytics6 === void 0 || _api$analytics6.attachAnalyticsEvent({
163
222
  eventType: EVENT_TYPE.OPERATIONAL,
164
223
  action: ACTION.ERROR,
165
224
  actionSubject: ACTION_SUBJECT.SYNCED_BLOCK,
@@ -12,7 +12,6 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
12
12
  import { BodiedSyncBlockSharedCssClassName } from '@atlaskit/editor-common/sync-block';
13
13
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
14
14
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
15
  import { BodiedSyncBlockWrapper } from '../ui/BodiedSyncBlockWrapper';
17
16
  var toDOM = function toDOM() {
18
17
  return ['div', {
@@ -90,7 +89,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
90
89
  if (!syncBlockStore) {
91
90
  return null;
92
91
  }
93
- return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
92
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
94
93
  component: ACTION_SUBJECT.SYNCED_BLOCK,
95
94
  dispatchAnalyticsEvent: (_this$api6 = this.api) === null || _this$api6 === void 0 || (_this$api6 = _this$api6.analytics) === null || _this$api6 === void 0 ? void 0 : _this$api6.actions.fireAnalyticsEvent,
96
95
  fallbackComponent: null
@@ -98,11 +97,7 @@ var BodiedSyncBlock = /*#__PURE__*/function (_ReactNodeView) {
98
97
  ref: forwardRef,
99
98
  syncBlockStore: syncBlockStore,
100
99
  node: this.node
101
- })) : /*#__PURE__*/React.createElement(BodiedSyncBlockWrapper, {
102
- ref: forwardRef,
103
- syncBlockStore: syncBlockStore,
104
- node: this.node
105
- });
100
+ }));
106
101
  }
107
102
  }, {
108
103
  key: "getContentDOM",
@@ -13,7 +13,6 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
13
13
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
14
14
  import { SyncBlockSharedCssClassName, SyncBlockActionsProvider } from '@atlaskit/editor-common/sync-block';
15
15
  import { useFetchSyncBlockData as _useFetchSyncBlockData, useFetchSyncBlockTitle as _useFetchSyncBlockTitle } from '@atlaskit/editor-synced-block-provider';
16
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { removeSyncedBlockAtPos } from '../editor-commands';
18
17
  import { SyncBlockRendererWrapper } from '../ui/SyncBlockRendererWrapper';
19
18
  export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
@@ -42,8 +41,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
42
41
  _this$api,
43
42
  _this$api2,
44
43
  _this2 = this,
45
- _this$options2,
46
- _this$options3;
44
+ _this$options2;
47
45
  var getPos = _ref.getPos;
48
46
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.syncedBlockRenderer)) {
49
47
  return null;
@@ -54,14 +52,13 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
54
52
  if (!resourceId || !localId) {
55
53
  return null;
56
54
  }
57
- var initialSyncBlockStore = fg('platform_synced_block_dogfooding') ? this.syncBlockStore : undefined;
58
- var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : initialSyncBlockStore;
55
+ var syncBlockStore = (_this$api$syncedBlock = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.syncedBlock) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.syncBlockStore) !== null && _this$api$syncedBlock !== void 0 ? _this$api$syncedBlock : this.syncBlockStore;
59
56
  if (!syncBlockStore) {
60
57
  return null;
61
58
  }
62
59
 
63
60
  // get document node from data provider
64
- return fg('platform_synced_block_dogfooding') ? /*#__PURE__*/React.createElement(ErrorBoundary, {
61
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
65
62
  component: ACTION_SUBJECT.SYNCED_BLOCK,
66
63
  dispatchAnalyticsEvent: (_this$api2 = this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.analytics) === null || _this$api2 === void 0 ? void 0 : _this$api2.actions.fireAnalyticsEvent,
67
64
  fallbackComponent: null
@@ -86,18 +83,7 @@ export var SyncBlock = /*#__PURE__*/function (_ReactNodeView) {
86
83
  return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api = _this2.api) === null || _this2$api === void 0 || (_this2$api = _this2$api.analytics) === null || _this2$api === void 0 || (_this2$api = _this2$api.actions) === null || _this2$api === void 0 ? void 0 : _this2$api.fireAnalyticsEvent);
87
84
  },
88
85
  api: this.api
89
- }))) : /*#__PURE__*/React.createElement(SyncBlockRendererWrapper, {
90
- localId: this.node.attrs.localId,
91
- syncedBlockRenderer: (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.syncedBlockRenderer,
92
- useFetchSyncBlockTitle: function useFetchSyncBlockTitle() {
93
- return _useFetchSyncBlockTitle(syncBlockStore, _this2.node);
94
- },
95
- useFetchSyncBlockData: function useFetchSyncBlockData() {
96
- var _this2$api2;
97
- return _useFetchSyncBlockData(syncBlockStore, resourceId, localId, (_this2$api2 = _this2.api) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.analytics) === null || _this2$api2 === void 0 || (_this2$api2 = _this2$api2.actions) === null || _this2$api2 === void 0 ? void 0 : _this2$api2.fireAnalyticsEvent);
98
- },
99
- api: this.api
100
- });
86
+ })));
101
87
  }
102
88
  }, {
103
89
  key: "destroy",