@atlaskit/editor-plugin-mentions 32.1.1 → 32.1.2

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,15 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 32.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f26f633c25699`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f26f633c25699) -
8
+ Move Rovo chat mention visuals and their supporting identity resolution, SSR cache reads and Chat
9
+ handoff metadata under platform_editor_mention_rovo_special_visual. Keep Rovo mention availability
10
+ and task routing under platform_editor_mention_rovo.
11
+ - Updated dependencies
12
+
3
13
  ## 32.1.1
4
14
 
5
15
  ### Patch Changes
@@ -62,9 +62,10 @@ var isAgentMentionUserType = function isAgentMentionUserType(userType) {
62
62
  return userType === 'APP' || userType === 'AGENT';
63
63
  };
64
64
 
65
- // In SSR `HTMLElement` is not defined, so we need to use duck typing here, follow the same pattern used from the emoji and layout plugins.
65
+ // SSR replaces HTMLElement without changing DOM prototypes. Preserve existing mention avatars
66
+ // under the original rollout, and support Rovo colors when their rollout is enabled independently.
66
67
  var isHTMLElement = function isHTMLElement(node) {
67
- return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') && (0, _isSsr.isSSR)() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
68
+ return ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual')) && (0, _isSsr.isSSR)() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
68
69
  };
69
70
 
70
71
  /**
@@ -235,14 +236,14 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
235
236
  }
236
237
  var _ref2 = (_api$mention$sharedSt = api === null || api === void 0 ? void 0 : api.mention.sharedState.currentState()) !== null && _api$mention$sharedSt !== void 0 ? _api$mention$sharedSt : {},
237
238
  mentionProvider = _ref2.mentionProvider;
238
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo')) {
239
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual')) {
239
240
  void this.resolveRovoChatIdentity(mentionProvider);
240
241
  }
241
242
  this.updateState(mentionProvider);
242
243
  this.subscribeToProviderDisabledStateChanges(mentionProvider);
243
244
  this.cleanup = api === null || api === void 0 ? void 0 : api.mention.sharedState.onChange(function (_ref3) {
244
245
  var nextSharedState = _ref3.nextSharedState;
245
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo')) {
246
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual')) {
246
247
  void _this.resolveRovoChatIdentity(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
247
248
  }
248
249
  _this.updateState(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
@@ -303,7 +304,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
303
304
  key: "isRovoChatFromCache",
304
305
  value: function isRovoChatFromCache() {
305
306
  var _this$config$options;
306
- return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.mentionNodeDataProvider) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.getMentionDataFromCache({
307
+ return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.mentionNodeDataProvider) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.getMentionDataFromCache({
307
308
  id: this.node.attrs.id,
308
309
  userType: this.node.attrs.userType
309
310
  })) === null || _this$config$options === void 0 ? void 0 : _this$config$options.isRovoChat) === true;
@@ -331,7 +332,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
331
332
  return _context2.abrupt("return");
332
333
  case 2:
333
334
  this.lastMentionProviderForRovoIdentity = mentionProvider;
334
- if (!(!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId))) {
335
+ if (!(!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId))) {
335
336
  _context2.next = 3;
336
337
  break;
337
338
  }
@@ -355,7 +356,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
355
356
  }
356
357
  return _context2.abrupt("return");
357
358
  case 7:
358
- if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo')) {
359
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual')) {
359
360
  _context2.next = 8;
360
361
  break;
361
362
  }
@@ -416,7 +417,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
416
417
  primitive.style.setProperty('color', inverseText);
417
418
  (_this$mentionTextElem2 = this.mentionTextElement) === null || _this$mentionTextElem2 === void 0 || _this$mentionTextElem2.style.setProperty('color', inverseText);
418
419
  // SSR needs the styles above; mouse listeners are attached only on the client.
419
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo') && (0, _isSsr.isSSR)()) {
420
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_rovo_special_visual') && (0, _isSsr.isSSR)()) {
420
421
  return;
421
422
  }
422
423
  var onMouseEnter = function onMouseEnter() {
@@ -45,7 +45,7 @@ var ACTIONS = exports.ACTIONS = {
45
45
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
46
46
  };
47
47
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
48
- var PACKAGE_VERSION = "32.1.0";
48
+ var PACKAGE_VERSION = "32.1.1";
49
49
  var setProvider = function setProvider(provider) {
50
50
  return function (state, dispatch) {
51
51
  if (dispatch) {
@@ -43,8 +43,9 @@ const isMentionTextAnAaid = text => AAID_MENTION_TEXT_PATTERN.test(text);
43
43
  const isAgentMentionsExperimentEnabled = () => expVal('platform_editor_agent_mentions', 'isEnabled', false);
44
44
  const isAgentMentionUserType = userType => userType === 'APP' || userType === 'AGENT';
45
45
 
46
- // In SSR `HTMLElement` is not defined, so we need to use duck typing here, follow the same pattern used from the emoji and layout plugins.
47
- const isHTMLElement = node => isExperimentEnabled('platform_editor_mention_rovo') && isSSR() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
46
+ // SSR replaces HTMLElement without changing DOM prototypes. Preserve existing mention avatars
47
+ // under the original rollout, and support Rovo colors when their rollout is enabled independently.
48
+ const isHTMLElement = node => (isExperimentEnabled('platform_editor_mention_rovo') || isExperimentEnabled('platform_editor_mention_rovo_special_visual')) && isSSR() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
48
49
 
49
50
  /**
50
51
  * Returns true if the node is an APP/AGENT mention whose stored text is a raw
@@ -194,7 +195,7 @@ export class MentionNodeView {
194
195
  const {
195
196
  mentionProvider
196
197
  } = (_api$mention$sharedSt = api === null || api === void 0 ? void 0 : api.mention.sharedState.currentState()) !== null && _api$mention$sharedSt !== void 0 ? _api$mention$sharedSt : {};
197
- if (isExperimentEnabled('platform_editor_mention_rovo')) {
198
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
198
199
  void this.resolveRovoChatIdentity(mentionProvider);
199
200
  }
200
201
  this.updateState(mentionProvider);
@@ -202,7 +203,7 @@ export class MentionNodeView {
202
203
  this.cleanup = api === null || api === void 0 ? void 0 : api.mention.sharedState.onChange(({
203
204
  nextSharedState
204
205
  }) => {
205
- if (isExperimentEnabled('platform_editor_mention_rovo')) {
206
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
206
207
  void this.resolveRovoChatIdentity(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
207
208
  }
208
209
  this.updateState(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
@@ -260,7 +261,7 @@ export class MentionNodeView {
260
261
  }
261
262
  isRovoChatFromCache() {
262
263
  var _this$config$options, _this$config$options$, _this$config$options$2;
263
- return isExperimentEnabled('platform_editor_mention_rovo') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 ? void 0 : (_this$config$options$ = _this$config$options.mentionNodeDataProvider) === null || _this$config$options$ === void 0 ? void 0 : (_this$config$options$2 = _this$config$options$.getMentionDataFromCache({
264
+ return isExperimentEnabled('platform_editor_mention_rovo_special_visual') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 ? void 0 : (_this$config$options$ = _this$config$options.mentionNodeDataProvider) === null || _this$config$options$ === void 0 ? void 0 : (_this$config$options$2 = _this$config$options$.getMentionDataFromCache({
264
265
  id: this.node.attrs.id,
265
266
  userType: this.node.attrs.userType
266
267
  })) === null || _this$config$options$2 === void 0 ? void 0 : _this$config$options$2.isRovoChat) === true;
@@ -276,7 +277,7 @@ export class MentionNodeView {
276
277
  return;
277
278
  }
278
279
  this.lastMentionProviderForRovoIdentity = mentionProvider;
279
- if (!isExperimentEnabled('platform_editor_mention_rovo') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId)) {
280
+ if (!isExperimentEnabled('platform_editor_mention_rovo_special_visual') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId)) {
280
281
  this.setRovoChatStyles(false);
281
282
  return;
282
283
  }
@@ -289,7 +290,7 @@ export class MentionNodeView {
289
290
  if (this.isDestroyed || this.lastMentionProviderForRovoIdentity !== mentionProvider) {
290
291
  return;
291
292
  }
292
- if (isExperimentEnabled('platform_editor_mention_rovo')) {
293
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
293
294
  // Recheck after awaiting: newer cached identity must take precedence over this lookup's result.
294
295
  this.setRovoChatStyles(this.isRovoChatFromCache() || identityAccountId !== undefined && identityAccountId === this.node.attrs.id);
295
296
  return;
@@ -332,7 +333,7 @@ export class MentionNodeView {
332
333
  primitive.style.setProperty('color', inverseText);
333
334
  (_this$mentionTextElem2 = this.mentionTextElement) === null || _this$mentionTextElem2 === void 0 ? void 0 : _this$mentionTextElem2.style.setProperty('color', inverseText);
334
335
  // SSR needs the styles above; mouse listeners are attached only on the client.
335
- if (isExperimentEnabled('platform_editor_mention_rovo') && isSSR()) {
336
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual') && isSSR()) {
336
337
  return;
337
338
  }
338
339
  const onMouseEnter = () => setBackground(hoveredBackground);
@@ -34,7 +34,7 @@ export const ACTIONS = {
34
34
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
35
35
  };
36
36
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
37
- const PACKAGE_VERSION = "32.1.0";
37
+ const PACKAGE_VERSION = "32.1.1";
38
38
  const setProvider = provider => (state, dispatch) => {
39
39
  if (dispatch) {
40
40
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -57,9 +57,10 @@ var isAgentMentionUserType = function isAgentMentionUserType(userType) {
57
57
  return userType === 'APP' || userType === 'AGENT';
58
58
  };
59
59
 
60
- // In SSR `HTMLElement` is not defined, so we need to use duck typing here, follow the same pattern used from the emoji and layout plugins.
60
+ // SSR replaces HTMLElement without changing DOM prototypes. Preserve existing mention avatars
61
+ // under the original rollout, and support Rovo colors when their rollout is enabled independently.
61
62
  var isHTMLElement = function isHTMLElement(node) {
62
- return isExperimentEnabled('platform_editor_mention_rovo') && isSSR() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
63
+ return (isExperimentEnabled('platform_editor_mention_rovo') || isExperimentEnabled('platform_editor_mention_rovo_special_visual')) && isSSR() ? 'innerHTML' in node && 'style' in node && 'classList' in node : node instanceof HTMLElement;
63
64
  };
64
65
 
65
66
  /**
@@ -230,14 +231,14 @@ export var MentionNodeView = /*#__PURE__*/function () {
230
231
  }
231
232
  var _ref2 = (_api$mention$sharedSt = api === null || api === void 0 ? void 0 : api.mention.sharedState.currentState()) !== null && _api$mention$sharedSt !== void 0 ? _api$mention$sharedSt : {},
232
233
  mentionProvider = _ref2.mentionProvider;
233
- if (isExperimentEnabled('platform_editor_mention_rovo')) {
234
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
234
235
  void this.resolveRovoChatIdentity(mentionProvider);
235
236
  }
236
237
  this.updateState(mentionProvider);
237
238
  this.subscribeToProviderDisabledStateChanges(mentionProvider);
238
239
  this.cleanup = api === null || api === void 0 ? void 0 : api.mention.sharedState.onChange(function (_ref3) {
239
240
  var nextSharedState = _ref3.nextSharedState;
240
- if (isExperimentEnabled('platform_editor_mention_rovo')) {
241
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
241
242
  void _this.resolveRovoChatIdentity(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
242
243
  }
243
244
  _this.updateState(nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.mentionProvider);
@@ -298,7 +299,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
298
299
  key: "isRovoChatFromCache",
299
300
  value: function isRovoChatFromCache() {
300
301
  var _this$config$options;
301
- return isExperimentEnabled('platform_editor_mention_rovo') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.mentionNodeDataProvider) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.getMentionDataFromCache({
302
+ return isExperimentEnabled('platform_editor_mention_rovo_special_visual') && ((_this$config$options = this.config.options) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.mentionNodeDataProvider) === null || _this$config$options === void 0 || (_this$config$options = _this$config$options.getMentionDataFromCache({
302
303
  id: this.node.attrs.id,
303
304
  userType: this.node.attrs.userType
304
305
  })) === null || _this$config$options === void 0 ? void 0 : _this$config$options.isRovoChat) === true;
@@ -326,7 +327,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
326
327
  return _context2.abrupt("return");
327
328
  case 2:
328
329
  this.lastMentionProviderForRovoIdentity = mentionProvider;
329
- if (!(!isExperimentEnabled('platform_editor_mention_rovo') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId))) {
330
+ if (!(!isExperimentEnabled('platform_editor_mention_rovo_special_visual') || !(mentionProvider !== null && mentionProvider !== void 0 && mentionProvider.getRovoChatAgentIdentityAccountId))) {
330
331
  _context2.next = 3;
331
332
  break;
332
333
  }
@@ -350,7 +351,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
350
351
  }
351
352
  return _context2.abrupt("return");
352
353
  case 7:
353
- if (!isExperimentEnabled('platform_editor_mention_rovo')) {
354
+ if (!isExperimentEnabled('platform_editor_mention_rovo_special_visual')) {
354
355
  _context2.next = 8;
355
356
  break;
356
357
  }
@@ -411,7 +412,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
411
412
  primitive.style.setProperty('color', inverseText);
412
413
  (_this$mentionTextElem2 = this.mentionTextElement) === null || _this$mentionTextElem2 === void 0 || _this$mentionTextElem2.style.setProperty('color', inverseText);
413
414
  // SSR needs the styles above; mouse listeners are attached only on the client.
414
- if (isExperimentEnabled('platform_editor_mention_rovo') && isSSR()) {
415
+ if (isExperimentEnabled('platform_editor_mention_rovo_special_visual') && isSSR()) {
415
416
  return;
416
417
  }
417
418
  var onMouseEnter = function onMouseEnter() {
@@ -37,7 +37,7 @@ export var ACTIONS = {
37
37
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
38
38
  };
39
39
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
40
- var PACKAGE_VERSION = "32.1.0";
40
+ var PACKAGE_VERSION = "32.1.1";
41
41
  var setProvider = function setProvider(provider) {
42
42
  return function (state, dispatch) {
43
43
  if (dispatch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "32.1.1",
3
+ "version": "32.1.2",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -46,7 +46,7 @@
46
46
  "@atlaskit/section-message": "^10.2.0",
47
47
  "@atlaskit/teams-app-config": "^3.1.0",
48
48
  "@atlaskit/theme": "^28.2.0",
49
- "@atlaskit/tmp-editor-statsig": "^255.0.0",
49
+ "@atlaskit/tmp-editor-statsig": "^256.0.0",
50
50
  "@atlaskit/tokens": "^20.9.0",
51
51
  "@atlaskit/tooltip": "^24.4.0",
52
52
  "@atlaskit/user-picker": "^14.5.0",