@atlaskit/editor-common 123.5.0 → 123.6.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,26 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 123.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ca3c3208ca55b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca3c3208ca55b) -
8
+ EDITOR-8673 Add template gallery snippet insertion through the editor snippets plugin, with
9
+ completion callbacks and a template gallery input source, behind
10
+ `platform_editor_snippets_plugin_confluence`.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 123.5.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [`74360ce048e56`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74360ce048e56) -
21
+ FFCLEANUP-196833 Cleanup `platform_editor_adf_validator_stage0`
22
+ - Updated dependencies
23
+
3
24
  ## 123.5.0
4
25
 
5
26
  ### Minor Changes
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.USER_CONTEXT = exports.LINK_STATUS = exports.LINK_RESOURCE = exports.LINK_REPRESENTATION = void 0;
6
+ exports.USER_CONTEXT = exports.TEMPLATE_GALLERY_INPUT_SOURCE = exports.LINK_STATUS = exports.LINK_RESOURCE = exports.LINK_REPRESENTATION = void 0;
7
7
  var USER_CONTEXT = exports.USER_CONTEXT = /*#__PURE__*/function (USER_CONTEXT) {
8
8
  USER_CONTEXT["EDIT"] = "edit";
9
9
  USER_CONTEXT["NEW"] = "new";
@@ -37,4 +37,5 @@ var LINK_RESOURCE = exports.LINK_RESOURCE = /*#__PURE__*/function (LINK_RESOURCE
37
37
  LINK_RESOURCE["TWITTER"] = "twitterTweet";
38
38
  LINK_RESOURCE["OTHER"] = "other";
39
39
  return LINK_RESOURCE;
40
- }({});
40
+ }({});
41
+ var TEMPLATE_GALLERY_INPUT_SOURCE = exports.TEMPLATE_GALLERY_INPUT_SOURCE = 'templateGallery';
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "123.4.2";
30
+ var packageVersion = "123.5.1";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "123.4.2";
27
+ var packageVersion = "123.5.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -56,6 +56,7 @@ function MentionWithProfileCard(_ref) {
56
56
  onMouseEnter = _ref.onMouseEnter,
57
57
  onMouseLeave = _ref.onMouseLeave,
58
58
  renderAvatarSlot = _ref.renderAvatarSlot,
59
+ isRovoChat = _ref.isRovoChat,
59
60
  localId = _ref.localId,
60
61
  ssrPlaceholderId = _ref.ssrPlaceholderId,
61
62
  userType = _ref.userType;
@@ -78,6 +79,7 @@ function MentionWithProfileCard(_ref) {
78
79
  onMouseEnter: onMouseEnter,
79
80
  onMouseLeave: onMouseLeave,
80
81
  renderAvatarSlot: renderAvatarSlot,
82
+ isRovoChat: isRovoChat,
81
83
  ssrPlaceholderId: ssrPlaceholderId
82
84
  });
83
85
 
@@ -8,12 +8,15 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.MentionWithProviders = exports.MentionWithAvatarProviders = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
13
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
14
  var _react = _interopRequireWildcard(require("react"));
13
15
  var _resourcedMention = _interopRequireDefault(require("@atlaskit/mention/resourced-mention"));
16
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
14
17
  var _mentionWithProfilecard = _interopRequireDefault(require("./mention-with-profilecard"));
15
18
  var _excluded = ["id", "mentionNodeDataProvider", "userType"];
16
- 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); }
19
+ 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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
17
20
  var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
18
21
  var useMentionNodeData = function useMentionNodeData(_ref) {
19
22
  var _state$data;
@@ -77,6 +80,10 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
77
80
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
78
81
  profilecardProvider = _useState4[0],
79
82
  setProfilecardProvider = _useState4[1];
83
+ var _useState5 = (0, _react.useState)((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') && Boolean(mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat)),
84
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
85
+ isRovoChat = _useState6[0],
86
+ setIsRovoChat = _useState6[1];
80
87
  var mountedRef = (0, _react.useRef)(true);
81
88
  (0, _react.useLayoutEffect)(function () {
82
89
  mountedRef.current = true;
@@ -99,6 +106,57 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
99
106
  }
100
107
  });
101
108
  }, [profilecardProviderResolver]);
109
+ (0, _react.useEffect)(function () {
110
+ if (mentionNodeData !== null && mentionNodeData !== void 0 && mentionNodeData.isRovoChat) {
111
+ setIsRovoChat((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo'));
112
+ return;
113
+ }
114
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') || !mentionProvider) {
115
+ setIsRovoChat(false);
116
+ return;
117
+ }
118
+ var isActive = true;
119
+ var resolveRovoChatIdentity = /*#__PURE__*/function () {
120
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
121
+ var _provider$getRovoChat, provider, identityAccountId, _t;
122
+ return _regenerator.default.wrap(function (_context) {
123
+ while (1) switch (_context.prev = _context.next) {
124
+ case 0:
125
+ _context.prev = 0;
126
+ _context.next = 1;
127
+ return mentionProvider;
128
+ case 1:
129
+ provider = _context.sent;
130
+ _context.next = 2;
131
+ return (_provider$getRovoChat = provider.getRovoChatAgentIdentityAccountId) === null || _provider$getRovoChat === void 0 ? void 0 : _provider$getRovoChat.call(provider);
132
+ case 2:
133
+ identityAccountId = _context.sent;
134
+ if (isActive) {
135
+ setIsRovoChat(identityAccountId !== undefined && identityAccountId === id);
136
+ }
137
+ _context.next = 4;
138
+ break;
139
+ case 3:
140
+ _context.prev = 3;
141
+ _t = _context["catch"](0);
142
+ if (isActive) {
143
+ setIsRovoChat(false);
144
+ }
145
+ case 4:
146
+ case "end":
147
+ return _context.stop();
148
+ }
149
+ }, _callee, null, [[0, 3]]);
150
+ }));
151
+ return function resolveRovoChatIdentity() {
152
+ return _ref3.apply(this, arguments);
153
+ };
154
+ }();
155
+ void resolveRovoChatIdentity();
156
+ return function () {
157
+ isActive = false;
158
+ };
159
+ }, [id, mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat, mentionProvider]);
102
160
  var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? _mentionWithProfilecard.default : _resourcedMention.default;
103
161
  var ssrPlaceholderId = "mention-".concat(id);
104
162
 
@@ -120,7 +178,8 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
120
178
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
121
179
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
122
180
  renderAvatarSlot: renderAvatarSlot,
123
- ssrPlaceholderId: ssrPlaceholderId
181
+ ssrPlaceholderId: ssrPlaceholderId,
182
+ isRovoChat: isRovoChat
124
183
  });
125
184
  }
126
185
  return /*#__PURE__*/_react.default.createElement(MentionComponent, {
@@ -141,14 +200,15 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
141
200
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
142
201
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
143
202
  renderAvatarSlot: renderAvatarSlot,
144
- ssrPlaceholderId: ssrPlaceholderId
203
+ ssrPlaceholderId: ssrPlaceholderId,
204
+ isRovoChat: isRovoChat
145
205
  });
146
206
  });
147
- var MentionWithAvatarProviders = exports.MentionWithAvatarProviders = /*#__PURE__*/_react.default.memo(function (_ref3) {
148
- var id = _ref3.id,
149
- mentionNodeDataProvider = _ref3.mentionNodeDataProvider,
150
- userType = _ref3.userType,
151
- props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
207
+ var MentionWithAvatarProviders = exports.MentionWithAvatarProviders = /*#__PURE__*/_react.default.memo(function (_ref4) {
208
+ var id = _ref4.id,
209
+ mentionNodeDataProvider = _ref4.mentionNodeDataProvider,
210
+ userType = _ref4.userType,
211
+ props = (0, _objectWithoutProperties2.default)(_ref4, _excluded);
152
212
  var mentionNodeData = useMentionNodeData({
153
213
  id: id,
154
214
  mentionNodeDataProvider: mentionNodeDataProvider,
@@ -13,7 +13,6 @@ Object.defineProperty(exports, "wrapWithUnsupported", {
13
13
  });
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _validator = require("@atlaskit/adf-utils/validator");
16
- var _fg = require("@atlaskit/platform-feature-flags/fg");
17
16
  var _analytics = require("../analytics");
18
17
  var _ADFStages = require("./ADFStages");
19
18
  var _trackUnsupportedContent = require("./track-unsupported-content");
@@ -94,28 +93,14 @@ var validationErrorHandler = exports.validationErrorHandler = function validatio
94
93
  }
95
94
  }
96
95
 
97
- // panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
98
- // plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
99
- // `table` inside `panel`, so suppress the INVALID_CONTENT error when the experiment is active.
100
- // This suppression is blunt, allowing a table in every panel, and applies only while
101
- // `platform_editor_adf_validator_stage0` is off. With that gate on, adf-utils offers the stage-0
102
- // `panel_c1` variants and accepts table-in-panel positionally instead, in `doc`, a layout column
103
- // and a synced block only.
104
- if (options.allowTableInPanel && !(0, _fg.fg)('platform_editor_adf_validator_stage0')) {
105
- var _meta = error.meta;
106
- if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
107
- return entity;
108
- }
109
- }
110
-
111
96
  // panel_c1 is a ProseMirror-only variant: on save, expand-in-panel documents are stored as
112
97
  // plain ADF `panel` nodes containing an `expand`. The base validator-spec does not permit
113
98
  // `expand` inside `panel` (it's gated behind the consolidated container-in-panel experiment,
114
99
  // see `isPanelNestingContainerSupported`), so we suppress the INVALID_CONTENT error when
115
100
  // `allowContainerInPanel` is set.
116
101
  if (options.allowContainerInPanel) {
117
- var _meta2 = error.meta;
118
- if ((_meta2 === null || _meta2 === void 0 ? void 0 : _meta2.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'expand') {
102
+ var _meta = error.meta;
103
+ if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'expand') {
119
104
  return entity;
120
105
  }
121
106
  }
@@ -179,7 +164,6 @@ var validateADFEntity = exports.validateADFEntity = function validateADFEntity(s
179
164
  // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
180
165
  // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
181
166
  // since the editor's own schema enables them, and renderers meet them in stored documents.
182
- // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
183
167
  var validate = (0, _validator.validator)(nodes, marks, {
184
168
  allowPrivateAttributes: true,
185
169
  stage0: adfStage !== _ADFStages.ADFStages.FINAL
@@ -37,4 +37,5 @@ export let LINK_RESOURCE = /*#__PURE__*/function (LINK_RESOURCE) {
37
37
  LINK_RESOURCE["TWITTER"] = "twitterTweet";
38
38
  LINK_RESOURCE["OTHER"] = "other";
39
39
  return LINK_RESOURCE;
40
- }({});
40
+ }({});
41
+ export const TEMPLATE_GALLERY_INPUT_SOURCE = 'templateGallery';
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "123.4.2";
16
+ const packageVersion = "123.5.1";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "123.4.2";
17
+ const packageVersion = "123.5.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -40,6 +40,7 @@ export default function MentionWithProfileCard({
40
40
  onMouseEnter,
41
41
  onMouseLeave,
42
42
  renderAvatarSlot,
43
+ isRovoChat,
43
44
  localId,
44
45
  ssrPlaceholderId,
45
46
  userType
@@ -63,6 +64,7 @@ export default function MentionWithProfileCard({
63
64
  onMouseEnter: onMouseEnter,
64
65
  onMouseLeave: onMouseLeave,
65
66
  renderAvatarSlot: renderAvatarSlot,
67
+ isRovoChat: isRovoChat,
66
68
  ssrPlaceholderId: ssrPlaceholderId
67
69
  });
68
70
 
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
3
3
  import ResourcedMention from '@atlaskit/mention/resourced-mention';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import ResourcedMentionWithProfilecard from './mention-with-profilecard';
5
6
  const GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
6
7
  const useMentionNodeData = ({
@@ -54,6 +55,7 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
54
55
  userType
55
56
  }) => {
56
57
  const [profilecardProvider, setProfilecardProvider] = useState(null);
58
+ const [isRovoChat, setIsRovoChat] = useState(isExperimentEnabled('platform_editor_mention_rovo') && Boolean(mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat));
57
59
  const mountedRef = useRef(true);
58
60
  useLayoutEffect(() => {
59
61
  mountedRef.current = true;
@@ -76,6 +78,35 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
76
78
  }
77
79
  });
78
80
  }, [profilecardProviderResolver]);
81
+ useEffect(() => {
82
+ if (mentionNodeData !== null && mentionNodeData !== void 0 && mentionNodeData.isRovoChat) {
83
+ setIsRovoChat(isExperimentEnabled('platform_editor_mention_rovo'));
84
+ return;
85
+ }
86
+ if (!isExperimentEnabled('platform_editor_mention_rovo') || !mentionProvider) {
87
+ setIsRovoChat(false);
88
+ return;
89
+ }
90
+ let isActive = true;
91
+ const resolveRovoChatIdentity = async () => {
92
+ try {
93
+ var _provider$getRovoChat;
94
+ const provider = await mentionProvider;
95
+ const identityAccountId = await ((_provider$getRovoChat = provider.getRovoChatAgentIdentityAccountId) === null || _provider$getRovoChat === void 0 ? void 0 : _provider$getRovoChat.call(provider));
96
+ if (isActive) {
97
+ setIsRovoChat(identityAccountId !== undefined && identityAccountId === id);
98
+ }
99
+ } catch {
100
+ if (isActive) {
101
+ setIsRovoChat(false);
102
+ }
103
+ }
104
+ };
105
+ void resolveRovoChatIdentity();
106
+ return () => {
107
+ isActive = false;
108
+ };
109
+ }, [id, mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat, mentionProvider]);
79
110
  const MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
80
111
  const ssrPlaceholderId = `mention-${id}`;
81
112
 
@@ -97,7 +128,8 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
97
128
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
98
129
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
99
130
  renderAvatarSlot: renderAvatarSlot,
100
- ssrPlaceholderId: ssrPlaceholderId
131
+ ssrPlaceholderId: ssrPlaceholderId,
132
+ isRovoChat: isRovoChat
101
133
  });
102
134
  }
103
135
  return /*#__PURE__*/React.createElement(MentionComponent, {
@@ -118,7 +150,8 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
118
150
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
119
151
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
120
152
  renderAvatarSlot: renderAvatarSlot,
121
- ssrPlaceholderId: ssrPlaceholderId
153
+ ssrPlaceholderId: ssrPlaceholderId,
154
+ isRovoChat: isRovoChat
122
155
  });
123
156
  });
124
157
  export const MentionWithAvatarProviders = /*#__PURE__*/React.memo(({
@@ -1,5 +1,4 @@
1
1
  import { validator } from '@atlaskit/adf-utils/validator';
2
- import { fg } from '@atlaskit/platform-feature-flags/fg';
3
2
  import { ACTION_SUBJECT_ID } from '../analytics';
4
3
  export const UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
5
4
  import { ADFStages } from './ADFStages';
@@ -79,20 +78,6 @@ export const validationErrorHandler = (entity, error, options, marks, validate,
79
78
  }
80
79
  }
81
80
 
82
- // panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
83
- // plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
84
- // `table` inside `panel`, so suppress the INVALID_CONTENT error when the experiment is active.
85
- // This suppression is blunt, allowing a table in every panel, and applies only while
86
- // `platform_editor_adf_validator_stage0` is off. With that gate on, adf-utils offers the stage-0
87
- // `panel_c1` variants and accepts table-in-panel positionally instead, in `doc`, a layout column
88
- // and a synced block only.
89
- if (options.allowTableInPanel && !fg('platform_editor_adf_validator_stage0')) {
90
- const meta = error.meta;
91
- if ((meta === null || meta === void 0 ? void 0 : meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
92
- return entity;
93
- }
94
- }
95
-
96
81
  // panel_c1 is a ProseMirror-only variant: on save, expand-in-panel documents are stored as
97
82
  // plain ADF `panel` nodes containing an `expand`. The base validator-spec does not permit
98
83
  // `expand` inside `panel` (it's gated behind the consolidated container-in-panel experiment,
@@ -160,7 +145,6 @@ export const validateADFEntity = (schema, node, dispatchAnalyticsEvent, validati
160
145
  // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
161
146
  // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
162
147
  // since the editor's own schema enables them, and renderers meet them in stored documents.
163
- // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
164
148
  const validate = validator(nodes, marks, {
165
149
  allowPrivateAttributes: true,
166
150
  stage0: adfStage !== ADFStages.FINAL
@@ -37,4 +37,5 @@ export var LINK_RESOURCE = /*#__PURE__*/function (LINK_RESOURCE) {
37
37
  LINK_RESOURCE["TWITTER"] = "twitterTweet";
38
38
  LINK_RESOURCE["OTHER"] = "other";
39
39
  return LINK_RESOURCE;
40
- }({});
40
+ }({});
41
+ export var TEMPLATE_GALLERY_INPUT_SOURCE = 'templateGallery';
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "123.4.2";
22
+ var packageVersion = "123.5.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "123.4.2";
24
+ var packageVersion = "123.5.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -46,6 +46,7 @@ export default function MentionWithProfileCard(_ref) {
46
46
  onMouseEnter = _ref.onMouseEnter,
47
47
  onMouseLeave = _ref.onMouseLeave,
48
48
  renderAvatarSlot = _ref.renderAvatarSlot,
49
+ isRovoChat = _ref.isRovoChat,
49
50
  localId = _ref.localId,
50
51
  ssrPlaceholderId = _ref.ssrPlaceholderId,
51
52
  userType = _ref.userType;
@@ -68,6 +69,7 @@ export default function MentionWithProfileCard(_ref) {
68
69
  onMouseEnter: onMouseEnter,
69
70
  onMouseLeave: onMouseLeave,
70
71
  renderAvatarSlot: renderAvatarSlot,
72
+ isRovoChat: isRovoChat,
71
73
  ssrPlaceholderId: ssrPlaceholderId
72
74
  });
73
75
 
@@ -1,9 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  var _excluded = ["id", "mentionNodeDataProvider", "userType"];
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
7
  import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
6
8
  import ResourcedMention from '@atlaskit/mention/resourced-mention';
9
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
10
  import ResourcedMentionWithProfilecard from './mention-with-profilecard';
8
11
  var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
9
12
  var useMentionNodeData = function useMentionNodeData(_ref) {
@@ -68,6 +71,10 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref2) {
68
71
  _useState4 = _slicedToArray(_useState3, 2),
69
72
  profilecardProvider = _useState4[0],
70
73
  setProfilecardProvider = _useState4[1];
74
+ var _useState5 = useState(isExperimentEnabled('platform_editor_mention_rovo') && Boolean(mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat)),
75
+ _useState6 = _slicedToArray(_useState5, 2),
76
+ isRovoChat = _useState6[0],
77
+ setIsRovoChat = _useState6[1];
71
78
  var mountedRef = useRef(true);
72
79
  useLayoutEffect(function () {
73
80
  mountedRef.current = true;
@@ -90,6 +97,57 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref2) {
90
97
  }
91
98
  });
92
99
  }, [profilecardProviderResolver]);
100
+ useEffect(function () {
101
+ if (mentionNodeData !== null && mentionNodeData !== void 0 && mentionNodeData.isRovoChat) {
102
+ setIsRovoChat(isExperimentEnabled('platform_editor_mention_rovo'));
103
+ return;
104
+ }
105
+ if (!isExperimentEnabled('platform_editor_mention_rovo') || !mentionProvider) {
106
+ setIsRovoChat(false);
107
+ return;
108
+ }
109
+ var isActive = true;
110
+ var resolveRovoChatIdentity = /*#__PURE__*/function () {
111
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
+ var _provider$getRovoChat, provider, identityAccountId, _t;
113
+ return _regeneratorRuntime.wrap(function (_context) {
114
+ while (1) switch (_context.prev = _context.next) {
115
+ case 0:
116
+ _context.prev = 0;
117
+ _context.next = 1;
118
+ return mentionProvider;
119
+ case 1:
120
+ provider = _context.sent;
121
+ _context.next = 2;
122
+ return (_provider$getRovoChat = provider.getRovoChatAgentIdentityAccountId) === null || _provider$getRovoChat === void 0 ? void 0 : _provider$getRovoChat.call(provider);
123
+ case 2:
124
+ identityAccountId = _context.sent;
125
+ if (isActive) {
126
+ setIsRovoChat(identityAccountId !== undefined && identityAccountId === id);
127
+ }
128
+ _context.next = 4;
129
+ break;
130
+ case 3:
131
+ _context.prev = 3;
132
+ _t = _context["catch"](0);
133
+ if (isActive) {
134
+ setIsRovoChat(false);
135
+ }
136
+ case 4:
137
+ case "end":
138
+ return _context.stop();
139
+ }
140
+ }, _callee, null, [[0, 3]]);
141
+ }));
142
+ return function resolveRovoChatIdentity() {
143
+ return _ref3.apply(this, arguments);
144
+ };
145
+ }();
146
+ void resolveRovoChatIdentity();
147
+ return function () {
148
+ isActive = false;
149
+ };
150
+ }, [id, mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isRovoChat, mentionProvider]);
93
151
  var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
94
152
  var ssrPlaceholderId = "mention-".concat(id);
95
153
 
@@ -111,7 +169,8 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref2) {
111
169
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
112
170
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
113
171
  renderAvatarSlot: renderAvatarSlot,
114
- ssrPlaceholderId: ssrPlaceholderId
172
+ ssrPlaceholderId: ssrPlaceholderId,
173
+ isRovoChat: isRovoChat
115
174
  });
116
175
  }
117
176
  return /*#__PURE__*/React.createElement(MentionComponent, {
@@ -132,14 +191,15 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref2) {
132
191
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
133
192
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
134
193
  renderAvatarSlot: renderAvatarSlot,
135
- ssrPlaceholderId: ssrPlaceholderId
194
+ ssrPlaceholderId: ssrPlaceholderId,
195
+ isRovoChat: isRovoChat
136
196
  });
137
197
  });
138
- export var MentionWithAvatarProviders = /*#__PURE__*/React.memo(function (_ref3) {
139
- var id = _ref3.id,
140
- mentionNodeDataProvider = _ref3.mentionNodeDataProvider,
141
- userType = _ref3.userType,
142
- props = _objectWithoutProperties(_ref3, _excluded);
198
+ export var MentionWithAvatarProviders = /*#__PURE__*/React.memo(function (_ref4) {
199
+ var id = _ref4.id,
200
+ mentionNodeDataProvider = _ref4.mentionNodeDataProvider,
201
+ userType = _ref4.userType,
202
+ props = _objectWithoutProperties(_ref4, _excluded);
143
203
  var mentionNodeData = useMentionNodeData({
144
204
  id: id,
145
205
  mentionNodeDataProvider: mentionNodeDataProvider,
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { validator } from '@atlaskit/adf-utils/validator';
5
- import { fg } from '@atlaskit/platform-feature-flags/fg';
6
5
  import { ACTION_SUBJECT_ID } from '../analytics';
7
6
  export var UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
8
7
  import { ADFStages } from './ADFStages';
@@ -81,28 +80,14 @@ export var validationErrorHandler = function validationErrorHandler(entity, erro
81
80
  }
82
81
  }
83
82
 
84
- // panel_c1 is a ProseMirror-only variant: on save, table-in-panel documents are stored as
85
- // plain ADF `panel` nodes containing a `table`. The base validator-spec does not permit
86
- // `table` inside `panel`, so suppress the INVALID_CONTENT error when the experiment is active.
87
- // This suppression is blunt, allowing a table in every panel, and applies only while
88
- // `platform_editor_adf_validator_stage0` is off. With that gate on, adf-utils offers the stage-0
89
- // `panel_c1` variants and accepts table-in-panel positionally instead, in `doc`, a layout column
90
- // and a synced block only.
91
- if (options.allowTableInPanel && !fg('platform_editor_adf_validator_stage0')) {
92
- var _meta = error.meta;
93
- if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'table') {
94
- return entity;
95
- }
96
- }
97
-
98
83
  // panel_c1 is a ProseMirror-only variant: on save, expand-in-panel documents are stored as
99
84
  // plain ADF `panel` nodes containing an `expand`. The base validator-spec does not permit
100
85
  // `expand` inside `panel` (it's gated behind the consolidated container-in-panel experiment,
101
86
  // see `isPanelNestingContainerSupported`), so we suppress the INVALID_CONTENT error when
102
87
  // `allowContainerInPanel` is set.
103
88
  if (options.allowContainerInPanel) {
104
- var _meta2 = error.meta;
105
- if ((_meta2 === null || _meta2 === void 0 ? void 0 : _meta2.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'expand') {
89
+ var _meta = error.meta;
90
+ if ((_meta === null || _meta === void 0 ? void 0 : _meta.parentType) === 'panel' && error.code === 'INVALID_CONTENT' && entity.type === 'expand') {
106
91
  return entity;
107
92
  }
108
93
  }
@@ -166,7 +151,6 @@ export var validateADFEntity = function validateADFEntity(schema, node, dispatch
166
151
  // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
167
152
  // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
168
153
  // since the editor's own schema enables them, and renderers meet them in stored documents.
169
- // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
170
154
  var validate = validator(nodes, marks, {
171
155
  allowPrivateAttributes: true,
172
156
  stage0: adfStage !== ADFStages.FINAL
@@ -164,7 +164,8 @@ type InsertReferenceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.SYNCED_BLOC
164
164
  export type InsertSourceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK, {
165
165
  resourceId: string;
166
166
  }, undefined>;
167
- export type InsertSnippetInputMethod = INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
167
+ export declare const TEMPLATE_GALLERY_INPUT_SOURCE: 'templateGallery';
168
+ export type InsertSnippetInputMethod = INPUT_METHOD.ELEMENT_BROWSER | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | typeof TEMPLATE_GALLERY_INPUT_SOURCE;
168
169
  type InsertSnippetAEP = InsertAEP<ACTION_SUBJECT_ID.SNIPPET, {
169
170
  hadMedia?: boolean;
170
171
  inputMethod: InsertSnippetInputMethod;
@@ -172,7 +173,7 @@ type InsertSnippetAEP = InsertAEP<ACTION_SUBJECT_ID.SNIPPET, {
172
173
  templateType?: 'atlassian' | 'user';
173
174
  }, undefined>;
174
175
  type FailedToInsertSnippetAEP = OperationalAEP<ACTION.FAILED_TO_INSERT, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.SNIPPET, {
175
- reason: 'emptyBody' | 'parseError';
176
+ reason: 'emptyBody' | 'insertError' | 'parseError';
176
177
  snippetId: string;
177
178
  templateType?: 'atlassian' | 'user';
178
179
  } | {
@@ -17,6 +17,7 @@ export interface Props {
17
17
  onMouseLeave?: MentionEventHandler;
18
18
  profilecardProvider: ProfilecardProvider;
19
19
  renderAvatarSlot?: boolean;
20
+ isRovoChat?: boolean;
20
21
  ssrPlaceholderId?: string;
21
22
  text: string;
22
23
  userType?: MentionUserType;
@@ -26,4 +27,4 @@ export interface Props {
26
27
  * 1. Agent mentions (`userType === 'APP'`, behind the `rovo_chat_mention_agents` experiment) open the Rovo agent profile card on click.
27
28
  * 2. Otherwise renders the person profile card (either via the provider's `renderUserMentionCard`/link fallback or the default user `ProfileCardTrigger`).
28
29
  */
29
- export default function MentionWithProfileCard({ autoFocus, id, text, accessLevel, appType, avatarUrl, isAvatarImagePreShaped, mentionProvider, profilecardProvider, onClick, onMouseEnter, onMouseLeave, renderAvatarSlot, localId, ssrPlaceholderId, userType, }: Props): React.JSX.Element;
30
+ export default function MentionWithProfileCard({ autoFocus, id, text, accessLevel, appType, avatarUrl, isAvatarImagePreShaped, mentionProvider, profilecardProvider, onClick, onMouseEnter, onMouseLeave, renderAvatarSlot, isRovoChat, localId, ssrPlaceholderId, userType, }: Props): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "123.5.0",
3
+ "version": "123.6.0",
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/"
@@ -162,10 +162,6 @@
162
162
  "platform_editor_hide_configure_lozenge_non_configurable": {
163
163
  "type": "boolean"
164
164
  },
165
- "platform_editor_adf_validator_stage0": {
166
- "type": "boolean",
167
- "referenceOnly": true
168
- },
169
165
  "rovo_skill_tag_label_wrapping": {
170
166
  "type": "boolean",
171
167
  "referenceOnly": true