@atlaskit/editor-common 118.11.0 → 119.0.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/compass.yml +2 -2
  3. package/dist/cjs/core-utils/index.js +1 -8
  4. package/dist/cjs/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
  5. package/dist/cjs/extensions/buildMenuItem.js +7 -1
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/portal/common.js +2 -3
  8. package/dist/cjs/react-node-view/NodeViewContentHole.js +1 -2
  9. package/dist/cjs/react-node-view/index.js +1 -1
  10. package/dist/cjs/ui/DropList/index.js +1 -1
  11. package/dist/cjs/ui/Mention/index.js +20 -1
  12. package/dist/cjs/ui/Mention/mention-node-data-provider.js +5 -0
  13. package/dist/cjs/ui/Mention/mention-with-profilecard.js +8 -0
  14. package/dist/cjs/ui/Mention/mention-with-providers.js +92 -15
  15. package/dist/es2019/core-utils/index.js +1 -2
  16. package/dist/es2019/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
  17. package/dist/es2019/extensions/buildMenuItem.js +7 -0
  18. package/dist/es2019/monitoring/error.js +1 -1
  19. package/dist/es2019/portal/common.js +2 -3
  20. package/dist/es2019/react-node-view/NodeViewContentHole.js +1 -2
  21. package/dist/es2019/react-node-view/index.js +2 -2
  22. package/dist/es2019/ui/DropList/index.js +1 -1
  23. package/dist/es2019/ui/Mention/index.js +21 -2
  24. package/dist/es2019/ui/Mention/mention-node-data-provider.js +1 -0
  25. package/dist/es2019/ui/Mention/mention-with-profilecard.js +8 -0
  26. package/dist/es2019/ui/Mention/mention-with-providers.js +69 -2
  27. package/dist/esm/core-utils/index.js +1 -2
  28. package/dist/esm/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
  29. package/dist/esm/extensions/buildMenuItem.js +7 -1
  30. package/dist/esm/monitoring/error.js +1 -1
  31. package/dist/esm/portal/common.js +2 -3
  32. package/dist/esm/react-node-view/NodeViewContentHole.js +1 -2
  33. package/dist/esm/react-node-view/index.js +2 -2
  34. package/dist/esm/ui/DropList/index.js +1 -1
  35. package/dist/esm/ui/Mention/index.js +21 -2
  36. package/dist/esm/ui/Mention/mention-node-data-provider.js +1 -0
  37. package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -0
  38. package/dist/esm/ui/Mention/mention-with-providers.js +92 -15
  39. package/dist/types/analytics/types/quick-insert-events.d.ts +15 -34
  40. package/dist/types/collab/agent-remote-edit-review.d.ts +14 -0
  41. package/dist/types/core-utils/index.d.ts +0 -1
  42. package/dist/types/extensions/types/extension-manifest.d.ts +9 -0
  43. package/dist/types/extensions/types/utils.d.ts +2 -1
  44. package/dist/types/mention.d.ts +1 -0
  45. package/dist/types/provider-factory/quick-insert-provider.d.ts +3 -0
  46. package/dist/types/ui/Mention/index.d.ts +2 -0
  47. package/dist/types/ui/Mention/mention-node-data-provider.d.ts +32 -0
  48. package/dist/types/ui/Mention/mention-with-profilecard.d.ts +5 -1
  49. package/dist/types/ui/Mention/mention-with-providers.d.ts +11 -1
  50. package/package.json +9 -3
  51. package/dist/cjs/core-utils/is-ssr-streaming.js +0 -22
  52. package/dist/es2019/core-utils/is-ssr-streaming.js +0 -16
  53. package/dist/esm/core-utils/is-ssr-streaming.js +0 -16
  54. package/dist/types/core-utils/is-ssr-streaming.d.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 119.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`bb37742539a7d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb37742539a7d) -
8
+ Rename Quick Insert category analytics from app counts to macro counts, add reusable extension app
9
+ identity, and track internal, ecosystem, and all macro/app counts for externally provided items
10
+ behind `platform_editor_slash_app_category_analytics`. GUID-only app identities are grouped as
11
+ `unknown`.
12
+
13
+ Breaking change: `CategoryInformation` and `QuickInsertInformationAttributes` from
14
+ `@atlaskit/editor-common/analytics/types/quick-insert-events` have changed shape. Update usages to
15
+ the new fields (`internalMacroCount`, `internalAppCount`, `internalAppMacroMax`,
16
+ `ecosystemMacroCount`, `ecosystemAppCount`, `ecosystemAppMacroMax`, `allMacroCount`,
17
+ `allAppCount`, and `allAppMacroMax`) and add the `allCategories` aggregate. Remove references to
18
+ the removed `appCount` and `appMacros` fields. `ExtensionApp.ownership` has been replaced by
19
+ `ExtensionApp.source` (`internal` or `ecosystem`); update app metadata producers accordingly.
20
+
21
+ ### Minor Changes
22
+
23
+ - [`ddb1f3da1e991`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ddb1f3da1e991) -
24
+ Track acceptance rate for backend-persisted agent edits. These arrive as remote collab steps
25
+ rather than frontend-streamed transformations, so they previously started no analytics session and
26
+ were absent from the metric. They now reuse the existing survival definition, and are recorded
27
+ only on the requesting user's client.
28
+
29
+ Gated by `platform_editor_agent_be_streaming`, which controls whether remote agent steps are
30
+ annotated at all, and by the agent type allowlist in
31
+ `platform_editor_backend_review_moment_agent_types`, which defaults to empty. Recording cannot
32
+ occur unless both permit it.
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies
37
+
38
+ ## 118.12.0
39
+
40
+ ### Minor Changes
41
+
42
+ - [`13e86ff9f1588`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13e86ff9f1588) -
43
+ [ux] Display avatars for mention nodes.
44
+ - [`da5eaf0bc37da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da5eaf0bc37da) -
45
+ Clean up the platform_editor_editor_ssr_streaming experiment. The SSR streaming code paths are now
46
+ permanent and the isSSRStreaming() utility has been removed from
47
+ @atlaskit/editor-common/core-utils.
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies
52
+
3
53
  ## 118.11.0
4
54
 
5
55
  ### Minor Changes
package/compass.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  configVersion: 1
2
2
  id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/8aba7f6e-457b-4200-9b6f-00adf2350107
3
3
  name: '@atlaskit/editor-common'
4
- ownerId: ari:cloud:identity::team/og-da2205cb-ea5e-4059-9215-30c9b26c971f # Fabric - Editor
4
+ ownerId: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb # Editor Developers
5
5
  labels:
6
6
  - platform-code
7
7
  - platform-afm
@@ -23,7 +23,7 @@ links:
23
23
  customFields:
24
24
  - name: Department
25
25
  type: text
26
- value: Eng - Editor Frontend Platform
26
+ value: Editor Developers
27
27
  - name: Trusted Reviewer Teams
28
28
  type: text
29
29
  value: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb
@@ -21,13 +21,6 @@ Object.defineProperty(exports, "isSSR", {
21
21
  return _isSsr.isSSR;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "isSSRStreaming", {
25
- enumerable: true,
26
- get: function get() {
27
- return _isSsrStreaming.isSSRStreaming;
28
- }
29
- });
30
24
  var _inside = require("./inside");
31
25
  var _documentLogger = require("./document-logger");
32
- var _isSsr = require("./is-ssr");
33
- var _isSsrStreaming = require("./is-ssr-streaming");
26
+ var _isSsr = require("./is-ssr");
@@ -8,11 +8,10 @@ exports.ExtensionSSRReactContextsProvider = ExtensionSSRReactContextsProvider;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntl = require("react-intl");
10
10
  var _isSsr = require("../core-utils/is-ssr");
11
- var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
12
11
  function ExtensionSSRReactContextsProvider(_ref) {
13
12
  var children = _ref.children,
14
13
  intl = _ref.intl;
15
- if (!(0, _isSsr.isSSR)() || !(0, _isSsrStreaming.isSSRStreaming)()) {
14
+ if (!(0, _isSsr.isSSR)()) {
16
15
  return children;
17
16
  }
18
17
  if (!intl) {
@@ -6,17 +6,23 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.buildMenuItem = buildMenuItem;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
9
10
  var _manifestHelpers = require("./manifest-helpers");
10
11
  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; }
11
12
  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; }
12
13
  function buildMenuItem(manifest, extensionModule) {
14
+ var _ref, _extensionModule$app;
13
15
  var title = extensionModule.title || manifest.title;
14
16
  var key = "".concat(manifest.key, ":").concat(extensionModule.key);
15
17
  var node = (0, _manifestHelpers.buildAction)(extensionModule.action, manifest);
16
18
  if (!node) {
17
19
  throw new Error("Couldn't find any action for ".concat(title, " (").concat(key, ")"));
18
20
  }
19
- return _objectSpread(_objectSpread({
21
+ return _objectSpread(_objectSpread(_objectSpread({}, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_app_category_analytics') ? {
22
+ app: (_ref = (_extensionModule$app = extensionModule.app) !== null && _extensionModule$app !== void 0 ? _extensionModule$app : manifest.app) !== null && _ref !== void 0 ? _ref : {
23
+ key: manifest.key
24
+ }
25
+ } : {}), {}, {
20
26
  key: key,
21
27
  title: title,
22
28
  extensionType: manifest.type,
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "118.10.3";
31
+ var packageVersion = "118.12.0";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -20,7 +20,6 @@ exports.getPortalProviderAPI = void 0;
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
  var _reactDom = require("react-dom");
22
22
  var _isSsr = require("../core-utils/is-ssr");
23
- var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
24
23
  var _PortalRenderWrapperInner = require("./PortalRenderWrapperInner");
25
24
  var _createPortalRendererComponent = require("./createPortalRendererComponent");
26
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" != _typeof(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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -60,7 +59,7 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
60
59
  return {
61
60
  render: function render(children, container, key, onBeforeReactDomRender) {
62
61
  var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
63
- if ((0, _isSsr.isSSR)() && (0, _isSsrStreaming.isSSRStreaming)()) {
62
+ if ((0, _isSsr.isSSR)()) {
64
63
  var html = '';
65
64
  try {
66
65
  var renderToStaticMarkup = getRenderToStaticMarkup();
@@ -93,7 +92,7 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
93
92
  },
94
93
  remove: function remove(key) {
95
94
  var _portalsMap$get;
96
- if ((0, _isSsr.isSSR)() && (0, _isSsrStreaming.isSSRStreaming)()) {
95
+ if ((0, _isSsr.isSSR)()) {
97
96
  return;
98
97
  }
99
98
  (_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
@@ -9,7 +9,6 @@ exports.NodeViewContentHole = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _isSsr = require("../core-utils/is-ssr");
12
- var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
13
12
  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" != _typeof(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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
13
  /**
15
14
  * A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
@@ -18,6 +17,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
18
17
  var NodeViewContentHole = exports.NodeViewContentHole = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
19
18
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
20
19
  ref: ref,
21
- "data-ssr-content-dom-ref": (0, _isSsr.isSSR)() && (0, _isSsrStreaming.isSSRStreaming)() ? '' : undefined
20
+ "data-ssr-content-dom-ref": (0, _isSsr.isSSR)() ? '' : undefined
22
21
  }));
23
22
  });
@@ -123,7 +123,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
123
123
  // contentDOMWrapper that was appended above. The React ref callback
124
124
  // (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
125
125
  // left detached. Re-attach it by finding the marked SSR ref target.
126
- if ((0, _coreUtils.isSSR)() && (0, _coreUtils.isSSRStreaming)() && this.domRef) {
126
+ if ((0, _coreUtils.isSSR)() && this.domRef) {
127
127
  var refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
128
128
  if (refTarget) {
129
129
  this.handleRef(refTarget);
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "118.10.3";
27
+ var packageVersion = "118.12.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _react = _interopRequireWildcard(require("react"));
16
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
16
17
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
18
  var _providerFactory = require("../../provider-factory");
18
19
  var _mentionWithProviders = require("./mention-with-providers");
@@ -20,6 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
20
21
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
21
22
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @repo/internal/react/no-class-components */
22
23
  var MENTION_PROVIDERS = ['mentionProvider', 'profilecardProvider'];
24
+ var GENERIC_MENTION_IDS = ['HipChat', 'all', 'here'];
23
25
  var Mention = exports.default = /*#__PURE__*/function (_PureComponent) {
24
26
  function Mention(props) {
25
27
  var _this;
@@ -34,9 +36,26 @@ var Mention = exports.default = /*#__PURE__*/function (_PureComponent) {
34
36
  localId = _this$props.localId,
35
37
  userType = _this$props.userType,
36
38
  isDisabled = _this$props.isDisabled,
37
- disabledTooltip = _this$props.disabledTooltip;
39
+ disabledTooltip = _this$props.disabledTooltip,
40
+ mentionNodeDataProvider = _this$props.mentionNodeDataProvider;
38
41
  var mentionProvider = providers.mentionProvider,
39
42
  profilecardProvider = providers.profilecardProvider;
43
+ var isAvatarEnabled = Boolean(mentionNodeDataProvider) && userType !== 'SPECIAL' && !GENERIC_MENTION_IDS.includes(id) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_node_avatar');
44
+ if (isAvatarEnabled && mentionNodeDataProvider) {
45
+ return /*#__PURE__*/_react.default.createElement(_mentionWithProviders.MentionWithAvatarProviders, {
46
+ id: id,
47
+ text: text,
48
+ accessLevel: accessLevel,
49
+ localId: localId,
50
+ userType: userType,
51
+ isDisabled: isDisabled,
52
+ disabledTooltip: disabledTooltip,
53
+ eventHandlers: eventHandlers,
54
+ mentionProvider: mentionProvider,
55
+ mentionNodeDataProvider: mentionNodeDataProvider,
56
+ profilecardProvider: profilecardProvider
57
+ });
58
+ }
40
59
  return /*#__PURE__*/_react.default.createElement(_mentionWithProviders.MentionWithProviders, {
41
60
  id: id,
42
61
  text: text,
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -47,11 +47,15 @@ function MentionWithProfileCard(_ref) {
47
47
  id = _ref.id,
48
48
  text = _ref.text,
49
49
  accessLevel = _ref.accessLevel,
50
+ appType = _ref.appType,
51
+ avatarUrl = _ref.avatarUrl,
52
+ isAvatarImagePreShaped = _ref.isAvatarImagePreShaped,
50
53
  mentionProvider = _ref.mentionProvider,
51
54
  profilecardProvider = _ref.profilecardProvider,
52
55
  onClick = _ref.onClick,
53
56
  onMouseEnter = _ref.onMouseEnter,
54
57
  onMouseLeave = _ref.onMouseLeave,
58
+ renderAvatarSlot = _ref.renderAvatarSlot,
55
59
  localId = _ref.localId,
56
60
  ssrPlaceholderId = _ref.ssrPlaceholderId,
57
61
  userType = _ref.userType;
@@ -65,11 +69,15 @@ function MentionWithProfileCard(_ref) {
65
69
  id: id,
66
70
  text: text,
67
71
  accessLevel: accessLevel,
72
+ appType: appType,
73
+ avatarUrl: avatarUrl,
74
+ isAvatarImagePreShaped: isAvatarImagePreShaped,
68
75
  localId: localId,
69
76
  mentionProvider: mentionProvider,
70
77
  onClick: onClick,
71
78
  onMouseEnter: onMouseEnter,
72
79
  onMouseLeave: onMouseLeave,
80
+ renderAvatarSlot: renderAvatarSlot,
73
81
  ssrPlaceholderId: ssrPlaceholderId
74
82
  });
75
83
 
@@ -5,28 +5,78 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.MentionWithProviders = void 0;
8
+ exports.MentionWithProviders = exports.MentionWithAvatarProviders = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
12
  var _react = _interopRequireWildcard(require("react"));
11
13
  var _element = require("@atlaskit/mention/element");
12
14
  var _mentionWithProfilecard = _interopRequireDefault(require("./mention-with-profilecard"));
15
+ var _excluded = ["id", "mentionNodeDataProvider", "userType"];
13
16
  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" != _typeof(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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
17
  var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
15
- var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.default.memo(function (_ref) {
16
- var accessLevel = _ref.accessLevel,
17
- disabledTooltip = _ref.disabledTooltip,
18
- eventHandlers = _ref.eventHandlers,
19
- id = _ref.id,
20
- isDisabled = _ref.isDisabled,
21
- mentionProvider = _ref.mentionProvider,
22
- profilecardProviderResolver = _ref.profilecardProvider,
23
- text = _ref.text,
24
- localId = _ref.localId,
18
+ var useMentionNodeData = function useMentionNodeData(_ref) {
19
+ var _state$data;
20
+ var id = _ref.id,
21
+ mentionNodeDataProvider = _ref.mentionNodeDataProvider,
25
22
  userType = _ref.userType;
26
- var _useState = (0, _react.useState)(null),
23
+ var mention = (0, _react.useMemo)(function () {
24
+ return {
25
+ id: id,
26
+ userType: userType
27
+ };
28
+ }, [id, userType]);
29
+ var mentionKey = "".concat(userType !== null && userType !== void 0 ? userType : 'DEFAULT', ":").concat(id);
30
+ var synchronousData = (0, _react.useMemo)(function () {
31
+ return mentionNodeDataProvider.getMentionDataFromCache(mention);
32
+ }, [mention, mentionNodeDataProvider]);
33
+ var _useState = (0, _react.useState)(function () {
34
+ return {
35
+ data: synchronousData,
36
+ key: mentionKey
37
+ };
38
+ }),
27
39
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
28
- profilecardProvider = _useState2[0],
29
- setProfilecardProvider = _useState2[1];
40
+ state = _useState2[0],
41
+ setState = _useState2[1];
42
+ var data = state.key === mentionKey ? (_state$data = state.data) !== null && _state$data !== void 0 ? _state$data : synchronousData : synchronousData;
43
+ (0, _react.useEffect)(function () {
44
+ if (synchronousData) {
45
+ return;
46
+ }
47
+ var isActive = true;
48
+ mentionNodeDataProvider.getMentionData(mention, function (payload) {
49
+ if (isActive && payload.data) {
50
+ setState({
51
+ data: payload.data,
52
+ key: mentionKey
53
+ });
54
+ }
55
+ });
56
+ return function () {
57
+ isActive = false;
58
+ };
59
+ }, [mention, mentionKey, mentionNodeDataProvider, synchronousData]);
60
+ return data;
61
+ };
62
+ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.default.memo(function (_ref2) {
63
+ var accessLevel = _ref2.accessLevel,
64
+ disabledTooltip = _ref2.disabledTooltip,
65
+ eventHandlers = _ref2.eventHandlers,
66
+ id = _ref2.id,
67
+ isDisabled = _ref2.isDisabled,
68
+ mentionNodeData = _ref2.mentionNodeData,
69
+ mentionProvider = _ref2.mentionProvider,
70
+ profilecardProviderResolver = _ref2.profilecardProvider,
71
+ _ref2$renderAvatarSlo = _ref2.renderAvatarSlot,
72
+ renderAvatarSlot = _ref2$renderAvatarSlo === void 0 ? false : _ref2$renderAvatarSlo,
73
+ text = _ref2.text,
74
+ localId = _ref2.localId,
75
+ userType = _ref2.userType;
76
+ var _useState3 = (0, _react.useState)(null),
77
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
78
+ profilecardProvider = _useState4[0],
79
+ setProfilecardProvider = _useState4[1];
30
80
  var mountedRef = (0, _react.useRef)(true);
31
81
  (0, _react.useLayoutEffect)(function () {
32
82
  mountedRef.current = true;
@@ -61,11 +111,15 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
61
111
  accessLevel: accessLevel,
62
112
  localId: localId,
63
113
  mentionProvider: mentionProvider,
114
+ appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
115
+ avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
116
+ isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped,
64
117
  isDisabled: true,
65
118
  disabledTooltip: disabledTooltip,
66
119
  onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
67
120
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
68
121
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
122
+ renderAvatarSlot: renderAvatarSlot,
69
123
  ssrPlaceholderId: ssrPlaceholderId
70
124
  });
71
125
  }
@@ -75,7 +129,10 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
75
129
  accessLevel: accessLevel,
76
130
  localId: localId,
77
131
  userType: userType,
78
- mentionProvider: mentionProvider
132
+ mentionProvider: mentionProvider,
133
+ appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
134
+ avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
135
+ isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped
79
136
  // Ignored via go/ees005
80
137
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
81
138
  ,
@@ -83,6 +140,26 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
83
140
  onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
84
141
  onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
85
142
  onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
143
+ renderAvatarSlot: renderAvatarSlot,
86
144
  ssrPlaceholderId: ssrPlaceholderId
87
145
  });
146
+ });
147
+ var MentionWithAvatarProviders = exports.MentionWithAvatarProviders = /*#__PURE__*/_react.default.memo(function (_ref3) {
148
+ var id = _ref3.id,
149
+ mentionNodeDataProvider = _ref3.mentionNodeDataProvider,
150
+ userType = _ref3.userType,
151
+ props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
152
+ var mentionNodeData = useMentionNodeData({
153
+ id: id,
154
+ mentionNodeDataProvider: mentionNodeDataProvider,
155
+ userType: userType
156
+ });
157
+ return /*#__PURE__*/_react.default.createElement(MentionWithProviders
158
+ // eslint-disable-next-line react/jsx-props-no-spreading -- The treatment adds only resolved avatar data to the existing mention props.
159
+ , (0, _extends2.default)({}, props, {
160
+ id: id,
161
+ mentionNodeData: mentionNodeData,
162
+ renderAvatarSlot: true,
163
+ userType: userType
164
+ }));
88
165
  });
@@ -3,5 +3,4 @@
3
3
 
4
4
  export { insideTable } from './inside';
5
5
  export { getDocStructure } from './document-logger';
6
- export { isSSR } from './is-ssr';
7
- export { isSSRStreaming } from './is-ssr-streaming';
6
+ export { isSSR } from './is-ssr';
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
2
  import { RawIntlProvider } from 'react-intl';
3
3
  import { isSSR } from '../core-utils/is-ssr';
4
- import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
5
4
  export function ExtensionSSRReactContextsProvider({
6
5
  children,
7
6
  intl
8
7
  }) {
9
- if (!isSSR() || !isSSRStreaming()) {
8
+ if (!isSSR()) {
10
9
  return children;
11
10
  }
12
11
  if (!intl) {
@@ -1,5 +1,7 @@
1
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
1
2
  import { buildAction } from './manifest-helpers';
2
3
  export function buildMenuItem(manifest, extensionModule) {
4
+ var _ref, _extensionModule$app;
3
5
  const title = extensionModule.title || manifest.title;
4
6
  const key = `${manifest.key}:${extensionModule.key}`;
5
7
  const node = buildAction(extensionModule.action, manifest);
@@ -7,6 +9,11 @@ export function buildMenuItem(manifest, extensionModule) {
7
9
  throw new Error(`Couldn't find any action for ${title} (${key})`);
8
10
  }
9
11
  return {
12
+ ...(isExperimentEnabled('platform_editor_slash_app_category_analytics') ? {
13
+ app: (_ref = (_extensionModule$app = extensionModule.app) !== null && _extensionModule$app !== void 0 ? _extensionModule$app : manifest.app) !== null && _ref !== void 0 ? _ref : {
14
+ key: manifest.key
15
+ }
16
+ } : {}),
10
17
  key,
11
18
  title,
12
19
  extensionType: manifest.type,
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "118.10.3";
17
+ const packageVersion = "118.12.0";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -1,7 +1,6 @@
1
1
  import React, { memo } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { isSSR } from '../core-utils/is-ssr';
4
- import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
5
4
  import { PortalRenderWrapperInner } from './PortalRenderWrapperInner';
6
5
  const PortalRenderWrapper = /*#__PURE__*/memo(PortalRenderWrapperInner);
7
6
  PortalRenderWrapper.displayName = 'PortalRenderWrapper';
@@ -36,7 +35,7 @@ export const getPortalProviderAPI = portalManager => {
36
35
  const portalsMap = new Map();
37
36
  return {
38
37
  render: (children, container, key, onBeforeReactDomRender, immediate = false) => {
39
- if (isSSR() && isSSRStreaming()) {
38
+ if (isSSR()) {
40
39
  let html = '';
41
40
  try {
42
41
  const renderToStaticMarkup = getRenderToStaticMarkup();
@@ -67,7 +66,7 @@ export const getPortalProviderAPI = portalManager => {
67
66
  },
68
67
  remove: key => {
69
68
  var _portalsMap$get;
70
- if (isSSR() && isSSRStreaming()) {
69
+ if (isSSR()) {
71
70
  return;
72
71
  }
73
72
  (_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 ? void 0 : _portalsMap$get();
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { isSSR } from '../core-utils/is-ssr';
4
- import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
5
4
 
6
5
  /**
7
6
  * A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
@@ -9,5 +8,5 @@ import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
9
8
  */
10
9
  export const NodeViewContentHole = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement("div", _extends({}, props, {
11
10
  ref: ref,
12
- "data-ssr-content-dom-ref": isSSR() && isSSRStreaming() ? '' : undefined
11
+ "data-ssr-content-dom-ref": isSSR() ? '' : undefined
13
12
  })));
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
 
6
6
  import React from 'react';
7
7
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
8
- import { isSSR, isSSRStreaming } from '../core-utils';
8
+ import { isSSR } from '../core-utils';
9
9
  import { createDispatch } from '../event-dispatcher';
10
10
  import { ErrorBoundary } from '../ui/ErrorBoundary';
11
11
  import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
@@ -89,7 +89,7 @@ export default class ReactNodeView {
89
89
  // contentDOMWrapper that was appended above. The React ref callback
90
90
  // (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
91
91
  // left detached. Re-attach it by finding the marked SSR ref target.
92
- if (isSSR() && isSSRStreaming() && this.domRef) {
92
+ if (isSSR() && this.domRef) {
93
93
  const refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
94
94
  if (refTarget) {
95
95
  this.handleRef(refTarget);
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "118.10.3";
17
+ const packageVersion = "118.12.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,10 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  /* eslint-disable @repo/internal/react/no-class-components */
3
3
  import React, { PureComponent } from 'react';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
6
  import { ProviderFactory, WithProviders } from '../../provider-factory';
6
- import { MentionWithProviders } from './mention-with-providers';
7
+ import { MentionWithAvatarProviders, MentionWithProviders } from './mention-with-providers';
7
8
  const MENTION_PROVIDERS = ['mentionProvider', 'profilecardProvider'];
9
+ const GENERIC_MENTION_IDS = ['HipChat', 'all', 'here'];
8
10
  export default class Mention extends PureComponent {
9
11
  constructor(props) {
10
12
  super(props);
@@ -17,12 +19,29 @@ export default class Mention extends PureComponent {
17
19
  localId,
18
20
  userType,
19
21
  isDisabled,
20
- disabledTooltip
22
+ disabledTooltip,
23
+ mentionNodeDataProvider
21
24
  } = this.props;
22
25
  const {
23
26
  mentionProvider,
24
27
  profilecardProvider
25
28
  } = providers;
29
+ const isAvatarEnabled = Boolean(mentionNodeDataProvider) && userType !== 'SPECIAL' && !GENERIC_MENTION_IDS.includes(id) && isExperimentEnabled('platform_editor_mention_node_avatar');
30
+ if (isAvatarEnabled && mentionNodeDataProvider) {
31
+ return /*#__PURE__*/React.createElement(MentionWithAvatarProviders, {
32
+ id: id,
33
+ text: text,
34
+ accessLevel: accessLevel,
35
+ localId: localId,
36
+ userType: userType,
37
+ isDisabled: isDisabled,
38
+ disabledTooltip: disabledTooltip,
39
+ eventHandlers: eventHandlers,
40
+ mentionProvider: mentionProvider,
41
+ mentionNodeDataProvider: mentionNodeDataProvider,
42
+ profilecardProvider: profilecardProvider
43
+ });
44
+ }
26
45
  return /*#__PURE__*/React.createElement(MentionWithProviders, {
27
46
  id: id,
28
47
  text: text,
@@ -31,11 +31,15 @@ export default function MentionWithProfileCard({
31
31
  id,
32
32
  text,
33
33
  accessLevel,
34
+ appType,
35
+ avatarUrl,
36
+ isAvatarImagePreShaped,
34
37
  mentionProvider,
35
38
  profilecardProvider,
36
39
  onClick,
37
40
  onMouseEnter,
38
41
  onMouseLeave,
42
+ renderAvatarSlot,
39
43
  localId,
40
44
  ssrPlaceholderId,
41
45
  userType
@@ -50,11 +54,15 @@ export default function MentionWithProfileCard({
50
54
  id: id,
51
55
  text: text,
52
56
  accessLevel: accessLevel,
57
+ appType: appType,
58
+ avatarUrl: avatarUrl,
59
+ isAvatarImagePreShaped: isAvatarImagePreShaped,
53
60
  localId: localId,
54
61
  mentionProvider: mentionProvider,
55
62
  onClick: onClick,
56
63
  onMouseEnter: onMouseEnter,
57
64
  onMouseLeave: onMouseLeave,
65
+ renderAvatarSlot: renderAvatarSlot,
58
66
  ssrPlaceholderId: ssrPlaceholderId
59
67
  });
60
68