@atlaskit/mention 23.5.0 → 23.7.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,24 @@
1
1
  # @atlaskit/mention
2
2
 
3
+ ## 23.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#99344](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99344)
8
+ [`fbeb84f180cd2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbeb84f180cd2) -
9
+ Added optional `isEligibleXProductUserInvite` and `inviteXProductUser` props which will be used in
10
+ CCEDITIONS-4746 (x-product-user-invite experiment). Project poster link -
11
+ https://hello.atlassian.net/wiki/spaces/CV1/pages/3685626022/Project+poster+-+Cross+Product+User+Search+Invites
12
+
13
+ ## 23.6.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#99487](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99487)
18
+ [`8c482c8d11e99`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8c482c8d11e99) -
19
+ [https://product-fabric.atlassian.net/browse/EDF-67](EDF-67) - remove
20
+ /api/mentions/CLOUD_ID/record endpoint call
21
+
3
22
  ## 23.5.0
4
23
 
5
24
  ### Minor Changes
@@ -38,6 +38,9 @@
38
38
  {
39
39
  "path": "../../../design-system/lozenge/afm-cc/tsconfig.json"
40
40
  },
41
+ {
42
+ "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
43
+ },
41
44
  {
42
45
  "path": "../../../design-system/primitives/afm-cc/tsconfig.json"
43
46
  },
@@ -38,6 +38,9 @@
38
38
  {
39
39
  "path": "../../../design-system/lozenge/afm-jira/tsconfig.json"
40
40
  },
41
+ {
42
+ "path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
43
+ },
41
44
  {
42
45
  "path": "../../../design-system/primitives/afm-jira/tsconfig.json"
43
46
  },
@@ -38,6 +38,9 @@
38
38
  {
39
39
  "path": "../../../design-system/lozenge/afm-post-office/tsconfig.json"
40
40
  },
41
+ {
42
+ "path": "../../../platform/feature-flags/afm-post-office/tsconfig.json"
43
+ },
41
44
  {
42
45
  "path": "../../../design-system/primitives/afm-post-office/tsconfig.json"
43
46
  },
@@ -14,6 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
14
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
15
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
16
16
  var _utilServiceSupport = require("@atlaskit/util-service-support");
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _types = require("../types");
18
19
  var _logger = _interopRequireDefault(require("../util/logger"));
19
20
  var _analytics = require("../util/analytics");
@@ -186,6 +187,8 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
186
187
  _this.productName = config.productName;
187
188
  _this.shouldEnableInvite = !!config.shouldEnableInvite;
188
189
  _this.onInviteItemClick = config.onInviteItemClick;
190
+ _this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
191
+ _this.inviteXProductUser = config.inviteXProductUser;
189
192
  _this.userRole = config.userRole || 'basic';
190
193
  if (_this.config.debounceTime) {
191
194
  _this.filter = (0, _debounce.default)(_this.filter, _this.config.debounceTime);
@@ -475,6 +478,12 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
475
478
  return _regenerator.default.wrap(function _callee4$(_context4) {
476
479
  while (1) switch (_context4.prev = _context4.next) {
477
480
  case 0:
481
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_ai_remove_mentions_record')) {
482
+ _context4.next = 2;
483
+ break;
484
+ }
485
+ return _context4.abrupt("return");
486
+ case 2:
478
487
  options = {
479
488
  path: 'record',
480
489
  queryParams: _objectSpread({
@@ -485,23 +494,23 @@ var MentionResource = exports.MentionResource = /*#__PURE__*/function (_Abstract
485
494
  }
486
495
  };
487
496
  sliName = (0, _types.isTeamMention)(mention) ? _types.SliNames.SELECT_TEAM : _types.SliNames.SELECT;
488
- _context4.prev = 2;
489
- _context4.next = 5;
497
+ _context4.prev = 4;
498
+ _context4.next = 7;
490
499
  return _utilServiceSupport.utils.requestService(this.config, options);
491
- case 5:
500
+ case 7:
492
501
  result = _context4.sent;
493
502
  this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, sliName, _types.Actions.SUCCEEDED);
494
503
  return _context4.abrupt("return", result);
495
- case 10:
496
- _context4.prev = 10;
497
- _context4.t0 = _context4["catch"](2);
504
+ case 12:
505
+ _context4.prev = 12;
506
+ _context4.t0 = _context4["catch"](4);
498
507
  this._notifyAnalyticsListeners(_analytics.SLI_EVENT_TYPE, sliName, _types.Actions.FAILED);
499
508
  throw _context4.t0;
500
- case 14:
509
+ case 16:
501
510
  case "end":
502
511
  return _context4.stop();
503
512
  }
504
- }, _callee4, this, [[2, 10]]);
513
+ }, _callee4, this, [[4, 12]]);
505
514
  }));
506
515
  function recordSelection(_x6, _x7) {
507
516
  return _recordSelection.apply(this, arguments);
@@ -12,7 +12,7 @@ var _types = require("../types");
12
12
  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; }
13
13
  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; }
14
14
  var packageName = "@atlaskit/mention";
15
- var packageVersion = "23.5.0";
15
+ var packageVersion = "23.7.0";
16
16
  var SLI_EVENT_TYPE = exports.SLI_EVENT_TYPE = 'sli';
17
17
  var SMART_EVENT_TYPE = exports.SMART_EVENT_TYPE = 'smart';
18
18
  var fireAnalyticsMentionTypeaheadEvent = exports.fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
@@ -1,4 +1,5 @@
1
1
  import { utils as serviceUtils } from '@atlaskit/util-service-support';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import { isAppMention, isTeamMention, MentionNameStatus, SliNames, Actions } from '../types';
3
4
  import debug from '../util/logger';
4
5
  const MAX_QUERY_ITEMS = 100;
@@ -136,6 +137,8 @@ export class MentionResource extends AbstractMentionResource {
136
137
  this.productName = config.productName;
137
138
  this.shouldEnableInvite = !!config.shouldEnableInvite;
138
139
  this.onInviteItemClick = config.onInviteItemClick;
140
+ this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
141
+ this.inviteXProductUser = config.inviteXProductUser;
139
142
  this.userRole = config.userRole || 'basic';
140
143
  if (this.config.debounceTime) {
141
144
  this.filter = debounce(this.filter, this.config.debounceTime);
@@ -316,6 +319,9 @@ export class MentionResource extends AbstractMentionResource {
316
319
  };
317
320
  }
318
321
  async recordSelection(mention, contextIdentifier) {
322
+ if (fg('platform_editor_ai_remove_mentions_record')) {
323
+ return;
324
+ }
319
325
  const options = {
320
326
  path: 'record',
321
327
  queryParams: {
@@ -2,7 +2,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
2
2
  import { ELEMENTS_CHANNEL } from '../_constants';
3
3
  import { ComponentNames, isSpecialMentionText } from '../types';
4
4
  const packageName = "@atlaskit/mention";
5
- const packageVersion = "23.5.0";
5
+ const packageVersion = "23.7.0";
6
6
  export const SLI_EVENT_TYPE = 'sli';
7
7
  export const SMART_EVENT_TYPE = 'smart';
8
8
  export const fireAnalyticsMentionTypeaheadEvent = props => (action, duration, userIds = [], query) => {
@@ -11,6 +11,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
12
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
13
  import { utils as serviceUtils } from '@atlaskit/util-service-support';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { isAppMention, isTeamMention, MentionNameStatus, SliNames, Actions } from '../types';
15
16
  import debug from '../util/logger';
16
17
  var MAX_QUERY_ITEMS = 100;
@@ -179,6 +180,8 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
179
180
  _this.productName = config.productName;
180
181
  _this.shouldEnableInvite = !!config.shouldEnableInvite;
181
182
  _this.onInviteItemClick = config.onInviteItemClick;
183
+ _this.isEligibleXProductUserInvite = config.isEligibleXProductUserInvite;
184
+ _this.inviteXProductUser = config.inviteXProductUser;
182
185
  _this.userRole = config.userRole || 'basic';
183
186
  if (_this.config.debounceTime) {
184
187
  _this.filter = debounce(_this.filter, _this.config.debounceTime);
@@ -468,6 +471,12 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
468
471
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
469
472
  while (1) switch (_context4.prev = _context4.next) {
470
473
  case 0:
474
+ if (!fg('platform_editor_ai_remove_mentions_record')) {
475
+ _context4.next = 2;
476
+ break;
477
+ }
478
+ return _context4.abrupt("return");
479
+ case 2:
471
480
  options = {
472
481
  path: 'record',
473
482
  queryParams: _objectSpread({
@@ -478,23 +487,23 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
478
487
  }
479
488
  };
480
489
  sliName = isTeamMention(mention) ? SliNames.SELECT_TEAM : SliNames.SELECT;
481
- _context4.prev = 2;
482
- _context4.next = 5;
490
+ _context4.prev = 4;
491
+ _context4.next = 7;
483
492
  return serviceUtils.requestService(this.config, options);
484
- case 5:
493
+ case 7:
485
494
  result = _context4.sent;
486
495
  this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.SUCCEEDED);
487
496
  return _context4.abrupt("return", result);
488
- case 10:
489
- _context4.prev = 10;
490
- _context4.t0 = _context4["catch"](2);
497
+ case 12:
498
+ _context4.prev = 12;
499
+ _context4.t0 = _context4["catch"](4);
491
500
  this._notifyAnalyticsListeners(SLI_EVENT_TYPE, sliName, Actions.FAILED);
492
501
  throw _context4.t0;
493
- case 14:
502
+ case 16:
494
503
  case "end":
495
504
  return _context4.stop();
496
505
  }
497
- }, _callee4, this, [[2, 10]]);
506
+ }, _callee4, this, [[4, 12]]);
498
507
  }));
499
508
  function recordSelection(_x6, _x7) {
500
509
  return _recordSelection.apply(this, arguments);
@@ -5,7 +5,7 @@ import { OPERATIONAL_EVENT_TYPE, UI_EVENT_TYPE } from '@atlaskit/analytics-gas-t
5
5
  import { ELEMENTS_CHANNEL } from '../_constants';
6
6
  import { ComponentNames, isSpecialMentionText } from '../types';
7
7
  var packageName = "@atlaskit/mention";
8
- var packageVersion = "23.5.0";
8
+ var packageVersion = "23.7.0";
9
9
  export var SLI_EVENT_TYPE = 'sli';
10
10
  export var SMART_EVENT_TYPE = 'smart';
11
11
  export var fireAnalyticsMentionTypeaheadEvent = function fireAnalyticsMentionTypeaheadEvent(props) {
@@ -1,9 +1,9 @@
1
1
  import { type MentionProvider, type MentionContextIdentifier, ErrorCallback, InfoCallback, ResultCallback } from './MentionResource';
2
- import { type MentionDescription, type InviteFromMentionProvider } from '../types';
2
+ import { type MentionDescription, type InviteFromMentionProvider, type XProductInviteMentionProvider } from '../types';
3
3
  export type { MentionDescription };
4
4
  export type MentionProviderFunctions = Omit<{
5
5
  [Key in keyof MentionProvider]: MentionProvider[Key] extends Function ? MentionProvider[Key] : never;
6
- }, keyof InviteFromMentionProvider>;
6
+ }, keyof InviteFromMentionProvider | keyof XProductInviteMentionProvider>;
7
7
  /**
8
8
  * This component is stateful and should be instantianted per contextIdentifiers.
9
9
  */
@@ -45,6 +45,8 @@ export declare class MentionResource extends AbstractMentionResource implements
45
45
  shouldEnableInvite: boolean;
46
46
  userRole: UserRole;
47
47
  onInviteItemClick?: (flow: InviteFlow) => void;
48
+ isEligibleXProductUserInvite?: boolean;
49
+ inviteXProductUser?: (userId: string) => Promise<void>;
48
50
  constructor(config: MentionResourceConfig);
49
51
  shouldHighlightMention(mention: MentionDescription): boolean;
50
52
  notify(searchTime: number, mentionResult: MentionsResult, query?: string): void;
@@ -32,6 +32,7 @@ export interface MentionResourceConfig extends ServiceConfig {
32
32
  productName?: string;
33
33
  debounceTime?: number;
34
34
  isEligibleXProductUserInvite?: boolean;
35
+ inviteXProductUser?: (userId: string) => Promise<void>;
35
36
  }
36
37
  export interface ResourceProvider<Result> {
37
38
  /**
@@ -56,7 +57,7 @@ export type MentionContextIdentifier = {
56
57
  childObjectId?: string;
57
58
  sessionId?: string;
58
59
  };
59
- export interface MentionProvider extends ResourceProvider<MentionDescription[]>, InviteFromMentionProvider {
60
+ export interface MentionProvider extends ResourceProvider<MentionDescription[]>, InviteFromMentionProvider, XProductInviteMentionProvider {
60
61
  filter(query?: string, contextIdentifier?: MentionContextIdentifier): void;
61
62
  recordMentionSelection(mention: MentionDescription, contextIdentifier?: MentionContextIdentifier): void;
62
63
  shouldHighlightMention(mention: MentionDescription): boolean;
@@ -94,6 +95,7 @@ export interface MentionDescription {
94
95
  userType?: string;
95
96
  context?: MentionDescContext;
96
97
  source?: string;
98
+ isXProductUser?: boolean;
97
99
  }
98
100
  export interface MentionDescContext {
99
101
  members: TeamMember[];
@@ -182,3 +184,7 @@ export interface InviteFromMentionProvider {
182
184
  onInviteItemClick?(flow: InviteFlow): void;
183
185
  userRole?: UserRole;
184
186
  }
187
+ export interface XProductInviteMentionProvider {
188
+ isEligibleXProductUserInvite?: boolean;
189
+ inviteXProductUser?(userId: string): Promise<void>;
190
+ }
@@ -1,9 +1,9 @@
1
1
  import { type MentionProvider, type MentionContextIdentifier, ErrorCallback, InfoCallback, ResultCallback } from './MentionResource';
2
- import { type MentionDescription, type InviteFromMentionProvider } from '../types';
2
+ import { type MentionDescription, type InviteFromMentionProvider, type XProductInviteMentionProvider } from '../types';
3
3
  export type { MentionDescription };
4
4
  export type MentionProviderFunctions = Omit<{
5
5
  [Key in keyof MentionProvider]: MentionProvider[Key] extends Function ? MentionProvider[Key] : never;
6
- }, keyof InviteFromMentionProvider>;
6
+ }, keyof InviteFromMentionProvider | keyof XProductInviteMentionProvider>;
7
7
  /**
8
8
  * This component is stateful and should be instantianted per contextIdentifiers.
9
9
  */
@@ -45,6 +45,8 @@ export declare class MentionResource extends AbstractMentionResource implements
45
45
  shouldEnableInvite: boolean;
46
46
  userRole: UserRole;
47
47
  onInviteItemClick?: (flow: InviteFlow) => void;
48
+ isEligibleXProductUserInvite?: boolean;
49
+ inviteXProductUser?: (userId: string) => Promise<void>;
48
50
  constructor(config: MentionResourceConfig);
49
51
  shouldHighlightMention(mention: MentionDescription): boolean;
50
52
  notify(searchTime: number, mentionResult: MentionsResult, query?: string): void;
@@ -32,6 +32,7 @@ export interface MentionResourceConfig extends ServiceConfig {
32
32
  productName?: string;
33
33
  debounceTime?: number;
34
34
  isEligibleXProductUserInvite?: boolean;
35
+ inviteXProductUser?: (userId: string) => Promise<void>;
35
36
  }
36
37
  export interface ResourceProvider<Result> {
37
38
  /**
@@ -56,7 +57,7 @@ export type MentionContextIdentifier = {
56
57
  childObjectId?: string;
57
58
  sessionId?: string;
58
59
  };
59
- export interface MentionProvider extends ResourceProvider<MentionDescription[]>, InviteFromMentionProvider {
60
+ export interface MentionProvider extends ResourceProvider<MentionDescription[]>, InviteFromMentionProvider, XProductInviteMentionProvider {
60
61
  filter(query?: string, contextIdentifier?: MentionContextIdentifier): void;
61
62
  recordMentionSelection(mention: MentionDescription, contextIdentifier?: MentionContextIdentifier): void;
62
63
  shouldHighlightMention(mention: MentionDescription): boolean;
@@ -94,6 +95,7 @@ export interface MentionDescription {
94
95
  userType?: string;
95
96
  context?: MentionDescContext;
96
97
  source?: string;
98
+ isXProductUser?: boolean;
97
99
  }
98
100
  export interface MentionDescContext {
99
101
  members: TeamMember[];
@@ -182,3 +184,7 @@ export interface InviteFromMentionProvider {
182
184
  onInviteItemClick?(flow: InviteFlow): void;
183
185
  userRole?: UserRole;
184
186
  }
187
+ export interface XProductInviteMentionProvider {
188
+ isEligibleXProductUserInvite?: boolean;
189
+ inviteXProductUser?(userId: string): Promise<void>;
190
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "23.5.0",
3
+ "version": "23.7.0",
4
4
  "description": "A React component used to display user profiles in a list for 'Mention' functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,6 +47,7 @@
47
47
  "@atlaskit/heading": "^4.0.0",
48
48
  "@atlaskit/icon": "^23.1.0",
49
49
  "@atlaskit/lozenge": "^11.12.0",
50
+ "@atlaskit/platform-feature-flags": "^0.3.0",
50
51
  "@atlaskit/primitives": "^13.3.0",
51
52
  "@atlaskit/theme": "^14.0.0",
52
53
  "@atlaskit/tokens": "^2.5.0",
@@ -67,6 +68,7 @@
67
68
  "devDependencies": {
68
69
  "@atlaskit/elements-test-helpers": "^0.7.0",
69
70
  "@atlaskit/visual-regression": "*",
71
+ "@atlassian/feature-flags-test-utils": "*",
70
72
  "@testing-library/react": "^12.1.5",
71
73
  "@types/query-string": "^4.3.1",
72
74
  "@types/serialize-javascript": "^5.0.0",
@@ -107,5 +109,10 @@
107
109
  "./team-resource": "./src/team-resource.ts",
108
110
  "./typeahead": "./src/typeahead.ts",
109
111
  "./types": "./src/types.ts"
112
+ },
113
+ "platform-feature-flags": {
114
+ "platform_editor_ai_remove_mentions_record": {
115
+ "type": "boolean"
116
+ }
110
117
  }
111
118
  }