@atlaskit/editor-plugin-mentions 21.0.2 → 21.1.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,26 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 21.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 21.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`1012a17b207ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1012a17b207ba) -
14
+ Migrate the editor mentions profile card loader to react-loosely-lazy behind the
15
+ `platform_editor_loosely_lazy_migration` experiment.
16
+ - [`d28cad9beb783`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d28cad9beb783) -
17
+ Enable mention avatars when the platform_editor_mention_node_graphql_provider experiment is
18
+ enabled
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 21.0.2
4
25
 
5
26
  ### Patch Changes
@@ -172,7 +172,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
172
172
  api = config.api,
173
173
  portalProviderAPI = config.portalProviderAPI,
174
174
  editorView = config.editorView;
175
- this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_node_avatar');
175
+ this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_node_avatar') || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_node_graphql_provider'));
176
176
  var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(node, this.hasAvatarSlot)),
177
177
  dom = _DOMSerializer$render.dom,
178
178
  contentDOM = _DOMSerializer$render.contentDOM;
@@ -44,7 +44,7 @@ var ACTIONS = exports.ACTIONS = {
44
44
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
45
45
  };
46
46
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
47
- var PACKAGE_VERSION = "21.0.1";
47
+ var PACKAGE_VERSION = "21.1.0";
48
48
  var setProvider = function setProvider(provider) {
49
49
  return function (state, dispatch) {
50
50
  if (dispatch) {
@@ -17,34 +17,54 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
17
17
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
18
18
  var _bindEventListener = require("bind-event-listener");
19
19
  var _reactLoadable = _interopRequireDefault(require("react-loadable"));
20
+ var _reactLooselyLazy = require("react-loosely-lazy");
21
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
20
22
  var _fg = require("@atlaskit/platform-feature-flags/fg");
21
23
  var _lazyProfileCard = require("@atlaskit/profilecard/lazy-profile-card");
22
24
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
25
  var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
24
26
  var _PopperWrapper = require("./PopperWrapper");
25
- 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" != (0, _typeof2.default)(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); }
27
+ 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" != (0, _typeof2.default)(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); } // oxlint-disable-next-line @atlassian/no-restricted-imports
26
28
  // eslint-disable-next-line require-unicode-regexp
27
29
  var LEADING_AT_SIGN_RE = /^@/;
28
- var AgentProfileCardResourcedLazy = (0, _reactLoadable.default)({
29
- loader: function loader() {
30
- return Promise.resolve().then(function () {
31
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
32
- '@atlaskit/profilecard/agent-profile-card-resourced'));
33
- }).then(function (_ref) {
34
- var AgentProfileCardResourced = _ref.AgentProfileCardResourced;
35
- return AgentProfileCardResourced;
36
- });
37
- },
30
+ var loadAgentProfileCardResourced = function loadAgentProfileCardResourced() {
31
+ return Promise.resolve().then(function () {
32
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
33
+ '@atlaskit/profilecard/agent-profile-card-resourced'));
34
+ }).then(function (_ref) {
35
+ var AgentProfileCardResourced = _ref.AgentProfileCardResourced;
36
+ return AgentProfileCardResourced;
37
+ });
38
+ };
39
+ var AgentProfileCardResourcedLazy = (0, _reactLooselyLazy.lazyForPaint)(function () {
40
+ return Promise.resolve().then(function () {
41
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
42
+ '@atlaskit/profilecard/agent-profile-card-resourced'));
43
+ }).then(function (_ref2) {
44
+ var AgentProfileCardResourced = _ref2.AgentProfileCardResourced;
45
+ return AgentProfileCardResourced;
46
+ });
47
+ });
48
+ var AgentProfileCardResourcedLoadable = (0, _reactLoadable.default)({
49
+ loader: loadAgentProfileCardResourced,
38
50
  loading: function loading() {
39
51
  return null;
40
52
  }
41
53
  });
54
+ var AgentProfileCardResourced = function AgentProfileCardResourced(props) {
55
+ return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(_reactLooselyLazy.LazySuspense, {
56
+ fallback: null
57
+ }, /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, props)) :
58
+ /*#__PURE__*/
59
+ // eslint-disable-next-line react/jsx-props-no-spreading -- forward the loader props to the profile card
60
+ React.createElement(AgentProfileCardResourcedLoadable, props);
61
+ };
42
62
  var styles = {
43
63
  loadingStyles: "_2rko12b0 _16qs130s"
44
64
  };
45
- var LoadingWrapper = function LoadingWrapper(_ref2) {
46
- var children = _ref2.children,
47
- isLoading = _ref2.isLoading;
65
+ var LoadingWrapper = function LoadingWrapper(_ref3) {
66
+ var children = _ref3.children,
67
+ isLoading = _ref3.isLoading;
48
68
  return isLoading ? /*#__PURE__*/React.createElement("div", {
49
69
  className: (0, _runtime.ax)([styles.loadingStyles])
50
70
  }, children) : children;
@@ -52,9 +72,9 @@ var LoadingWrapper = function LoadingWrapper(_ref2) {
52
72
  var isAgentMentionType = exports.isAgentMentionType = function isAgentMentionType(userType) {
53
73
  return userType === 'APP' || userType === 'AGENT';
54
74
  };
55
- var useProfileCardState = exports.useProfileCardState = function useProfileCardState(_ref3) {
56
- var id = _ref3.id,
57
- provider = _ref3.provider;
75
+ var useProfileCardState = exports.useProfileCardState = function useProfileCardState(_ref4) {
76
+ var id = _ref4.id,
77
+ provider = _ref4.provider;
58
78
  var _useState = (0, _react.useState)(),
59
79
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
60
80
  data = _useState2[0],
@@ -83,7 +103,7 @@ var useProfileCardState = exports.useProfileCardState = function useProfileCardS
83
103
  // From: packages/people-and-teams/profilecard/src/components/User/ProfileCardTrigger.tsx
84
104
  (0, _react.useEffect)(function () {
85
105
  var fetchData = /*#__PURE__*/function () {
86
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
106
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
87
107
  var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl, _t;
88
108
  return _regenerator.default.wrap(function (_context) {
89
109
  while (1) switch (_context.prev = _context.next) {
@@ -130,7 +150,7 @@ var useProfileCardState = exports.useProfileCardState = function useProfileCardS
130
150
  }, _callee, null, [[2, 4, 5, 6]]);
131
151
  }));
132
152
  return function fetchData() {
133
- return _ref4.apply(this, arguments);
153
+ return _ref5.apply(this, arguments);
134
154
  };
135
155
  }();
136
156
  fetchData();
@@ -148,17 +168,17 @@ var useProfileCardState = exports.useProfileCardState = function useProfileCardS
148
168
  /**
149
169
  * Renders the profile card popup for an editor mention node.
150
170
  */
151
- function ProfileCardComponent(_ref5) {
152
- var _ref7;
153
- var profilecardProvider = _ref5.profilecardProvider,
154
- activeMention = _ref5.activeMention,
155
- dom = _ref5.dom,
156
- closeComponent = _ref5.closeComponent,
157
- onAgentMentionChatClick = _ref5.onAgentMentionChatClick,
158
- placement = _ref5.placement,
159
- offset = _ref5.offset,
160
- disableFocusTrap = _ref5.disableFocusTrap,
161
- hideActions = _ref5.hideActions;
171
+ function ProfileCardComponent(_ref6) {
172
+ var _ref8;
173
+ var profilecardProvider = _ref6.profilecardProvider,
174
+ activeMention = _ref6.activeMention,
175
+ dom = _ref6.dom,
176
+ closeComponent = _ref6.closeComponent,
177
+ onAgentMentionChatClick = _ref6.onAgentMentionChatClick,
178
+ placement = _ref6.placement,
179
+ offset = _ref6.offset,
180
+ disableFocusTrap = _ref6.disableFocusTrap,
181
+ hideActions = _ref6.hideActions;
162
182
  var _useState11 = (0, _react.useState)(undefined),
163
183
  _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
164
184
  provider = _useState12[0],
@@ -168,11 +188,11 @@ function ProfileCardComponent(_ref5) {
168
188
  setProvider(p);
169
189
  });
170
190
  }, [profilecardProvider]);
171
- var _ref6 = (_ref7 = activeMention.attrs) !== null && _ref7 !== void 0 ? _ref7 : {},
172
- id = _ref6.id,
173
- text = _ref6.text,
174
- accessLevel = _ref6.accessLevel,
175
- userType = _ref6.userType;
191
+ var _ref7 = (_ref8 = activeMention.attrs) !== null && _ref8 !== void 0 ? _ref8 : {},
192
+ id = _ref7.id,
193
+ text = _ref7.text,
194
+ accessLevel = _ref7.accessLevel,
195
+ userType = _ref7.userType;
176
196
  (0, _react.useEffect)(function () {
177
197
  return (0, _bindEventListener.bind)(window, {
178
198
  type: 'keydown',
@@ -225,12 +245,12 @@ function ProfileCardComponent(_ref5) {
225
245
  hideActions: hideActions
226
246
  }));
227
247
  }
228
- var UserProfileCardContent = function UserProfileCardContent(_ref8) {
229
- var accessLevel = _ref8.accessLevel,
230
- id = _ref8.id,
231
- provider = _ref8.provider,
232
- text = _ref8.text,
233
- hideActions = _ref8.hideActions;
248
+ var UserProfileCardContent = function UserProfileCardContent(_ref9) {
249
+ var accessLevel = _ref9.accessLevel,
250
+ id = _ref9.id,
251
+ provider = _ref9.provider,
252
+ text = _ref9.text,
253
+ hideActions = _ref9.hideActions;
234
254
  var actions = (0, _react.useMemo)(function () {
235
255
  return hideActions ? [] : provider === null || provider === void 0 ? void 0 : provider.getActions(id, text !== null && text !== void 0 ? text : '', accessLevel);
236
256
  }, [hideActions, accessLevel, id, provider, text]);
@@ -271,14 +291,14 @@ var UserProfileCardContent = function UserProfileCardContent(_ref8) {
271
291
  isRenderedInPortal: (0, _expValEquals.expValEquals)('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true)
272
292
  }));
273
293
  };
274
- var AgentProfileCardContent = function AgentProfileCardContent(_ref9) {
275
- var accountId = _ref9.accountId,
276
- provider = _ref9.provider,
277
- text = _ref9.text,
278
- onChatClick = _ref9.onChatClick,
279
- hideActions = _ref9.hideActions;
294
+ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
295
+ var accountId = _ref0.accountId,
296
+ provider = _ref0.provider,
297
+ text = _ref0.text,
298
+ onChatClick = _ref0.onChatClick,
299
+ hideActions = _ref0.hideActions;
280
300
  var agentName = (text !== null && text !== void 0 ? text : '').replace(LEADING_AT_SIGN_RE, '');
281
- return (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
301
+ return (0, _expVal.expVal)('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
282
302
  accountId: accountId,
283
303
  cloudId: provider.cloudId,
284
304
  resourceClient: provider.resourceClient,
@@ -289,7 +309,7 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref9) {
289
309
  hideStarButton: hideActions,
290
310
  hideAiDisclaimer: hideActions,
291
311
  showCreatorNameWithoutLink: hideActions
292
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
312
+ }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
293
313
  accountId: accountId,
294
314
  cloudId: provider.cloudId,
295
315
  resourceClient: provider.resourceClient,
@@ -135,7 +135,7 @@ export class MentionNodeView {
135
135
  portalProviderAPI,
136
136
  editorView
137
137
  } = config;
138
- this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && isExperimentEnabled('platform_editor_mention_node_avatar');
138
+ this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && (isExperimentEnabled('platform_editor_mention_node_avatar') || isExperimentEnabled('platform_editor_mention_node_graphql_provider'));
139
139
  const {
140
140
  dom,
141
141
  contentDOM
@@ -33,7 +33,7 @@ export const ACTIONS = {
33
33
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
34
34
  };
35
35
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
36
- const PACKAGE_VERSION = "21.0.1";
36
+ const PACKAGE_VERSION = "21.1.0";
37
37
  const setProvider = provider => (state, dispatch) => {
38
38
  if (dispatch) {
39
39
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -5,6 +5,9 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useEffect, useMemo, useState } from 'react';
6
6
  import { bind } from 'bind-event-listener';
7
7
  import Loadable from 'react-loadable';
8
+ // oxlint-disable-next-line @atlassian/no-restricted-imports
9
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
10
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
11
  import { fg } from '@atlaskit/platform-feature-flags/fg';
9
12
  import { ProfileCardLazy } from '@atlaskit/profilecard/lazy-profile-card';
10
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -13,13 +16,24 @@ import { Popup } from './PopperWrapper';
13
16
 
14
17
  // eslint-disable-next-line require-unicode-regexp
15
18
  const LEADING_AT_SIGN_RE = /^@/;
16
- const AgentProfileCardResourcedLazy = Loadable({
17
- loader: () => import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
18
- '@atlaskit/profilecard/agent-profile-card-resourced').then(({
19
- AgentProfileCardResourced
20
- }) => AgentProfileCardResourced),
19
+ const loadAgentProfileCardResourced = () => import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
20
+ '@atlaskit/profilecard/agent-profile-card-resourced').then(({
21
+ AgentProfileCardResourced
22
+ }) => AgentProfileCardResourced);
23
+ const AgentProfileCardResourcedLazy = lazyForPaint(() => import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
24
+ '@atlaskit/profilecard/agent-profile-card-resourced').then(({
25
+ AgentProfileCardResourced
26
+ }) => AgentProfileCardResourced));
27
+ const AgentProfileCardResourcedLoadable = Loadable({
28
+ loader: loadAgentProfileCardResourced,
21
29
  loading: () => null
22
30
  });
31
+ const AgentProfileCardResourced = props => isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(LazySuspense, {
32
+ fallback: null
33
+ }, /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, props)) :
34
+ /*#__PURE__*/
35
+ // eslint-disable-next-line react/jsx-props-no-spreading -- forward the loader props to the profile card
36
+ React.createElement(AgentProfileCardResourcedLoadable, props);
23
37
  const styles = {
24
38
  loadingStyles: "_2rko12b0 _16qs130s"
25
39
  };
@@ -209,7 +223,7 @@ const AgentProfileCardContent = ({
209
223
  hideActions
210
224
  }) => {
211
225
  const agentName = (text !== null && text !== void 0 ? text : '').replace(LEADING_AT_SIGN_RE, '');
212
- return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
226
+ return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
213
227
  accountId: accountId,
214
228
  cloudId: provider.cloudId,
215
229
  resourceClient: provider.resourceClient,
@@ -220,7 +234,7 @@ const AgentProfileCardContent = ({
220
234
  hideStarButton: hideActions,
221
235
  hideAiDisclaimer: hideActions,
222
236
  showCreatorNameWithoutLink: hideActions
223
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
237
+ }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
224
238
  accountId: accountId,
225
239
  cloudId: provider.cloudId,
226
240
  resourceClient: provider.resourceClient,
@@ -167,7 +167,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
167
167
  api = config.api,
168
168
  portalProviderAPI = config.portalProviderAPI,
169
169
  editorView = config.editorView;
170
- this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && isExperimentEnabled('platform_editor_mention_node_avatar');
170
+ this.hasAvatarSlot = Boolean(options === null || options === void 0 ? void 0 : options.mentionNodeDataProvider) && node.attrs.userType !== 'SPECIAL' && !genericMentionIds.includes(node.attrs.id) && (isExperimentEnabled('platform_editor_mention_node_avatar') || isExperimentEnabled('platform_editor_mention_node_graphql_provider'));
171
171
  var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(node, this.hasAvatarSlot)),
172
172
  dom = _DOMSerializer$render.dom,
173
173
  contentDOM = _DOMSerializer$render.contentDOM;
@@ -36,7 +36,7 @@ export var ACTIONS = {
36
36
  CLEAR_PENDING_PASTED_AGENT_MENTION: 'CLEAR_PENDING_PASTED_AGENT_MENTION'
37
37
  };
38
38
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
39
- var PACKAGE_VERSION = "21.0.1";
39
+ var PACKAGE_VERSION = "21.1.0";
40
40
  var setProvider = function setProvider(provider) {
41
41
  return function (state, dispatch) {
42
42
  if (dispatch) {
@@ -8,6 +8,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { useEffect, useMemo, useState } from 'react';
9
9
  import { bind } from 'bind-event-listener';
10
10
  import Loadable from 'react-loadable';
11
+ // oxlint-disable-next-line @atlassian/no-restricted-imports
12
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
13
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
12
15
  import { ProfileCardLazy } from '@atlaskit/profilecard/lazy-profile-card';
13
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -16,24 +19,40 @@ import { Popup } from './PopperWrapper';
16
19
 
17
20
  // eslint-disable-next-line require-unicode-regexp
18
21
  var LEADING_AT_SIGN_RE = /^@/;
19
- var AgentProfileCardResourcedLazy = Loadable({
20
- loader: function loader() {
21
- return import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
22
- '@atlaskit/profilecard/agent-profile-card-resourced').then(function (_ref) {
23
- var AgentProfileCardResourced = _ref.AgentProfileCardResourced;
24
- return AgentProfileCardResourced;
25
- });
26
- },
22
+ var loadAgentProfileCardResourced = function loadAgentProfileCardResourced() {
23
+ return import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
24
+ '@atlaskit/profilecard/agent-profile-card-resourced').then(function (_ref) {
25
+ var AgentProfileCardResourced = _ref.AgentProfileCardResourced;
26
+ return AgentProfileCardResourced;
27
+ });
28
+ };
29
+ var AgentProfileCardResourcedLazy = lazyForPaint(function () {
30
+ return import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-mentions-agent-profile-card-resourced" */
31
+ '@atlaskit/profilecard/agent-profile-card-resourced').then(function (_ref2) {
32
+ var AgentProfileCardResourced = _ref2.AgentProfileCardResourced;
33
+ return AgentProfileCardResourced;
34
+ });
35
+ });
36
+ var AgentProfileCardResourcedLoadable = Loadable({
37
+ loader: loadAgentProfileCardResourced,
27
38
  loading: function loading() {
28
39
  return null;
29
40
  }
30
41
  });
42
+ var AgentProfileCardResourced = function AgentProfileCardResourced(props) {
43
+ return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(LazySuspense, {
44
+ fallback: null
45
+ }, /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, props)) :
46
+ /*#__PURE__*/
47
+ // eslint-disable-next-line react/jsx-props-no-spreading -- forward the loader props to the profile card
48
+ React.createElement(AgentProfileCardResourcedLoadable, props);
49
+ };
31
50
  var styles = {
32
51
  loadingStyles: "_2rko12b0 _16qs130s"
33
52
  };
34
- var LoadingWrapper = function LoadingWrapper(_ref2) {
35
- var children = _ref2.children,
36
- isLoading = _ref2.isLoading;
53
+ var LoadingWrapper = function LoadingWrapper(_ref3) {
54
+ var children = _ref3.children,
55
+ isLoading = _ref3.isLoading;
37
56
  return isLoading ? /*#__PURE__*/React.createElement("div", {
38
57
  className: ax([styles.loadingStyles])
39
58
  }, children) : children;
@@ -41,9 +60,9 @@ var LoadingWrapper = function LoadingWrapper(_ref2) {
41
60
  export var isAgentMentionType = function isAgentMentionType(userType) {
42
61
  return userType === 'APP' || userType === 'AGENT';
43
62
  };
44
- export var useProfileCardState = function useProfileCardState(_ref3) {
45
- var id = _ref3.id,
46
- provider = _ref3.provider;
63
+ export var useProfileCardState = function useProfileCardState(_ref4) {
64
+ var id = _ref4.id,
65
+ provider = _ref4.provider;
47
66
  var _useState = useState(),
48
67
  _useState2 = _slicedToArray(_useState, 2),
49
68
  data = _useState2[0],
@@ -72,7 +91,7 @@ export var useProfileCardState = function useProfileCardState(_ref3) {
72
91
  // From: packages/people-and-teams/profilecard/src/components/User/ProfileCardTrigger.tsx
73
92
  useEffect(function () {
74
93
  var fetchData = /*#__PURE__*/function () {
75
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
94
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
76
95
  var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl, _t;
77
96
  return _regeneratorRuntime.wrap(function (_context) {
78
97
  while (1) switch (_context.prev = _context.next) {
@@ -119,7 +138,7 @@ export var useProfileCardState = function useProfileCardState(_ref3) {
119
138
  }, _callee, null, [[2, 4, 5, 6]]);
120
139
  }));
121
140
  return function fetchData() {
122
- return _ref4.apply(this, arguments);
141
+ return _ref5.apply(this, arguments);
123
142
  };
124
143
  }();
125
144
  fetchData();
@@ -137,17 +156,17 @@ export var useProfileCardState = function useProfileCardState(_ref3) {
137
156
  /**
138
157
  * Renders the profile card popup for an editor mention node.
139
158
  */
140
- export function ProfileCardComponent(_ref5) {
141
- var _ref7;
142
- var profilecardProvider = _ref5.profilecardProvider,
143
- activeMention = _ref5.activeMention,
144
- dom = _ref5.dom,
145
- closeComponent = _ref5.closeComponent,
146
- onAgentMentionChatClick = _ref5.onAgentMentionChatClick,
147
- placement = _ref5.placement,
148
- offset = _ref5.offset,
149
- disableFocusTrap = _ref5.disableFocusTrap,
150
- hideActions = _ref5.hideActions;
159
+ export function ProfileCardComponent(_ref6) {
160
+ var _ref8;
161
+ var profilecardProvider = _ref6.profilecardProvider,
162
+ activeMention = _ref6.activeMention,
163
+ dom = _ref6.dom,
164
+ closeComponent = _ref6.closeComponent,
165
+ onAgentMentionChatClick = _ref6.onAgentMentionChatClick,
166
+ placement = _ref6.placement,
167
+ offset = _ref6.offset,
168
+ disableFocusTrap = _ref6.disableFocusTrap,
169
+ hideActions = _ref6.hideActions;
151
170
  var _useState11 = useState(undefined),
152
171
  _useState12 = _slicedToArray(_useState11, 2),
153
172
  provider = _useState12[0],
@@ -157,11 +176,11 @@ export function ProfileCardComponent(_ref5) {
157
176
  setProvider(p);
158
177
  });
159
178
  }, [profilecardProvider]);
160
- var _ref6 = (_ref7 = activeMention.attrs) !== null && _ref7 !== void 0 ? _ref7 : {},
161
- id = _ref6.id,
162
- text = _ref6.text,
163
- accessLevel = _ref6.accessLevel,
164
- userType = _ref6.userType;
179
+ var _ref7 = (_ref8 = activeMention.attrs) !== null && _ref8 !== void 0 ? _ref8 : {},
180
+ id = _ref7.id,
181
+ text = _ref7.text,
182
+ accessLevel = _ref7.accessLevel,
183
+ userType = _ref7.userType;
165
184
  useEffect(function () {
166
185
  return bind(window, {
167
186
  type: 'keydown',
@@ -214,12 +233,12 @@ export function ProfileCardComponent(_ref5) {
214
233
  hideActions: hideActions
215
234
  }));
216
235
  }
217
- var UserProfileCardContent = function UserProfileCardContent(_ref8) {
218
- var accessLevel = _ref8.accessLevel,
219
- id = _ref8.id,
220
- provider = _ref8.provider,
221
- text = _ref8.text,
222
- hideActions = _ref8.hideActions;
236
+ var UserProfileCardContent = function UserProfileCardContent(_ref9) {
237
+ var accessLevel = _ref9.accessLevel,
238
+ id = _ref9.id,
239
+ provider = _ref9.provider,
240
+ text = _ref9.text,
241
+ hideActions = _ref9.hideActions;
223
242
  var actions = useMemo(function () {
224
243
  return hideActions ? [] : provider === null || provider === void 0 ? void 0 : provider.getActions(id, text !== null && text !== void 0 ? text : '', accessLevel);
225
244
  }, [hideActions, accessLevel, id, provider, text]);
@@ -260,14 +279,14 @@ var UserProfileCardContent = function UserProfileCardContent(_ref8) {
260
279
  isRenderedInPortal: expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true)
261
280
  }));
262
281
  };
263
- var AgentProfileCardContent = function AgentProfileCardContent(_ref9) {
264
- var accountId = _ref9.accountId,
265
- provider = _ref9.provider,
266
- text = _ref9.text,
267
- onChatClick = _ref9.onChatClick,
268
- hideActions = _ref9.hideActions;
282
+ var AgentProfileCardContent = function AgentProfileCardContent(_ref0) {
283
+ var accountId = _ref0.accountId,
284
+ provider = _ref0.provider,
285
+ text = _ref0.text,
286
+ onChatClick = _ref0.onChatClick,
287
+ hideActions = _ref0.hideActions;
269
288
  var agentName = (text !== null && text !== void 0 ? text : '').replace(LEADING_AT_SIGN_RE, '');
270
- return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
289
+ return expVal('platform_editor_reduced_agent_profile_cards', 'isEnabled', false) ? /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
271
290
  accountId: accountId,
272
291
  cloudId: provider.cloudId,
273
292
  resourceClient: provider.resourceClient,
@@ -278,7 +297,7 @@ var AgentProfileCardContent = function AgentProfileCardContent(_ref9) {
278
297
  hideStarButton: hideActions,
279
298
  hideAiDisclaimer: hideActions,
280
299
  showCreatorNameWithoutLink: hideActions
281
- }) : /*#__PURE__*/React.createElement(AgentProfileCardResourcedLazy, {
300
+ }) : /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
282
301
  accountId: accountId,
283
302
  cloudId: provider.cloudId,
284
303
  resourceClient: provider.resourceClient,
@@ -1,2 +1,2 @@
1
1
  export { MentionNodeDataProvider } from '../providers/mention-node-data-provider';
2
- export type { FetchMentionNodeData } from '../providers/mention-node-data-provider';
2
+ export type { FetchMentionNodeData, ResolveMentionNodeData, } from '../providers/mention-node-data-provider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "21.0.2",
3
+ "version": "21.1.1",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "atlaskit:src": "src/index.ts",
23
23
  "dependencies": {
24
- "@atlaskit/adf-schema": "^57.5.0",
24
+ "@atlaskit/adf-schema": "^57.6.0",
25
25
  "@atlaskit/css": "^1.1.0",
26
26
  "@atlaskit/editor-json-transformer": "^9.8.0",
27
27
  "@atlaskit/editor-plugin-analytics": "^19.0.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": "^201.0.0",
50
+ "@atlaskit/tmp-editor-statsig": "^202.0.0",
51
51
  "@atlaskit/tokens": "^18.2.0",
52
52
  "@atlaskit/tooltip": "^24.3.0",
53
53
  "@atlaskit/user-picker": "^13.13.0",
@@ -56,16 +56,17 @@
56
56
  "bind-event-listener": "^3.0.0",
57
57
  "focus-trap": "^2.4.5",
58
58
  "react-loadable": "^5.1.0",
59
+ "react-loosely-lazy": "^1.0.0",
59
60
  "uuid": "^11.1.1"
60
61
  },
61
62
  "peerDependencies": {
62
- "@atlaskit/editor-common": "^123.2.0",
63
+ "@atlaskit/editor-common": "^123.5.0",
63
64
  "react": "^18.2.0 || ^19.2.0",
64
65
  "react-dom": "^18.2.0 || ^19.2.0",
65
66
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
66
67
  },
67
68
  "devDependencies": {
68
- "@atlaskit/button": "^25.3.0",
69
+ "@atlaskit/button": "^25.4.0",
69
70
  "@atlaskit/editor-core": "^229.1.0",
70
71
  "@atlassian/workbench": "workspace:*",
71
72
  "@testing-library/react": "^16.3.0",