@atlaskit/editor-plugin-mentions 32.0.12 → 32.1.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,19 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 32.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71401187eef88`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71401187eef88) -
8
+ Add a consumer-owned agent section lozenge for confluence_agentic_awareness_enabled.
9
+
10
+ Allow `platform_editor_agent_mentions_hide_labs_lozenge` to suppress both the default Labs lozenge
11
+ and any consumer-supplied lozenge.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 32.0.12
4
18
 
5
19
  ### Patch Changes
@@ -108,6 +108,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
108
108
  fireAnalyticsEvent(payload, channel);
109
109
  };
110
110
  var typeAhead = (0, _typeAhead.createTypeAheadConfig)({
111
+ agentSectionLozenge: options === null || options === void 0 ? void 0 : options.agentSectionLozenge,
111
112
  canOpenTypeAhead: options === null || options === void 0 ? void 0 : options.canOpenTypeAhead,
112
113
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
113
114
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
@@ -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.0.11";
48
+ var PACKAGE_VERSION = "32.0.12";
49
49
  var setProvider = function setProvider(provider) {
50
50
  return function (state, dispatch) {
51
51
  if (dispatch) {
@@ -399,7 +399,8 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
399
399
  };
400
400
  };
401
401
  var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
402
- var canOpenTypeAhead = _ref1.canOpenTypeAhead,
402
+ var agentSectionLozenge = _ref1.agentSectionLozenge,
403
+ canOpenTypeAhead = _ref1.canOpenTypeAhead,
403
404
  sanitizePrivateContent = _ref1.sanitizePrivateContent,
404
405
  mentionInsertDisplayName = _ref1.mentionInsertDisplayName,
405
406
  fireEvent = _ref1.fireEvent,
@@ -437,6 +438,20 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
437
438
  profilecardProvider: profilecardProvider
438
439
  })).call
439
440
  });
441
+ var getAgentSectionLozenge = function getAgentSectionLozenge(label) {
442
+ if ((0, _fg.fg)('platform_editor_agent_mentions_hide_labs_lozenge')) {
443
+ return null;
444
+ }
445
+ if (agentSectionLozenge !== undefined) {
446
+ return agentSectionLozenge;
447
+ }
448
+ if (!(0, _fg.fg)('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) {
449
+ return /*#__PURE__*/_react.default.createElement(_lozenge.default, {
450
+ appearance: "discovery"
451
+ }, label);
452
+ }
453
+ return null;
454
+ };
440
455
  var typeAhead = {
441
456
  canOpen: canOpenTypeAhead,
442
457
  id: _typeAhead.TypeAheadAvailableNodes.MENTION,
@@ -531,9 +546,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
531
546
  showWhenQueryPresent: false,
532
547
  showWhenOnlySection: true
533
548
  },
534
- lozenge: !(0, _fg.fg)('platform_editor_agent_mentions_hide_labs_lozenge') && (!(0, _fg.fg)('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) ? /*#__PURE__*/_react.default.createElement(_lozenge.default, {
535
- appearance: "discovery"
536
- }, intl.formatMessage(_mentions.mentionMessages.typeAheadSectionAgentsLabsLozengeLabel)) : null
549
+ lozenge: getAgentSectionLozenge(intl.formatMessage(_mentions.mentionMessages.typeAheadSectionAgentsLabsLozengeLabel))
537
550
  }];
538
551
  },
539
552
  onOpen: function onOpen() {
@@ -13,6 +13,8 @@ var _focusTrap = _interopRequireDefault(require("focus-trap"));
13
13
  * copied from useFocusManager in @atlaskit/popup
14
14
  */
15
15
 
16
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
17
+
16
18
  var useFocusTrap = exports.useFocusTrap = function useFocusTrap(_ref) {
17
19
  var targetRef = _ref.targetRef,
18
20
  _ref$enabled = _ref.enabled,
@@ -104,6 +104,7 @@ const mentionsPlugin = ({
104
104
  fireAnalyticsEvent(payload, channel);
105
105
  };
106
106
  const typeAhead = createTypeAheadConfig({
107
+ agentSectionLozenge: options === null || options === void 0 ? void 0 : options.agentSectionLozenge,
107
108
  canOpenTypeAhead: options === null || options === void 0 ? void 0 : options.canOpenTypeAhead,
108
109
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
109
110
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
@@ -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.0.11";
37
+ const PACKAGE_VERSION = "32.0.12";
38
38
  const setProvider = provider => (state, dispatch) => {
39
39
  if (dispatch) {
40
40
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -357,6 +357,7 @@ const makeTransformMentionsToTypeAheadItems = ({
357
357
  };
358
358
  };
359
359
  export const createTypeAheadConfig = ({
360
+ agentSectionLozenge,
360
361
  canOpenTypeAhead,
361
362
  sanitizePrivateContent,
362
363
  mentionInsertDisplayName,
@@ -390,6 +391,20 @@ export const createTypeAheadConfig = ({
390
391
  profilecardProvider
391
392
  })).call
392
393
  });
394
+ const getAgentSectionLozenge = label => {
395
+ if (fg('platform_editor_agent_mentions_hide_labs_lozenge')) {
396
+ return null;
397
+ }
398
+ if (agentSectionLozenge !== undefined) {
399
+ return agentSectionLozenge;
400
+ }
401
+ if (!fg('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) {
402
+ return /*#__PURE__*/React.createElement(Lozenge, {
403
+ appearance: "discovery"
404
+ }, label);
405
+ }
406
+ return null;
407
+ };
393
408
  const typeAhead = {
394
409
  canOpen: canOpenTypeAhead,
395
410
  id: TypeAheadAvailableNodes.MENTION,
@@ -488,9 +503,7 @@ export const createTypeAheadConfig = ({
488
503
  showWhenQueryPresent: false,
489
504
  showWhenOnlySection: true
490
505
  },
491
- lozenge: !fg('platform_editor_agent_mentions_hide_labs_lozenge') && (!fg('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) ? /*#__PURE__*/React.createElement(Lozenge, {
492
- appearance: "discovery"
493
- }, intl.formatMessage(mentionMessages.typeAheadSectionAgentsLabsLozengeLabel)) : null
506
+ lozenge: getAgentSectionLozenge(intl.formatMessage(mentionMessages.typeAheadSectionAgentsLabsLozengeLabel))
494
507
  }];
495
508
  },
496
509
  onOpen: () => {
@@ -4,6 +4,8 @@
4
4
  * copied from useFocusManager in @atlaskit/popup
5
5
  */
6
6
  import { useEffect } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
7
9
  import createFocusTrap from 'focus-trap';
8
10
  export const useFocusTrap = ({
9
11
  targetRef,
@@ -100,6 +100,7 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
100
100
  fireAnalyticsEvent(payload, channel);
101
101
  };
102
102
  var typeAhead = createTypeAheadConfig({
103
+ agentSectionLozenge: options === null || options === void 0 ? void 0 : options.agentSectionLozenge,
103
104
  canOpenTypeAhead: options === null || options === void 0 ? void 0 : options.canOpenTypeAhead,
104
105
  sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
105
106
  mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
@@ -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.0.11";
40
+ var PACKAGE_VERSION = "32.0.12";
41
41
  var setProvider = function setProvider(provider) {
42
42
  return function (state, dispatch) {
43
43
  if (dispatch) {
@@ -390,7 +390,8 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
390
390
  };
391
391
  };
392
392
  export var createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
393
- var canOpenTypeAhead = _ref1.canOpenTypeAhead,
393
+ var agentSectionLozenge = _ref1.agentSectionLozenge,
394
+ canOpenTypeAhead = _ref1.canOpenTypeAhead,
394
395
  sanitizePrivateContent = _ref1.sanitizePrivateContent,
395
396
  mentionInsertDisplayName = _ref1.mentionInsertDisplayName,
396
397
  fireEvent = _ref1.fireEvent,
@@ -428,6 +429,20 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
428
429
  profilecardProvider: profilecardProvider
429
430
  })).call
430
431
  });
432
+ var getAgentSectionLozenge = function getAgentSectionLozenge(label) {
433
+ if (fg('platform_editor_agent_mentions_hide_labs_lozenge')) {
434
+ return null;
435
+ }
436
+ if (agentSectionLozenge !== undefined) {
437
+ return agentSectionLozenge;
438
+ }
439
+ if (!fg('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) {
440
+ return /*#__PURE__*/React.createElement(Lozenge, {
441
+ appearance: "discovery"
442
+ }, label);
443
+ }
444
+ return null;
445
+ };
431
446
  var typeAhead = {
432
447
  canOpen: canOpenTypeAhead,
433
448
  id: TypeAheadAvailableNodes.MENTION,
@@ -522,9 +537,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref1) {
522
537
  showWhenQueryPresent: false,
523
538
  showWhenOnlySection: true
524
539
  },
525
- lozenge: !fg('platform_editor_agent_mentions_hide_labs_lozenge') && (!fg('platform_editor_agent_mentions_drop_one_fixes') || showAgentMentionsLabsLozenge) ? /*#__PURE__*/React.createElement(Lozenge, {
526
- appearance: "discovery"
527
- }, intl.formatMessage(mentionMessages.typeAheadSectionAgentsLabsLozengeLabel)) : null
540
+ lozenge: getAgentSectionLozenge(intl.formatMessage(mentionMessages.typeAheadSectionAgentsLabsLozengeLabel))
528
541
  }];
529
542
  },
530
543
  onOpen: function onOpen() {
@@ -4,6 +4,8 @@
4
4
  * copied from useFocusManager in @atlaskit/popup
5
5
  */
6
6
  import { useEffect } from 'react';
7
+
8
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
7
9
  import createFocusTrap from 'focus-trap';
8
10
  export var useFocusTrap = function useFocusTrap(_ref) {
9
11
  var targetRef = _ref.targetRef,
@@ -28,6 +28,8 @@ export type MentionChange = {
28
28
  };
29
29
  export type MentionsChangedHandler = (changes: MentionChange[]) => void;
30
30
  export interface MentionsPluginOptions extends MentionPluginConfig {
31
+ /** Undefined preserves the legacy Labs policy; null hides the badge. The Platform hide gate overrides all values. */
32
+ agentSectionLozenge?: React.ReactNode;
31
33
  allowZeroWidthSpaceAfter?: boolean;
32
34
  /**
33
35
  * Optional predicate evaluated before opening the @mention typeahead. When
@@ -14,6 +14,7 @@ export declare function memoize<ResultFn extends (mention: MentionDescription) =
14
14
  clear(): void;
15
15
  };
16
16
  type Props = {
17
+ agentSectionLozenge?: React.ReactNode;
17
18
  api: ExtractInjectionAPI<MentionsPlugin> | undefined;
18
19
  canOpenTypeAhead?: () => boolean;
19
20
  enableAgentSectioning?: boolean;
@@ -25,5 +26,5 @@ type Props = {
25
26
  sanitizePrivateContent?: boolean;
26
27
  showAgentMentionsLabsLozenge?: boolean;
27
28
  };
28
- export declare const createTypeAheadConfig: ({ canOpenTypeAhead, sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsChanged, enableAgentSectioning, showAgentMentionsLabsLozenge, profilecardProvider, }: Props) => TypeAheadHandler;
29
+ export declare const createTypeAheadConfig: ({ agentSectionLozenge, canOpenTypeAhead, sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsChanged, enableAgentSectioning, showAgentMentionsLabsLozenge, profilecardProvider, }: Props) => TypeAheadHandler;
29
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "32.0.12",
3
+ "version": "32.1.0",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,11 +42,11 @@
42
42
  "@atlaskit/popup": "^10.2.0",
43
43
  "@atlaskit/portal": "^7.1.0",
44
44
  "@atlaskit/primitives": "^22.6.0",
45
- "@atlaskit/profilecard": "^27.4.0",
45
+ "@atlaskit/profilecard": "^27.5.0",
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": "^253.0.0",
49
+ "@atlaskit/tmp-editor-statsig": "^254.0.0",
50
50
  "@atlaskit/tokens": "^20.9.0",
51
51
  "@atlaskit/tooltip": "^24.4.0",
52
52
  "@atlaskit/user-picker": "^14.5.0",
@@ -59,14 +59,14 @@
59
59
  "uuid": "^11.1.1"
60
60
  },
61
61
  "peerDependencies": {
62
- "@atlaskit/editor-common": "^134.6.0",
62
+ "@atlaskit/editor-common": "^134.7.0",
63
63
  "react": "^18.2.0 || ^19.2.0",
64
64
  "react-dom": "^18.2.0 || ^19.2.0",
65
65
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@atlaskit/button": "^25.7.0",
69
- "@atlaskit/editor-common": "^134.6.0",
69
+ "@atlaskit/editor-common": "^134.7.0",
70
70
  "@atlaskit/editor-core": "^242.0.0",
71
71
  "@atlassian/workbench": "workspace:*",
72
72
  "react": "^19.2.0",