@atlaskit/editor-plugin-mentions 27.0.0 → 27.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 27.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`62b2e4f1ae2e8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/62b2e4f1ae2e8) -
8
+ Cleanup `experiment` `platform_editor_reduced_agent_profile_cards`. Reduced agent profile cards
9
+ (forbidden-agent fallback, current-node mention text and selection handling) are now always
10
+ enabled.
11
+ - Updated dependencies
12
+
3
13
  ## 27.0.0
4
14
 
5
15
  ### Patch Changes
@@ -57,16 +57,15 @@ var profileCardRenderer = exports.profileCardRenderer = function profileCardRend
57
57
  cleanupSelection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.sharedState.onChange(function (_ref2) {
58
58
  var nextSharedState = _ref2.nextSharedState;
59
59
  var selection = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.selection;
60
- if (selection instanceof _state.NodeSelection ? (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? selection.node.sameMarkup(currentNode) : selection.node === node : false) {
60
+ if (selection instanceof _state.NodeSelection ? selection.node.sameMarkup(currentNode) : false) {
61
61
  return;
62
62
  }
63
63
  removeProfileCard === null || removeProfileCard === void 0 || removeProfileCard();
64
64
  });
65
65
  };
66
66
  var renderEditorProfileCard = function renderEditorProfileCard() {
67
- var isReducedProfileCards = (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false);
68
- var clickedNode = isReducedProfileCards ? currentNode : node;
69
- var activeMention = isReducedProfileCards ? function (_ref3, _currentNode, _currentNode2, _currentNode3) {
67
+ var clickedNode = currentNode;
68
+ var activeMention = function (_ref3, _currentNode, _currentNode2, _currentNode3) {
70
69
  // Avatar mentions keep their resolved display name in the nested text span.
71
70
  // Control mentions preserve the legacy attrs-first fallback.
72
71
  var mentionTextElement = dom instanceof HTMLElement ? dom.querySelector('.editor-mention-text') : undefined;
@@ -77,9 +76,7 @@ var profileCardRenderer = exports.profileCardRenderer = function profileCardRend
77
76
  text: mentionTextElement ? resolvedText || ((_currentNode2 = currentNode) === null || _currentNode2 === void 0 || (_currentNode2 = _currentNode2.attrs) === null || _currentNode2 === void 0 ? void 0 : _currentNode2.text) || undefined : ((_currentNode3 = currentNode) === null || _currentNode3 === void 0 || (_currentNode3 = _currentNode3.attrs) === null || _currentNode3 === void 0 ? void 0 : _currentNode3.text) || primitiveText || undefined
78
77
  })
79
78
  };
80
- }() : {
81
- attrs: node.attrs
82
- };
79
+ }();
83
80
 
84
81
  // Build agent mention context at click time by finding the parent block of this mention
85
82
  // in the live document.
@@ -164,19 +161,19 @@ var profileCardRenderer = exports.profileCardRenderer = function profileCardRend
164
161
  type: 'click',
165
162
  listener: function listener() {
166
163
  if ((0, _fg.fg)('people-teams_migrate-user-profile-card') || (0, _isExperimentEnabled.isExperimentEnabled)('pt_user_profile_card_migration_exp')) {
167
- var _currentNode$attrs, _node$attrs, _options$profilecardP;
168
- var userId = (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.id;
164
+ var _currentNode$attrs, _options$profilecardP;
165
+ var userId = (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id;
169
166
  if (!userId) {
170
167
  return;
171
168
  }
172
169
  navigatingToProfile = false;
173
170
  options === null || options === void 0 || (_options$profilecardP = options.profilecardProvider) === null || _options$profilecardP === void 0 || _options$profilecardP.then(function (provider) {
174
- var _currentNode$attrs2, _node$attrs2;
171
+ var _currentNode$attrs2;
175
172
  if (!(0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false)) {
176
173
  renderDefaultProfileCard(userId, provider);
177
174
  return;
178
175
  }
179
- if ((0, _ProfileCardComponent.isAgentMentionType)((0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.userType)) {
176
+ if ((0, _ProfileCardComponent.isAgentMentionType)((_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType)) {
180
177
  renderEditorProfileCard();
181
178
  } else {
182
179
  renderDefaultProfileCard(userId, provider);
@@ -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 = "26.0.5";
48
+ var PACKAGE_VERSION = "27.0.0";
49
49
  var setProvider = function setProvider(provider) {
50
50
  return function (state, dispatch) {
51
51
  if (dispatch) {
@@ -227,7 +227,7 @@ function ProfileCardComponent(_ref6) {
227
227
  accountId: id,
228
228
  provider: provider,
229
229
  hideActions: hideActions,
230
- text: (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
230
+ text: text,
231
231
  onChatClick: onAgentMentionChatClick && (0, _fg.fg)('platform_editor_agent_mentions_drop_one_fixes') ? function (event, agentStudioId) {
232
232
  // agentMentionContext is already captured in the onAgentMentionChatClick
233
233
  // closure built by profileCardRenderer at chip-click time via doc.descendants()
@@ -304,7 +304,7 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
304
304
  onChatClick: onChatClick
305
305
  });
306
306
  }
307
- return (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
307
+ return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
308
308
  accountId: accountId,
309
309
  cloudId: provider.cloudId,
310
310
  resourceClient: provider.resourceClient,
@@ -315,15 +315,5 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
315
315
  hideStarButton: hideActions,
316
316
  hideAiDisclaimer: hideActions,
317
317
  showCreatorNameWithoutLink: hideActions
318
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
319
- accountId: accountId,
320
- cloudId: provider.cloudId,
321
- resourceClient: provider.resourceClient,
322
- onChatClick: onChatClick,
323
- hideAgentActions: hideActions,
324
- hideConversationStarters: hideActions,
325
- hideStarButton: hideActions,
326
- hideAiDisclaimer: hideActions,
327
- showCreatorNameWithoutLink: hideActions
328
318
  });
329
319
  };
@@ -48,16 +48,15 @@ export const profileCardRenderer = ({
48
48
  nextSharedState
49
49
  }) => {
50
50
  const selection = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.selection;
51
- if (selection instanceof NodeSelection ? expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? selection.node.sameMarkup(currentNode) : selection.node === node : false) {
51
+ if (selection instanceof NodeSelection ? selection.node.sameMarkup(currentNode) : false) {
52
52
  return;
53
53
  }
54
54
  removeProfileCard === null || removeProfileCard === void 0 ? void 0 : removeProfileCard();
55
55
  });
56
56
  };
57
57
  const renderEditorProfileCard = () => {
58
- const isReducedProfileCards = expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false);
59
- const clickedNode = isReducedProfileCards ? currentNode : node;
60
- const activeMention = isReducedProfileCards ? ((_ref, _ref$textContent, _currentNode, _currentNode2, _currentNode2$attrs, _currentNode3, _currentNode3$attrs) => {
58
+ const clickedNode = currentNode;
59
+ const activeMention = ((_ref, _ref$textContent, _currentNode, _currentNode2, _currentNode2$attrs, _currentNode3, _currentNode3$attrs) => {
61
60
  // Avatar mentions keep their resolved display name in the nested text span.
62
61
  // Control mentions preserve the legacy attrs-first fallback.
63
62
  const mentionTextElement = dom instanceof HTMLElement ? dom.querySelector('.editor-mention-text') : undefined;
@@ -69,9 +68,7 @@ export const profileCardRenderer = ({
69
68
  text: mentionTextElement ? resolvedText || ((_currentNode2 = currentNode) === null || _currentNode2 === void 0 ? void 0 : (_currentNode2$attrs = _currentNode2.attrs) === null || _currentNode2$attrs === void 0 ? void 0 : _currentNode2$attrs.text) || undefined : ((_currentNode3 = currentNode) === null || _currentNode3 === void 0 ? void 0 : (_currentNode3$attrs = _currentNode3.attrs) === null || _currentNode3$attrs === void 0 ? void 0 : _currentNode3$attrs.text) || primitiveText || undefined
70
69
  }
71
70
  };
72
- })() : {
73
- attrs: node.attrs
74
- };
71
+ })();
75
72
 
76
73
  // Build agent mention context at click time by finding the parent block of this mention
77
74
  // in the live document.
@@ -154,19 +151,19 @@ export const profileCardRenderer = ({
154
151
  type: 'click',
155
152
  listener: () => {
156
153
  if (fg('people-teams_migrate-user-profile-card') || isExperimentEnabled('pt_user_profile_card_migration_exp')) {
157
- var _currentNode$attrs, _node$attrs, _options$profilecardP;
158
- const userId = expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.id;
154
+ var _currentNode$attrs, _options$profilecardP;
155
+ const userId = (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id;
159
156
  if (!userId) {
160
157
  return;
161
158
  }
162
159
  navigatingToProfile = false;
163
160
  options === null || options === void 0 ? void 0 : (_options$profilecardP = options.profilecardProvider) === null || _options$profilecardP === void 0 ? void 0 : _options$profilecardP.then(provider => {
164
- var _currentNode$attrs2, _node$attrs2;
161
+ var _currentNode$attrs2;
165
162
  if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
166
163
  renderDefaultProfileCard(userId, provider);
167
164
  return;
168
165
  }
169
- if (isAgentMentionType(expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.userType)) {
166
+ if (isAgentMentionType((_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType)) {
170
167
  renderEditorProfileCard();
171
168
  } else {
172
169
  renderDefaultProfileCard(userId, provider);
@@ -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 = "26.0.5";
37
+ const PACKAGE_VERSION = "27.0.0";
38
38
  const setProvider = provider => (state, dispatch) => {
39
39
  if (dispatch) {
40
40
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -151,7 +151,7 @@ export function ProfileCardComponent({
151
151
  accountId: id,
152
152
  provider: provider,
153
153
  hideActions: hideActions,
154
- text: expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
154
+ text: text,
155
155
  onChatClick: onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? (event, agentStudioId) => {
156
156
  // agentMentionContext is already captured in the onAgentMentionChatClick
157
157
  // closure built by profileCardRenderer at chip-click time via doc.descendants()
@@ -229,7 +229,7 @@ const AgentProfileCardContent = ({
229
229
  onChatClick
230
230
  });
231
231
  }
232
- return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
232
+ return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
233
233
  accountId: accountId,
234
234
  cloudId: provider.cloudId,
235
235
  resourceClient: provider.resourceClient,
@@ -240,15 +240,5 @@ const AgentProfileCardContent = ({
240
240
  hideStarButton: hideActions,
241
241
  hideAiDisclaimer: hideActions,
242
242
  showCreatorNameWithoutLink: hideActions
243
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
244
- accountId: accountId,
245
- cloudId: provider.cloudId,
246
- resourceClient: provider.resourceClient,
247
- onChatClick: onChatClick,
248
- hideAgentActions: hideActions,
249
- hideConversationStarters: hideActions,
250
- hideStarButton: hideActions,
251
- hideAiDisclaimer: hideActions,
252
- showCreatorNameWithoutLink: hideActions
253
243
  });
254
244
  };
@@ -51,16 +51,15 @@ export var profileCardRenderer = function profileCardRenderer(_ref) {
51
51
  cleanupSelection = api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.sharedState.onChange(function (_ref2) {
52
52
  var nextSharedState = _ref2.nextSharedState;
53
53
  var selection = nextSharedState === null || nextSharedState === void 0 ? void 0 : nextSharedState.selection;
54
- if (selection instanceof NodeSelection ? expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? selection.node.sameMarkup(currentNode) : selection.node === node : false) {
54
+ if (selection instanceof NodeSelection ? selection.node.sameMarkup(currentNode) : false) {
55
55
  return;
56
56
  }
57
57
  removeProfileCard === null || removeProfileCard === void 0 || removeProfileCard();
58
58
  });
59
59
  };
60
60
  var renderEditorProfileCard = function renderEditorProfileCard() {
61
- var isReducedProfileCards = expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false);
62
- var clickedNode = isReducedProfileCards ? currentNode : node;
63
- var activeMention = isReducedProfileCards ? function (_ref3, _currentNode, _currentNode2, _currentNode3) {
61
+ var clickedNode = currentNode;
62
+ var activeMention = function (_ref3, _currentNode, _currentNode2, _currentNode3) {
64
63
  // Avatar mentions keep their resolved display name in the nested text span.
65
64
  // Control mentions preserve the legacy attrs-first fallback.
66
65
  var mentionTextElement = dom instanceof HTMLElement ? dom.querySelector('.editor-mention-text') : undefined;
@@ -71,9 +70,7 @@ export var profileCardRenderer = function profileCardRenderer(_ref) {
71
70
  text: mentionTextElement ? resolvedText || ((_currentNode2 = currentNode) === null || _currentNode2 === void 0 || (_currentNode2 = _currentNode2.attrs) === null || _currentNode2 === void 0 ? void 0 : _currentNode2.text) || undefined : ((_currentNode3 = currentNode) === null || _currentNode3 === void 0 || (_currentNode3 = _currentNode3.attrs) === null || _currentNode3 === void 0 ? void 0 : _currentNode3.text) || primitiveText || undefined
72
71
  })
73
72
  };
74
- }() : {
75
- attrs: node.attrs
76
- };
73
+ }();
77
74
 
78
75
  // Build agent mention context at click time by finding the parent block of this mention
79
76
  // in the live document.
@@ -158,19 +155,19 @@ export var profileCardRenderer = function profileCardRenderer(_ref) {
158
155
  type: 'click',
159
156
  listener: function listener() {
160
157
  if (fg('people-teams_migrate-user-profile-card') || isExperimentEnabled('pt_user_profile_card_migration_exp')) {
161
- var _currentNode$attrs, _node$attrs, _options$profilecardP;
162
- var userId = expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.id;
158
+ var _currentNode$attrs, _options$profilecardP;
159
+ var userId = (_currentNode$attrs = currentNode.attrs) === null || _currentNode$attrs === void 0 ? void 0 : _currentNode$attrs.id;
163
160
  if (!userId) {
164
161
  return;
165
162
  }
166
163
  navigatingToProfile = false;
167
164
  options === null || options === void 0 || (_options$profilecardP = options.profilecardProvider) === null || _options$profilecardP === void 0 || _options$profilecardP.then(function (provider) {
168
- var _currentNode$attrs2, _node$attrs2;
165
+ var _currentNode$attrs2;
169
166
  if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
170
167
  renderDefaultProfileCard(userId, provider);
171
168
  return;
172
169
  }
173
- if (isAgentMentionType(expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? (_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.userType)) {
170
+ if (isAgentMentionType((_currentNode$attrs2 = currentNode.attrs) === null || _currentNode$attrs2 === void 0 ? void 0 : _currentNode$attrs2.userType)) {
174
171
  renderEditorProfileCard();
175
172
  } else {
176
173
  renderDefaultProfileCard(userId, provider);
@@ -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 = "26.0.5";
40
+ var PACKAGE_VERSION = "27.0.0";
41
41
  var setProvider = function setProvider(provider) {
42
42
  return function (state, dispatch) {
43
43
  if (dispatch) {
@@ -215,7 +215,7 @@ export function ProfileCardComponent(_ref6) {
215
215
  accountId: id,
216
216
  provider: provider,
217
217
  hideActions: hideActions,
218
- text: expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? text : undefined,
218
+ text: text,
219
219
  onChatClick: onAgentMentionChatClick && fg('platform_editor_agent_mentions_drop_one_fixes') ? function (event, agentStudioId) {
220
220
  // agentMentionContext is already captured in the onAgentMentionChatClick
221
221
  // closure built by profileCardRenderer at chip-click time via doc.descendants()
@@ -292,7 +292,7 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
292
292
  onChatClick: onChatClick
293
293
  });
294
294
  }
295
- return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
295
+ return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
296
296
  accountId: accountId,
297
297
  cloudId: provider.cloudId,
298
298
  resourceClient: provider.resourceClient,
@@ -303,15 +303,5 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
303
303
  hideStarButton: hideActions,
304
304
  hideAiDisclaimer: hideActions,
305
305
  showCreatorNameWithoutLink: hideActions
306
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
307
- accountId: accountId,
308
- cloudId: provider.cloudId,
309
- resourceClient: provider.resourceClient,
310
- onChatClick: onChatClick,
311
- hideAgentActions: hideActions,
312
- hideConversationStarters: hideActions,
313
- hideStarButton: hideActions,
314
- hideAiDisclaimer: hideActions,
315
- showCreatorNameWithoutLink: hideActions
316
306
  });
317
307
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "27.0.0",
3
+ "version": "27.0.1",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,7 +47,7 @@
47
47
  "@atlaskit/section-message": "^10.2.0",
48
48
  "@atlaskit/teams-app-config": "^3.1.0",
49
49
  "@atlaskit/theme": "^28.2.0",
50
- "@atlaskit/tmp-editor-statsig": "^224.0.0",
50
+ "@atlaskit/tmp-editor-statsig": "^225.0.0",
51
51
  "@atlaskit/tokens": "^20.3.0",
52
52
  "@atlaskit/tooltip": "^24.4.0",
53
53
  "@atlaskit/user-picker": "^14.1.0",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^11.1.1"
61
61
  },
62
62
  "peerDependencies": {
63
- "@atlaskit/editor-common": "^129.0.0",
63
+ "@atlaskit/editor-common": "^129.1.0",
64
64
  "react": "^18.2.0 || ^19.2.0",
65
65
  "react-dom": "^18.2.0 || ^19.2.0",
66
66
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"