@atlaskit/editor-common 111.35.1 → 112.0.1

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 (32) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/analytics/types/enums.js +2 -0
  3. package/dist/cjs/floating-toolbar/DropdownMenuExtensionItems.js +6 -23
  4. package/dist/cjs/hooks/index.js +1 -8
  5. package/dist/cjs/ncs-step-metrics/index.js +1 -0
  6. package/dist/cjs/preset/core-plugin/index.js +4 -0
  7. package/dist/es2019/analytics/types/enums.js +2 -0
  8. package/dist/es2019/floating-toolbar/DropdownMenuExtensionItems.js +3 -16
  9. package/dist/es2019/hooks/index.js +1 -2
  10. package/dist/es2019/ncs-step-metrics/index.js +1 -0
  11. package/dist/es2019/preset/core-plugin/index.js +4 -0
  12. package/dist/esm/analytics/types/enums.js +2 -0
  13. package/dist/esm/floating-toolbar/DropdownMenuExtensionItems.js +6 -23
  14. package/dist/esm/hooks/index.js +1 -2
  15. package/dist/esm/ncs-step-metrics/index.js +1 -0
  16. package/dist/esm/preset/core-plugin/index.js +4 -0
  17. package/dist/types/analytics/index.d.ts +1 -1
  18. package/dist/types/analytics/types/enums.d.ts +1 -0
  19. package/dist/types/analytics/types/events.d.ts +2 -2
  20. package/dist/types/analytics/types/paste-events.d.ts +6 -1
  21. package/dist/types/hooks/index.d.ts +0 -1
  22. package/dist/types-ts4.5/analytics/index.d.ts +1 -1
  23. package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
  24. package/dist/types-ts4.5/analytics/types/events.d.ts +2 -2
  25. package/dist/types-ts4.5/analytics/types/paste-events.d.ts +6 -1
  26. package/dist/types-ts4.5/hooks/index.d.ts +0 -1
  27. package/package.json +2 -2
  28. package/dist/cjs/hooks/useSmartCardReloadAfterCache.js +0 -54
  29. package/dist/es2019/hooks/useSmartCardReloadAfterCache.js +0 -49
  30. package/dist/esm/hooks/useSmartCardReloadAfterCache.js +0 -49
  31. package/dist/types/hooks/useSmartCardReloadAfterCache.d.ts +0 -16
  32. package/dist/types-ts4.5/hooks/useSmartCardReloadAfterCache.d.ts +0 -16
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 112.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`617d79798517c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/617d79798517c) -
8
+ Cleanup platform_editor_table_toolbar_icon_ext_fix_exp gate
9
+ - Updated dependencies
10
+
11
+ ## 112.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [`0fda7892b26bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0fda7892b26bc) -
16
+ [ux] Remove useSmartCardReloadAfterCache hook
17
+
18
+ ### Minor Changes
19
+
20
+ - [`71de71e52182e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71de71e52182e) -
21
+ Remove @atlaskit/editor-plugin-ncs-metrics
22
+
23
+ ### Patch Changes
24
+
25
+ - [`7091cae4a7f26`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7091cae4a7f26) -
26
+ EDITOR-5607 Add analytics for new editor paste menu
27
+ - [`71de71e52182e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71de71e52182e) -
28
+ Add experiment platform_editor_remove_collab_step_metrics which removes step metrics writes to
29
+ local storage from collab edit plugin
30
+ - [`8240c1a7e1875`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8240c1a7e1875) -
31
+ In view mode allow replace document to override behaviour
32
+ - Updated dependencies
33
+
3
34
  ## 111.35.1
4
35
 
5
36
  ### Patch Changes
@@ -182,6 +182,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
182
182
  ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
183
183
  ACTION["SORT_COLUMN"] = "sortedColumn";
184
184
  ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
185
+ // remove this enum when cleaning up platform_editor_remove_collab_step_metrics
185
186
  ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
186
187
  ACTION["STEPS_TRACKED"] = "stepsTracked";
187
188
  ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
@@ -366,6 +367,7 @@ var ACTION_SUBJECT = exports.ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJ
366
367
  ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
367
368
  ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
368
369
  ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
370
+ ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
369
371
  ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
370
372
  return ACTION_SUBJECT;
371
373
  }({});
@@ -8,18 +8,14 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.DropdownMenuExtensionItems = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
12
  var _react = _interopRequireWildcard(require("react"));
14
13
  var _reactLoadable = _interopRequireDefault(require("react-loadable"));
15
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
14
  var _extensions = require("../extensions");
17
15
  var _utils = require("../utils");
18
16
  var _DropdownMenuItem = require("./DropdownMenuItem");
19
17
  var _DropdownSeparator = require("./DropdownSeparator");
20
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
21
- 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; }
22
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
19
  var noop = function noop() {
24
20
  return null;
25
21
  };
@@ -59,12 +55,6 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
59
55
  node = _ref2.node,
60
56
  extension = _ref2.extension,
61
57
  IconComponent = _ref2.IconComponent;
62
- var ButtonIcon = item.icon ? (0, _reactLoadable.default)({
63
- loader: function loader() {
64
- return resolveExtensionIcon(item.icon);
65
- },
66
- loading: noop
67
- }) : undefined;
68
58
  var title = '';
69
59
  if (item.label) {
70
60
  title = item.label;
@@ -76,12 +66,7 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
76
66
  item.disabled = (disabled === null || disabled === void 0 ? void 0 : disabled(item.key)) || false;
77
67
  var getIcon = function getIcon() {
78
68
  var label = item.label || '';
79
- if ((0, _expValEquals.expValEquals)('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
80
- return IconComponent ? /*#__PURE__*/_react.default.createElement(IconComponent, {
81
- label: label
82
- }) : undefined;
83
- }
84
- return ButtonIcon ? /*#__PURE__*/_react.default.createElement(ButtonIcon, {
69
+ return IconComponent ? /*#__PURE__*/_react.default.createElement(IconComponent, {
85
70
  label: label
86
71
  }) : undefined;
87
72
  };
@@ -100,7 +85,6 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
100
85
  };
101
86
  };
102
87
  var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
103
- var _iconRef$current;
104
88
  var item = _ref3.item,
105
89
  editorView = _ref3.editorView,
106
90
  disabled = _ref3.disabled,
@@ -109,7 +93,7 @@ var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
109
93
  dropdownOptions = _ref3.dropdownOptions;
110
94
  // Use ref to keep icon component stable across renders
111
95
  var iconRef = (0, _react.useRef)(null);
112
- if (!iconRef.current && item.icon && (0, _expValEquals.expValEquals)('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
96
+ if (!iconRef.current && item.icon) {
113
97
  iconRef.current = (0, _reactLoadable.default)({
114
98
  loader: function loader() {
115
99
  return resolveExtensionIcon(item.icon);
@@ -117,14 +101,13 @@ var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
117
101
  loading: noop
118
102
  });
119
103
  }
120
- var dropdownItem = convertExtensionToDropdownMenuItem(_objectSpread({
104
+ var dropdownItem = convertExtensionToDropdownMenuItem({
121
105
  item: item,
122
106
  disabled: disabled,
123
107
  node: node,
124
- extension: extension
125
- }, (0, _expValEquals.expValEquals)('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true) ? {
126
- IconComponent: (_iconRef$current = iconRef.current) !== null && _iconRef$current !== void 0 ? _iconRef$current : undefined
127
- } : {}));
108
+ extension: extension,
109
+ IconComponent: iconRef.current
110
+ });
128
111
  if (!dropdownItem) {
129
112
  return null;
130
113
  }
@@ -28,14 +28,7 @@ Object.defineProperty(exports, "useSharedPluginStateWithSelector", {
28
28
  return _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector;
29
29
  }
30
30
  });
31
- Object.defineProperty(exports, "useSmartCardReloadAfterCache", {
32
- enumerable: true,
33
- get: function get() {
34
- return _useSmartCardReloadAfterCache.default;
35
- }
36
- });
37
31
  var _usePreviousState = _interopRequireDefault(require("./usePreviousState"));
38
32
  var _useConstructor = _interopRequireDefault(require("./useConstructor"));
39
33
  var _useSharedPluginState = require("./useSharedPluginState");
40
- var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
41
- var _useSmartCardReloadAfterCache = _interopRequireDefault(require("./useSmartCardReloadAfterCache"));
34
+ var _useSharedPluginStateWithSelector = require("./useSharedPluginStateWithSelector");
@@ -7,6 +7,7 @@ exports.NCS_STORAGE = void 0;
7
7
  // Disable no-re-export rule for entry point files
8
8
  /* eslint-disable @atlaskit/editor/no-re-export */
9
9
  var NCS_STORAGE = exports.NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
10
+ // remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
10
11
  NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
11
12
  NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
12
13
  NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.corePlugin = void 0;
7
7
  var _model = require("@atlaskit/editor-prosemirror/model");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _nodeAnchorProvider = require("../../node-anchor/node-anchor-provider");
9
10
  var _processRawValue = require("../../utils/processRawValue");
10
11
  var _editorCommands = require("../editor-commands");
@@ -101,6 +102,9 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
101
102
  if (content) {
102
103
  var _options$scrollIntoVi2;
103
104
  var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
105
+ if ((0, _expValEquals.expValEquals)('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
106
+ tr.setMeta('replaceDocument', true);
107
+ }
104
108
  if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
105
109
  tr.setMeta('addToHistory', false);
106
110
  }
@@ -176,6 +176,7 @@ export let ACTION = /*#__PURE__*/function (ACTION) {
176
176
  ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
177
177
  ACTION["SORT_COLUMN"] = "sortedColumn";
178
178
  ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
179
+ // remove this enum when cleaning up platform_editor_remove_collab_step_metrics
179
180
  ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
180
181
  ACTION["STEPS_TRACKED"] = "stepsTracked";
181
182
  ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
@@ -360,6 +361,7 @@ export let ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
360
361
  ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
361
362
  ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
362
363
  ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
364
+ ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
363
365
  ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
364
366
  return ACTION_SUBJECT;
365
367
  }({});
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import Loadable from 'react-loadable';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { getContextualToolbarItemsFromModule } from '../extensions';
5
4
  import { nodeToJSON } from '../utils';
6
5
  import { DropdownMenuItem } from './DropdownMenuItem';
@@ -23,10 +22,6 @@ const convertExtensionToDropdownMenuItem = ({
23
22
  extension,
24
23
  IconComponent
25
24
  }) => {
26
- const ButtonIcon = item.icon ? Loadable({
27
- loader: () => resolveExtensionIcon(item.icon),
28
- loading: noop
29
- }) : undefined;
30
25
  let title = '';
31
26
  if (item.label) {
32
27
  title = item.label;
@@ -38,12 +33,7 @@ const convertExtensionToDropdownMenuItem = ({
38
33
  item.disabled = (disabled === null || disabled === void 0 ? void 0 : disabled(item.key)) || false;
39
34
  const getIcon = () => {
40
35
  const label = item.label || '';
41
- if (expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
42
- return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
43
- label: label
44
- }) : undefined;
45
- }
46
- return ButtonIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
36
+ return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
47
37
  label: label
48
38
  }) : undefined;
49
39
  };
@@ -69,10 +59,9 @@ const DropdownMenuExtensionItem = ({
69
59
  extension,
70
60
  dropdownOptions
71
61
  }) => {
72
- var _iconRef$current;
73
62
  // Use ref to keep icon component stable across renders
74
63
  const iconRef = useRef(null);
75
- if (!iconRef.current && item.icon && expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
64
+ if (!iconRef.current && item.icon) {
76
65
  iconRef.current = Loadable({
77
66
  loader: () => resolveExtensionIcon(item.icon),
78
67
  loading: noop
@@ -83,9 +72,7 @@ const DropdownMenuExtensionItem = ({
83
72
  disabled,
84
73
  node,
85
74
  extension,
86
- ...(expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true) ? {
87
- IconComponent: (_iconRef$current = iconRef.current) !== null && _iconRef$current !== void 0 ? _iconRef$current : undefined
88
- } : {})
75
+ IconComponent: iconRef.current
89
76
  });
90
77
  if (!dropdownItem) {
91
78
  return null;
@@ -4,5 +4,4 @@
4
4
  export { default as usePreviousState } from './usePreviousState';
5
5
  export { default as useConstructor } from './useConstructor';
6
6
  export { useSharedPluginState } from './useSharedPluginState';
7
- export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
8
- export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
7
+ export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export let NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
5
+ // remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
5
6
  NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
6
7
  NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
7
8
  NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
@@ -1,4 +1,5 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
3
4
  import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
4
5
  import { editorCommandToPMCommand } from '../editor-commands';
@@ -103,6 +104,9 @@ export const corePlugin = ({
103
104
  if (content) {
104
105
  var _options$scrollIntoVi2;
105
106
  const tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
107
+ if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
108
+ tr.setMeta('replaceDocument', true);
109
+ }
106
110
  if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
107
111
  tr.setMeta('addToHistory', false);
108
112
  }
@@ -176,6 +176,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
176
176
  ACTION["SELECT_ALL_ESCAPED"] = "selectAllEscaped";
177
177
  ACTION["SORT_COLUMN"] = "sortedColumn";
178
178
  ACTION["SORT_COLUMN_NOT_ALLOWED"] = "sortColumnNotAllowed";
179
+ // remove this enum when cleaning up platform_editor_remove_collab_step_metrics
179
180
  ACTION["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
180
181
  ACTION["STEPS_TRACKED"] = "stepsTracked";
181
182
  ACTION["ORGANIC_CHANGES_TRACKED"] = "organicChangesTracked";
@@ -360,6 +361,7 @@ export var ACTION_SUBJECT = /*#__PURE__*/function (ACTION_SUBJECT) {
360
361
  ACTION_SUBJECT["TOOLBAR_DROPDOWN_MENU_ITEM"] = "toolbarDropdownMenuItem";
361
362
  ACTION_SUBJECT["BLOCK_MENU"] = "blockMenu";
362
363
  ACTION_SUBJECT["BLOCK_MENU_ITEM"] = "blockMenuItem";
364
+ ACTION_SUBJECT["PASTE_ACTIONS_MENU"] = "pasteActionsMenu";
363
365
  ACTION_SUBJECT["SYNCED_BLOCK"] = "syncedBlock";
364
366
  return ACTION_SUBJECT;
365
367
  }({});
@@ -1,12 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- 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; }
5
- 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; }
6
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
4
  import React, { useEffect, useRef, useState } from 'react';
8
5
  import Loadable from 'react-loadable';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
6
  import { getContextualToolbarItemsFromModule } from '../extensions';
11
7
  import { nodeToJSON } from '../utils';
12
8
  import { DropdownMenuItem } from './DropdownMenuItem';
@@ -50,12 +46,6 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
50
46
  node = _ref2.node,
51
47
  extension = _ref2.extension,
52
48
  IconComponent = _ref2.IconComponent;
53
- var ButtonIcon = item.icon ? Loadable({
54
- loader: function loader() {
55
- return resolveExtensionIcon(item.icon);
56
- },
57
- loading: noop
58
- }) : undefined;
59
49
  var title = '';
60
50
  if (item.label) {
61
51
  title = item.label;
@@ -67,12 +57,7 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
67
57
  item.disabled = (disabled === null || disabled === void 0 ? void 0 : disabled(item.key)) || false;
68
58
  var getIcon = function getIcon() {
69
59
  var label = item.label || '';
70
- if (expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
71
- return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
72
- label: label
73
- }) : undefined;
74
- }
75
- return ButtonIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
60
+ return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
76
61
  label: label
77
62
  }) : undefined;
78
63
  };
@@ -91,7 +76,6 @@ var convertExtensionToDropdownMenuItem = function convertExtensionToDropdownMenu
91
76
  };
92
77
  };
93
78
  var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
94
- var _iconRef$current;
95
79
  var item = _ref3.item,
96
80
  editorView = _ref3.editorView,
97
81
  disabled = _ref3.disabled,
@@ -100,7 +84,7 @@ var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
100
84
  dropdownOptions = _ref3.dropdownOptions;
101
85
  // Use ref to keep icon component stable across renders
102
86
  var iconRef = useRef(null);
103
- if (!iconRef.current && item.icon && expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true)) {
87
+ if (!iconRef.current && item.icon) {
104
88
  iconRef.current = Loadable({
105
89
  loader: function loader() {
106
90
  return resolveExtensionIcon(item.icon);
@@ -108,14 +92,13 @@ var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
108
92
  loading: noop
109
93
  });
110
94
  }
111
- var dropdownItem = convertExtensionToDropdownMenuItem(_objectSpread({
95
+ var dropdownItem = convertExtensionToDropdownMenuItem({
112
96
  item: item,
113
97
  disabled: disabled,
114
98
  node: node,
115
- extension: extension
116
- }, expValEquals('platform_editor_table_toolbar_icon_ext_fix_exp', 'isEnabled', true) ? {
117
- IconComponent: (_iconRef$current = iconRef.current) !== null && _iconRef$current !== void 0 ? _iconRef$current : undefined
118
- } : {}));
99
+ extension: extension,
100
+ IconComponent: iconRef.current
101
+ });
119
102
  if (!dropdownItem) {
120
103
  return null;
121
104
  }
@@ -4,5 +4,4 @@
4
4
  export { default as usePreviousState } from './usePreviousState';
5
5
  export { default as useConstructor } from './useConstructor';
6
6
  export { useSharedPluginState } from './useSharedPluginState';
7
- export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
8
- export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
7
+ export { useSharedPluginStateWithSelector } from './useSharedPluginStateWithSelector';
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export var NCS_STORAGE = /*#__PURE__*/function (NCS_STORAGE) {
5
+ // remove step metrics keys when cleaning up platform_editor_remove_collab_step_metrics
5
6
  NCS_STORAGE["NCS_STORAGE_CLIENT_KEY"] = "ncs-session-step-metrics-storage";
6
7
  NCS_STORAGE["NCS_SESSION_STEP_METRICS"] = "ncsSessionStepMetrics";
7
8
  NCS_STORAGE["NCS_ACTIVE_SESSIONS"] = "ncsActiveSessions";
@@ -1,4 +1,5 @@
1
1
  import { Node } from '@atlaskit/editor-prosemirror/model';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
3
4
  import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
4
5
  import { editorCommandToPMCommand } from '../editor-commands';
@@ -96,6 +97,9 @@ export var corePlugin = function corePlugin(_ref) {
96
97
  if (content) {
97
98
  var _options$scrollIntoVi2;
98
99
  var tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content);
100
+ if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
101
+ tr.setMeta('replaceDocument', true);
102
+ }
99
103
  if ((options === null || options === void 0 ? void 0 : options.addToHistory) === false) {
100
104
  tr.setMeta('addToHistory', false);
101
105
  }
@@ -11,7 +11,7 @@ export type { InputMethodInsertLink, InputMethodInsertMedia, InsertMediaVia, Ins
11
11
  export { CHANGE_ALIGNMENT_REASON, TABLE_ACTION, TABLE_BREAKOUT, TABLE_OVERFLOW_CHANGE_TRIGGER, TABLE_STATUS, TABLE_DISPLAY_MODE, } from './types/table-events';
12
12
  export type { TableEventPayload, OverflowStateInfo } from './types/table-events';
13
13
  export { PasteContents, PasteSources, PasteTypes } from './types/paste-events';
14
- export type { PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
14
+ export type { PASTE_ACTION_SUBJECT_ID, PasteActionsMenuEventPayload, PasteActionsMenuOpenedAEP, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
15
15
  export type { MediaSwitchType, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, CaptionTrackAction, MediaResizeTrackAction, MediaInputResizeTrackAction, } from './types/media-events';
16
16
  export type { MoveContentEventPayload } from './types/move-content-events';
17
17
  export type { DispatchAnalyticsEvent } from './types/dispatch-analytics-event';
@@ -353,6 +353,7 @@ export declare enum ACTION_SUBJECT {
353
353
  TOOLBAR_DROPDOWN_MENU_ITEM = "toolbarDropdownMenuItem",
354
354
  BLOCK_MENU = "blockMenu",
355
355
  BLOCK_MENU_ITEM = "blockMenuItem",
356
+ PASTE_ACTIONS_MENU = "pasteActionsMenu",
356
357
  SYNCED_BLOCK = "syncedBlock"
357
358
  }
358
359
  export declare enum ACTION_SUBJECT_ID {
@@ -45,7 +45,7 @@ import type { NcsSessionStepEventAEP } from './ncs-session-step-events';
45
45
  import type { NestedTableActionsEventPayload } from './nested-table-events';
46
46
  import type { NodeEventPayload } from './node-events';
47
47
  import type { OfflineEditingEventPayload } from './offline-editing-event';
48
- import type { PasteEventPayload } from './paste-events';
48
+ import type { PasteActionsMenuEventPayload, PasteEventPayload } from './paste-events';
49
49
  import type { ReferentialityEventPayload } from './referentiality-events';
50
50
  import type { SelectionEventPayload } from './selection-events';
51
51
  import type { SelectionExtensionEventPayload } from './selection-extension-events';
@@ -66,7 +66,7 @@ export type SimplifiedNode = {
66
66
  pos: number;
67
67
  type: string;
68
68
  };
69
- export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
69
+ export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | PasteActionsMenuEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
70
70
  type CustomPanelEventPayload = TrackAEP<ACTION.CHANGED_BACKGROUND_COLOR | ACTION.CHANGED_ICON | ACTION.REMOVE_ICON, ACTION_SUBJECT.PANEL, ACTION_SUBJECT_ID.PANEL, {
71
71
  newColor: string;
72
72
  previousColor: string;
@@ -1,5 +1,5 @@
1
1
  import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
- import type { OperationalAEP, TrackAEP } from './utils';
2
+ import type { OperationalAEP, TrackAEP, UIAEP } from './utils';
3
3
  export declare const PasteTypes: {
4
4
  [type: string]: PasteType;
5
5
  };
@@ -18,6 +18,7 @@ type PasteBaseOperationalAEP<Action, Attributes> = OperationalAEP<Action, ACTION
18
18
  type PasteAEP = PasteBaseAEP<ACTION.PASTED, {
19
19
  content: PasteContent;
20
20
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
21
+ invokedFrom?: string;
21
22
  pasteSize: number;
22
23
  source?: PasteSource;
23
24
  type: PasteType;
@@ -36,4 +37,8 @@ type PastedTimedAEP = PasteBaseOperationalAEP<ACTION.PASTED_TIMED, {
36
37
  time: number;
37
38
  }>;
38
39
  export type PasteEventPayload = PasteAEP | PasteAsPlainAEP | PastedTimedAEP;
40
+ export type PasteActionsMenuOpenedAEP = UIAEP<ACTION.OPENED, ACTION_SUBJECT.PASTE_ACTIONS_MENU, undefined, {
41
+ visibleAiActions: string[];
42
+ }, undefined>;
43
+ export type PasteActionsMenuEventPayload = PasteActionsMenuOpenedAEP;
39
44
  export {};
@@ -2,4 +2,3 @@ export { default as usePreviousState } from './usePreviousState';
2
2
  export { default as useConstructor } from './useConstructor';
3
3
  export { useSharedPluginState } from './useSharedPluginState';
4
4
  export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
5
- export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
@@ -11,7 +11,7 @@ export type { InputMethodInsertLink, InputMethodInsertMedia, InsertMediaVia, Ins
11
11
  export { CHANGE_ALIGNMENT_REASON, TABLE_ACTION, TABLE_BREAKOUT, TABLE_OVERFLOW_CHANGE_TRIGGER, TABLE_STATUS, TABLE_DISPLAY_MODE, } from './types/table-events';
12
12
  export type { TableEventPayload, OverflowStateInfo } from './types/table-events';
13
13
  export { PasteContents, PasteSources, PasteTypes } from './types/paste-events';
14
- export type { PASTE_ACTION_SUBJECT_ID, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
14
+ export type { PASTE_ACTION_SUBJECT_ID, PasteActionsMenuEventPayload, PasteActionsMenuOpenedAEP, PasteContent, PasteEventPayload, PasteSource, PasteType, } from './types/paste-events';
15
15
  export type { MediaSwitchType, MediaAltTextActionType, MediaEventPayload, MediaLinkAEP, CaptionTrackAction, MediaResizeTrackAction, MediaInputResizeTrackAction, } from './types/media-events';
16
16
  export type { MoveContentEventPayload } from './types/move-content-events';
17
17
  export type { DispatchAnalyticsEvent } from './types/dispatch-analytics-event';
@@ -353,6 +353,7 @@ export declare enum ACTION_SUBJECT {
353
353
  TOOLBAR_DROPDOWN_MENU_ITEM = "toolbarDropdownMenuItem",
354
354
  BLOCK_MENU = "blockMenu",
355
355
  BLOCK_MENU_ITEM = "blockMenuItem",
356
+ PASTE_ACTIONS_MENU = "pasteActionsMenu",
356
357
  SYNCED_BLOCK = "syncedBlock"
357
358
  }
358
359
  export declare enum ACTION_SUBJECT_ID {
@@ -45,7 +45,7 @@ import type { NcsSessionStepEventAEP } from './ncs-session-step-events';
45
45
  import type { NestedTableActionsEventPayload } from './nested-table-events';
46
46
  import type { NodeEventPayload } from './node-events';
47
47
  import type { OfflineEditingEventPayload } from './offline-editing-event';
48
- import type { PasteEventPayload } from './paste-events';
48
+ import type { PasteActionsMenuEventPayload, PasteEventPayload } from './paste-events';
49
49
  import type { ReferentialityEventPayload } from './referentiality-events';
50
50
  import type { SelectionEventPayload } from './selection-events';
51
51
  import type { SelectionExtensionEventPayload } from './selection-extension-events';
@@ -66,7 +66,7 @@ export type SimplifiedNode = {
66
66
  pos: number;
67
67
  type: string;
68
68
  };
69
- export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
69
+ export type AnalyticsEventPayload<T = void> = AvatarEventPayload | GeneralEventPayload<T> | FormatEventPayload | SubstituteEventPayload | InsertEventPayload | NodeEventPayload | MoveContentEventPayload | MediaEventPayload | TableEventPayload | PasteEventPayload | PasteActionsMenuEventPayload | CutCopyEventPayload | ErrorEventPayload | TextColorEventPayload | FindReplaceEventPayload | DateEventPayload | SelectionEventPayload | ListEventPayload | ConfigPanelEventPayload | ElementBrowserEventPayload | CreateLinkInlineDialogEventPayload | HighlightActionsEventPayload | UnsupportedContentPayload | ExtensionEventPayload | TransactionEventPayload | TypeAheadPayload | UnlinkToolbarAEP | EditLinkToolbarAEP | PreviewItemClickedAEP | OpenSettingsToolbarAEP | CustomPanelEventPayload | FeatureExposureAEP | NewCollabSyncUpErrorAEP | UnsupportedContentTooltipPayload | ReferentialityEventPayload | LoomEventPayload | MBEEventPayload | HighlightEventPayload | DatasourceClickedPayload | ElementEventPayload | VisitedLinkAEP | ViewEventPayload | MediaUploadEventPayload | MentionEventPayload | EngagementPlatformEventPayload | NestedTableActionsEventPayload | AICommandPaletteEventPayload | AIDefinitionsEventPayload | AIEventPayload | AIStreamingEventPayload | AIProactiveEventPayload | AIUnifiedEventPayload | BreakoutEventPayload | BlockMenuEventPayload | ActiveSessionEventPayload | AIInlineSuggestionPayload | SelectionExtensionEventPayload | TelepointerClickPayload | SelectionToolbarEventPayload | ExperienceEventPayload | AlignmentEventPayload | UndoRedoAEP | OfflineEditingEventPayload | NcsSessionStepEventAEP | FloatingToolbarOverflowEventPayload | SyncBlockEventPayload | FloatingToolbarEventPayload;
70
70
  type CustomPanelEventPayload = TrackAEP<ACTION.CHANGED_BACKGROUND_COLOR | ACTION.CHANGED_ICON | ACTION.REMOVE_ICON, ACTION_SUBJECT.PANEL, ACTION_SUBJECT_ID.PANEL, {
71
71
  newColor: string;
72
72
  previousColor: string;
@@ -1,5 +1,5 @@
1
1
  import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
- import type { OperationalAEP, TrackAEP } from './utils';
2
+ import type { OperationalAEP, TrackAEP, UIAEP } from './utils';
3
3
  export declare const PasteTypes: {
4
4
  [type: string]: PasteType;
5
5
  };
@@ -18,6 +18,7 @@ type PasteBaseOperationalAEP<Action, Attributes> = OperationalAEP<Action, ACTION
18
18
  type PasteAEP = PasteBaseAEP<ACTION.PASTED, {
19
19
  content: PasteContent;
20
20
  inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
21
+ invokedFrom?: string;
21
22
  pasteSize: number;
22
23
  source?: PasteSource;
23
24
  type: PasteType;
@@ -36,4 +37,8 @@ type PastedTimedAEP = PasteBaseOperationalAEP<ACTION.PASTED_TIMED, {
36
37
  time: number;
37
38
  }>;
38
39
  export type PasteEventPayload = PasteAEP | PasteAsPlainAEP | PastedTimedAEP;
40
+ export type PasteActionsMenuOpenedAEP = UIAEP<ACTION.OPENED, ACTION_SUBJECT.PASTE_ACTIONS_MENU, undefined, {
41
+ visibleAiActions: string[];
42
+ }, undefined>;
43
+ export type PasteActionsMenuEventPayload = PasteActionsMenuOpenedAEP;
39
44
  export {};
@@ -2,4 +2,3 @@ export { default as usePreviousState } from './usePreviousState';
2
2
  export { default as useConstructor } from './useConstructor';
3
3
  export { useSharedPluginState } from './useSharedPluginState';
4
4
  export { useSharedPluginStateWithSelector, type NamedPluginStatesFromInjectionAPI, } from './useSharedPluginStateWithSelector';
5
- export { default as useSmartCardReloadAfterCache } from './useSmartCardReloadAfterCache';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "111.35.1",
3
+ "version": "112.0.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.3.0",
83
83
  "@atlaskit/textfield": "^8.2.0",
84
84
  "@atlaskit/theme": "^22.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^35.9.0",
85
+ "@atlaskit/tmp-editor-statsig": "^36.0.0",
86
86
  "@atlaskit/tokens": "^11.1.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _hooks = require("@atlaskit/smart-card/hooks");
9
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
- /**
11
- * Hook to manage smart card reload behavior when content is loaded from local cache.
12
- *
13
- * Handles:
14
- * - Capturing initial card status on mount (synchronously to avoid race conditions)
15
- * - Tracking URL changes and resetting state
16
- * - Only reloading data that was initially loaded from cache
17
- * - Ensuring reload is called at most once per URL
18
- * - Respecting page SSR state to avoid reloading on server-rendered pages
19
- *
20
- * @param url - The smart card URL
21
- * @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
22
- * @param isPageSSRed - Whether the page was server-side rendered
23
- */
24
- var useSmartCardReloadAfterCache = function useSmartCardReloadAfterCache(url, cardStatus, isPageSSRed) {
25
- var initialCardStatus = (0, _react.useRef)(undefined);
26
- var hasReloaded = (0, _react.useRef)(false);
27
- var previousUrl = (0, _react.useRef)(url);
28
- var reload = (0, _hooks.useSmartLinkReload)({
29
- url: url || ''
30
- });
31
-
32
- // Reset refs when URL changes (do this before capturing initial status)
33
- if (previousUrl.current !== url) {
34
- initialCardStatus.current = undefined;
35
- hasReloaded.current = false;
36
- previousUrl.current = url;
37
- }
38
-
39
- // Capture initial card status on first render (synchronously)
40
- // This determines if the card was loaded from cache (resolved on mount)
41
- // or if it's being fetched fresh (pending on mount)
42
- if ((0, _expValEquals.expValEquals)('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
43
- initialCardStatus.current = cardStatus;
44
- }
45
-
46
- // Reload from cache in the background if needed
47
- (0, _react.useEffect)(function () {
48
- if ((0, _expValEquals.expValEquals)('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
49
- hasReloaded.current = true;
50
- reload();
51
- }
52
- }, [isPageSSRed, url, cardStatus, reload]);
53
- };
54
- var _default = exports.default = useSmartCardReloadAfterCache;
@@ -1,49 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
-
5
- /**
6
- * Hook to manage smart card reload behavior when content is loaded from local cache.
7
- *
8
- * Handles:
9
- * - Capturing initial card status on mount (synchronously to avoid race conditions)
10
- * - Tracking URL changes and resetting state
11
- * - Only reloading data that was initially loaded from cache
12
- * - Ensuring reload is called at most once per URL
13
- * - Respecting page SSR state to avoid reloading on server-rendered pages
14
- *
15
- * @param url - The smart card URL
16
- * @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
17
- * @param isPageSSRed - Whether the page was server-side rendered
18
- */
19
- const useSmartCardReloadAfterCache = (url, cardStatus, isPageSSRed) => {
20
- const initialCardStatus = useRef(undefined);
21
- const hasReloaded = useRef(false);
22
- const previousUrl = useRef(url);
23
- const reload = useSmartLinkReload({
24
- url: url || ''
25
- });
26
-
27
- // Reset refs when URL changes (do this before capturing initial status)
28
- if (previousUrl.current !== url) {
29
- initialCardStatus.current = undefined;
30
- hasReloaded.current = false;
31
- previousUrl.current = url;
32
- }
33
-
34
- // Capture initial card status on first render (synchronously)
35
- // This determines if the card was loaded from cache (resolved on mount)
36
- // or if it's being fetched fresh (pending on mount)
37
- if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
38
- initialCardStatus.current = cardStatus;
39
- }
40
-
41
- // Reload from cache in the background if needed
42
- useEffect(() => {
43
- if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
44
- hasReloaded.current = true;
45
- reload();
46
- }
47
- }, [isPageSSRed, url, cardStatus, reload]);
48
- };
49
- export default useSmartCardReloadAfterCache;
@@ -1,49 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
-
5
- /**
6
- * Hook to manage smart card reload behavior when content is loaded from local cache.
7
- *
8
- * Handles:
9
- * - Capturing initial card status on mount (synchronously to avoid race conditions)
10
- * - Tracking URL changes and resetting state
11
- * - Only reloading data that was initially loaded from cache
12
- * - Ensuring reload is called at most once per URL
13
- * - Respecting page SSR state to avoid reloading on server-rendered pages
14
- *
15
- * @param url - The smart card URL
16
- * @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
17
- * @param isPageSSRed - Whether the page was server-side rendered
18
- */
19
- var useSmartCardReloadAfterCache = function useSmartCardReloadAfterCache(url, cardStatus, isPageSSRed) {
20
- var initialCardStatus = useRef(undefined);
21
- var hasReloaded = useRef(false);
22
- var previousUrl = useRef(url);
23
- var reload = useSmartLinkReload({
24
- url: url || ''
25
- });
26
-
27
- // Reset refs when URL changes (do this before capturing initial status)
28
- if (previousUrl.current !== url) {
29
- initialCardStatus.current = undefined;
30
- hasReloaded.current = false;
31
- previousUrl.current = url;
32
- }
33
-
34
- // Capture initial card status on first render (synchronously)
35
- // This determines if the card was loaded from cache (resolved on mount)
36
- // or if it's being fetched fresh (pending on mount)
37
- if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && cardStatus && initialCardStatus.current === undefined) {
38
- initialCardStatus.current = cardStatus;
39
- }
40
-
41
- // Reload from cache in the background if needed
42
- useEffect(function () {
43
- if (expValEquals('platform_editor_smartlink_local_cache', 'isEnabled', true) && !isPageSSRed && url && initialCardStatus.current === 'resolved' && cardStatus === 'resolved' && !hasReloaded.current) {
44
- hasReloaded.current = true;
45
- reload();
46
- }
47
- }, [isPageSSRed, url, cardStatus, reload]);
48
- };
49
- export default useSmartCardReloadAfterCache;
@@ -1,16 +0,0 @@
1
- /**
2
- * Hook to manage smart card reload behavior when content is loaded from local cache.
3
- *
4
- * Handles:
5
- * - Capturing initial card status on mount (synchronously to avoid race conditions)
6
- * - Tracking URL changes and resetting state
7
- * - Only reloading data that was initially loaded from cache
8
- * - Ensuring reload is called at most once per URL
9
- * - Respecting page SSR state to avoid reloading on server-rendered pages
10
- *
11
- * @param url - The smart card URL
12
- * @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
13
- * @param isPageSSRed - Whether the page was server-side rendered
14
- */
15
- declare const useSmartCardReloadAfterCache: (url: string | undefined, cardStatus: string | undefined, isPageSSRed: boolean) => void;
16
- export default useSmartCardReloadAfterCache;
@@ -1,16 +0,0 @@
1
- /**
2
- * Hook to manage smart card reload behavior when content is loaded from local cache.
3
- *
4
- * Handles:
5
- * - Capturing initial card status on mount (synchronously to avoid race conditions)
6
- * - Tracking URL changes and resetting state
7
- * - Only reloading data that was initially loaded from cache
8
- * - Ensuring reload is called at most once per URL
9
- * - Respecting page SSR state to avoid reloading on server-rendered pages
10
- *
11
- * @param url - The smart card URL
12
- * @param cardStatus - The current card resolution status ('pending', 'resolved', etc)
13
- * @param isPageSSRed - Whether the page was server-side rendered
14
- */
15
- declare const useSmartCardReloadAfterCache: (url: string | undefined, cardStatus: string | undefined, isPageSSRed: boolean) => void;
16
- export default useSmartCardReloadAfterCache;