@atlaskit/editor-common 101.1.2 → 102.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.
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "101.1.2";
10
+ var packageVersion = "102.0.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -7,7 +7,7 @@ export var isSelectionAtStartOfNode = function isSelectionAtStartOfNode($pos, pa
7
7
  }
8
8
  for (var i = $pos.depth + 1; i > 0; i--) {
9
9
  var node = $pos.node(i);
10
- if (node && node.eq(parentNode.node)) {
10
+ if (node && node.eq(parentNode)) {
11
11
  break;
12
12
  }
13
13
  if (i > 1 && $pos.before(i) !== $pos.before(i - 1) + 1) {
@@ -22,7 +22,7 @@ export var isSelectionAtEndOfNode = function isSelectionAtEndOfNode($pos, parent
22
22
  }
23
23
  for (var i = $pos.depth + 1; i > 0; i--) {
24
24
  var node = $pos.node(i);
25
- if (node && node.eq(parentNode.node)) {
25
+ if (node && node.eq(parentNode)) {
26
26
  break;
27
27
  }
28
28
  if (i > 1 && $pos.after(i) !== $pos.after(i - 1) - 1) {
@@ -0,0 +1,3 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ import editorUGCToken from './get-editor-ugc-token';
3
+ export { editorUGCToken };
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "101.1.2";
23
+ var packageVersion = "102.0.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -11,8 +11,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
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 React from 'react';
14
- import PropTypes from 'prop-types';
15
- import { fg } from '@atlaskit/platform-feature-flags';
16
14
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
17
15
  import { createDispatch } from '../event-dispatcher';
18
16
  import { startMeasure, stopMeasure } from '../performance-measures';
@@ -72,18 +70,13 @@ var WithPluginState = /*#__PURE__*/function (_React$Component) {
72
70
  return _createClass(WithPluginState, [{
73
71
  key: "render",
74
72
  value: function render() {
75
- if (fg('platform_editor_react18_phase2_v2')) {
76
- // Ignored via go/ees005
77
- // eslint-disable-next-line react/jsx-props-no-spreading
78
- return /*#__PURE__*/React.createElement(WithPluginStateNew, this.props);
79
- }
80
73
  // Ignored via go/ees005
81
74
  // eslint-disable-next-line react/jsx-props-no-spreading
82
- return /*#__PURE__*/React.createElement(WithPluginStateOld, this.props);
75
+ return /*#__PURE__*/React.createElement(WithPluginStateEditionActionsWrapper, this.props);
83
76
  }
84
77
  }]);
85
78
  }(React.Component);
86
- function WithPluginStateNew(props) {
79
+ function WithPluginStateEditionActionsWrapper(props) {
87
80
  var context = React.useContext(EditorContext);
88
81
  return /*#__PURE__*/React.createElement(WithPluginStateInner
89
82
  // Ignored via go/ees005
@@ -348,265 +341,5 @@ export var WithPluginStateInner = /*#__PURE__*/function (_React$Component2) {
348
341
  }
349
342
  }]);
350
343
  }(React.Component);
351
-
352
- // Ignored via go/ees005
353
- // eslint-disable-next-line @repo/internal/react/no-class-components
354
344
  _defineProperty(WithPluginStateInner, "displayName", 'WithPluginState');
355
- export var WithPluginStateOld = /*#__PURE__*/function (_React$Component3) {
356
- function WithPluginStateOld(props, context) {
357
- var _this6;
358
- _classCallCheck(this, WithPluginStateOld);
359
- _this6 = _callSuper(this, WithPluginStateOld, [props, context]);
360
- _defineProperty(_this6, "listeners", {});
361
- _defineProperty(_this6, "debounce", null);
362
- _defineProperty(_this6, "notAppliedState", {});
363
- _defineProperty(_this6, "isSubscribed", false);
364
- _defineProperty(_this6, "callsCount", 0);
365
- _defineProperty(_this6, "handlePluginStateChange", function (propName, pluginName, performanceOptions, skipEqualityCheck) {
366
- return (
367
- // Ignored via go/ees005
368
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
369
- function (pluginState) {
370
- // skipEqualityCheck is being used for old plugins since they are mutating plugin state instead of creating a new one
371
- // Ignored via go/ees005
372
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
373
- if (_this6.state[propName] !== pluginState || skipEqualityCheck) {
374
- _this6.updateState({
375
- stateSubset: _defineProperty({}, propName, pluginState),
376
- pluginName: pluginName,
377
- performanceOptions: performanceOptions
378
- });
379
- }
380
- }
381
- );
382
- });
383
- /**
384
- * Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
385
- */
386
- _defineProperty(_this6, "updateState", function (_ref2) {
387
- var stateSubset = _ref2.stateSubset,
388
- pluginName = _ref2.pluginName,
389
- performanceOptions = _ref2.performanceOptions;
390
- _this6.notAppliedState = _objectSpread(_objectSpread({}, _this6.notAppliedState), stateSubset);
391
- if (_this6.debounce) {
392
- window.clearTimeout(_this6.debounce);
393
- }
394
- var debounce = _this6.props.debounce !== false ? function (fn) {
395
- return window.setTimeout(fn, 0);
396
- } : function (fn) {
397
- return fn();
398
- };
399
- _this6.debounce = debounce(function () {
400
- var measure = "\uD83E\uDD89".concat(pluginName, "::WithPluginState");
401
- performanceOptions.trackingEnabled && startMeasure(measure);
402
- _this6.setState(_this6.notAppliedState, function () {
403
- performanceOptions.trackingEnabled && stopMeasure(measure, function (duration) {
404
- // Each WithPluginState component will fire analytics event no more than once every `samplingLimit` times
405
- if (++_this6.callsCount % performanceOptions.samplingRate === 0 && duration > performanceOptions.slowThreshold) {
406
- _this6.dispatchAnalyticsEvent({
407
- action: ACTION.WITH_PLUGIN_STATE_CALLED,
408
- actionSubject: ACTION_SUBJECT.EDITOR,
409
- eventType: EVENT_TYPE.OPERATIONAL,
410
- attributes: {
411
- plugin: pluginName,
412
- duration: duration
413
- }
414
- });
415
- }
416
- });
417
- });
418
- _this6.debounce = null;
419
- _this6.notAppliedState = {};
420
- });
421
- });
422
- _defineProperty(_this6, "dispatchAnalyticsEvent", function (payload) {
423
- var eventDispatcher = _this6.getEventDispatcher();
424
- if (eventDispatcher) {
425
- var dispatch = createDispatch(eventDispatcher);
426
- dispatch(analyticsEventKey, {
427
- payload: payload
428
- });
429
- }
430
- });
431
- _defineProperty(_this6, "onContextUpdate", function () {
432
- _this6.subscribe(_this6.props);
433
- });
434
- _this6.state = _this6.getPluginsStates(_this6.props.plugins, _this6.getEditorView(props, context));
435
- return _this6;
436
- }
437
- _inherits(WithPluginStateOld, _React$Component3);
438
- return _createClass(WithPluginStateOld, [{
439
- key: "getEditorView",
440
- value: function getEditorView(maybeProps, maybeContext) {
441
- var props = maybeProps || this.props;
442
- var context = maybeContext || this.context;
443
- return props.editorView || context && context.editorActions && context.editorActions._privateGetEditorView() || context && context.editorSharedConfig && context.editorSharedConfig.editorView;
444
- }
445
- }, {
446
- key: "getEventDispatcher",
447
- value: function getEventDispatcher(maybeProps) {
448
- var props = maybeProps || this.props;
449
- return props.eventDispatcher || this.context && this.context.editorActions && this.context.editorActions._privateGetEventDispatcher() || this.context && this.context.editorSharedConfig && this.context.editorSharedConfig.eventDispatcher;
450
- }
451
- }, {
452
- key: "getPluginsStates",
453
- value: function getPluginsStates(plugins, editorView) {
454
- if (!editorView || !plugins) {
455
- return {};
456
- }
457
- var keys = Object.keys(plugins);
458
- return keys.reduce(function (acc, propName) {
459
- var pluginKey = plugins[propName];
460
- if (!pluginKey) {
461
- return acc;
462
- }
463
- acc[propName] = pluginKey.getState(editorView.state);
464
- return acc;
465
- }, {});
466
- }
467
- }, {
468
- key: "subscribe",
469
- value: function subscribe(props) {
470
- var _uiTracking$samplingR2,
471
- _uiTracking$slowThres2,
472
- _this7 = this;
473
- var plugins = props.plugins;
474
- var eventDispatcher = this.getEventDispatcher(props);
475
- var editorView = this.getEditorView(props);
476
- if (!eventDispatcher || !editorView || this.isSubscribed) {
477
- return;
478
- }
479
-
480
- // TODO: ED-15663
481
- // Please, do not copy or use this kind of code below
482
- // @ts-ignore
483
- var fakePluginKey = {
484
- key: 'analyticsPlugin$',
485
- getState: function getState(state) {
486
- // Ignored via go/ees005
487
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
488
- return state['analyticsPlugin$'];
489
- }
490
- };
491
- var analyticsPlugin = fakePluginKey.getState(editorView.state);
492
- var uiTracking = analyticsPlugin && analyticsPlugin.performanceTracking ? analyticsPlugin.performanceTracking.uiTracking || {} : {};
493
- var trackingEnabled = uiTracking.enabled === true;
494
- var samplingRate = (_uiTracking$samplingR2 = uiTracking.samplingRate) !== null && _uiTracking$samplingR2 !== void 0 ? _uiTracking$samplingR2 : DEFAULT_SAMPLING_RATE;
495
- var slowThreshold = (_uiTracking$slowThres2 = uiTracking.slowThreshold) !== null && _uiTracking$slowThres2 !== void 0 ? _uiTracking$slowThres2 : DEFAULT_SLOW_THRESHOLD;
496
- this.isSubscribed = true;
497
- var pluginsStates = this.getPluginsStates(plugins, editorView);
498
- this.setState(pluginsStates);
499
- Object.keys(plugins).forEach(function (propName) {
500
- var pluginKey = plugins[propName];
501
- if (!pluginKey) {
502
- return;
503
- }
504
-
505
- // Ignored via go/ees005
506
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
507
- var pluginName = pluginKey.key;
508
- // Ignored via go/ees005
509
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
510
- var pluginState = pluginsStates[propName];
511
- var isPluginWithSubscribe = pluginState && pluginState.subscribe;
512
- var handler = _this7.handlePluginStateChange(propName, pluginName, {
513
- samplingRate: samplingRate,
514
- slowThreshold: slowThreshold,
515
- trackingEnabled: trackingEnabled
516
- }, isPluginWithSubscribe);
517
- if (isPluginWithSubscribe) {
518
- pluginState.subscribe(handler);
519
- } else {
520
- // Ignored via go/ees005
521
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
522
- eventDispatcher.on(pluginKey.key, handler);
523
- }
524
-
525
- // Ignored via go/ees005
526
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
527
- // Ignored via go/ees005
528
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
529
- _this7.listeners[pluginKey.key] = {
530
- handler: handler,
531
- pluginKey: pluginKey
532
- };
533
- });
534
- }
535
- }, {
536
- key: "unsubscribe",
537
- value: function unsubscribe() {
538
- var _this8 = this;
539
- var eventDispatcher = this.getEventDispatcher();
540
- var editorView = this.getEditorView();
541
- if (!eventDispatcher || !editorView || !this.isSubscribed) {
542
- return;
543
- }
544
- Object.keys(this.listeners).forEach(function (key) {
545
- // Ignored via go/ees005
546
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
547
- var pluginState = _this8.listeners[key].pluginKey.getState(editorView.state);
548
- if (pluginState && pluginState.unsubscribe) {
549
- // Ignored via go/ees005
550
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
551
- pluginState.unsubscribe(_this8.listeners[key].handler);
552
- } else {
553
- // Ignored via go/ees005
554
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
555
- eventDispatcher.off(key, _this8.listeners[key].handler);
556
- }
557
- });
558
- this.listeners = [];
559
- }
560
- }, {
561
- key: "subscribeToContextUpdates",
562
- value: function subscribeToContextUpdates(context) {
563
- if (context && context.editorActions) {
564
- context.editorActions._privateSubscribe(this.onContextUpdate);
565
- }
566
- }
567
- }, {
568
- key: "unsubscribeFromContextUpdates",
569
- value: function unsubscribeFromContextUpdates(context) {
570
- if (context && context.editorActions) {
571
- context.editorActions._privateUnsubscribe(this.onContextUpdate);
572
- }
573
- }
574
- }, {
575
- key: "componentDidMount",
576
- value: function componentDidMount() {
577
- this.subscribe(this.props);
578
- this.subscribeToContextUpdates(this.context);
579
- }
580
-
581
- // Ignored via go/ees005
582
- // eslint-disable-next-line react/no-unsafe
583
- }, {
584
- key: "UNSAFE_componentWillReceiveProps",
585
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
586
- if (!this.isSubscribed) {
587
- this.subscribe(nextProps);
588
- }
589
- }
590
- }, {
591
- key: "componentWillUnmount",
592
- value: function componentWillUnmount() {
593
- if (this.debounce) {
594
- window.clearTimeout(this.debounce);
595
- }
596
- this.unsubscribeFromContextUpdates(this.context);
597
- this.unsubscribe();
598
- }
599
- }, {
600
- key: "render",
601
- value: function render() {
602
- var render = this.props.render;
603
- return render(this.state);
604
- }
605
- }]);
606
- }(React.Component);
607
- _defineProperty(WithPluginStateOld, "displayName", 'WithPluginState');
608
- _defineProperty(WithPluginStateOld, "contextTypes", {
609
- editorActions: PropTypes.object,
610
- editorSharedConfig: PropTypes.object
611
- });
612
345
  export { WithPluginState };
@@ -14,19 +14,26 @@ export type AIUnifiedCommonAttributes = {
14
14
  aiExperienceName?: string;
15
15
  traceIds?: string[];
16
16
  };
17
- type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
18
- type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
19
- type AIResultViewedAEP = TrackAEP<ACTION.VIEWED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
20
- type AIResultActionedAEP = TrackAEP<ACTION.ACTIONED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
17
+ type AIUnifiedAgentAttributes = {
18
+ agentName?: string;
19
+ agentId?: string;
20
+ agentCreatorType?: string;
21
+ agentExternalConfigReference?: string;
22
+ agentIsDefault?: boolean;
23
+ };
24
+ type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
25
+ type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
26
+ type AIResultViewedAEP = TrackAEP<ACTION.VIEWED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
27
+ type AIResultActionedAEP = TrackAEP<ACTION.ACTIONED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
21
28
  promptType?: string;
22
29
  refinementCount?: number;
23
30
  aiResultAction: string;
24
31
  }, undefined>;
25
- type AIResultErrorAEP = TrackAEP<ACTION.ERROR, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
32
+ type AIResultErrorAEP = TrackAEP<ACTION.ERROR, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
26
33
  aiErrorMessage?: string;
27
34
  aiErrorCode?: number;
28
35
  }, undefined>;
29
- type AIFeedbackSubmittedAEP = TrackAEP<ACTION.SUBMITTED, ACTION_SUBJECT.AI_FEEDBACK, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
36
+ type AIFeedbackSubmittedAEP = TrackAEP<ACTION.SUBMITTED, ACTION_SUBJECT.AI_FEEDBACK, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
30
37
  aiFeedbackResult: 'up' | 'down';
31
38
  }, undefined>;
32
39
  export type AIUnifiedEventPayload = AIInteractionInitiatedAEP | AIResultViewedAEP | AIResultErrorAEP | AIInteractionDismissedAEP | AIResultActionedAEP | AIFeedbackSubmittedAEP;
@@ -1,8 +1,7 @@
1
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ResolvedPos, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
- export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
5
- export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
3
+ export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
4
+ export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
6
5
  export declare function atTheEndOfDoc(state: EditorState): boolean;
7
6
  export declare function atTheBeginningOfDoc(state: EditorState): boolean;
8
7
  export declare function atTheEndOfBlock(state: EditorState): boolean;
@@ -0,0 +1,2 @@
1
+ import editorUGCToken from './get-editor-ugc-token';
2
+ export { editorUGCToken };
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { EventDispatcher } from '../event-dispatcher';
@@ -19,17 +18,9 @@ export type EditorActionsPrivateAccess = {
19
18
  _privateSubscribe: (cb: ContextUpdateHandler) => void;
20
19
  _privateUnsubscribe: (cb: ContextUpdateHandler) => void;
21
20
  };
22
- type EditorSharedConfigPrivateAccess = {
23
- editorView: EditorView;
24
- eventDispatcher: EventDispatcher;
25
- };
26
21
  export type PluginsConfig = {
27
22
  [name: string]: PluginKey;
28
23
  };
29
- type Context = {
30
- editorActions?: EditorActionsPrivateAccess;
31
- editorSharedConfig?: EditorSharedConfigPrivateAccess;
32
- };
33
24
  export interface Props<P extends NamedPluginKeys> {
34
25
  debounce?: boolean;
35
26
  eventDispatcher?: EventDispatcher;
@@ -107,37 +98,4 @@ export declare class WithPluginStateInner<P extends NamedPluginKeys> extends Rea
107
98
  componentWillUnmount(): void;
108
99
  render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
109
100
  }
110
- export declare class WithPluginStateOld<P extends NamedPluginKeys> extends React.Component<Props<P>, State> {
111
- static displayName: string;
112
- private listeners;
113
- private debounce;
114
- private notAppliedState;
115
- private isSubscribed;
116
- private callsCount;
117
- static contextTypes: {
118
- editorActions: PropTypes.Requireable<object>;
119
- editorSharedConfig: PropTypes.Requireable<object>;
120
- };
121
- context: Context;
122
- state: NamedPluginStates<P>;
123
- constructor(props: Props<P>, context: Context);
124
- private getEditorView;
125
- private getEventDispatcher;
126
- private handlePluginStateChange;
127
- /**
128
- * Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
129
- */
130
- private updateState;
131
- private dispatchAnalyticsEvent;
132
- private getPluginsStates;
133
- private subscribe;
134
- private unsubscribe;
135
- private onContextUpdate;
136
- private subscribeToContextUpdates;
137
- private unsubscribeFromContextUpdates;
138
- componentDidMount(): void;
139
- UNSAFE_componentWillReceiveProps(nextProps: Props<P>): void;
140
- componentWillUnmount(): void;
141
- render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
142
- }
143
101
  export { WithPluginState };
@@ -14,19 +14,26 @@ export type AIUnifiedCommonAttributes = {
14
14
  aiExperienceName?: string;
15
15
  traceIds?: string[];
16
16
  };
17
- type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
18
- type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
19
- type AIResultViewedAEP = TrackAEP<ACTION.VIEWED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes, undefined>;
20
- type AIResultActionedAEP = TrackAEP<ACTION.ACTIONED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
17
+ type AIUnifiedAgentAttributes = {
18
+ agentName?: string;
19
+ agentId?: string;
20
+ agentCreatorType?: string;
21
+ agentExternalConfigReference?: string;
22
+ agentIsDefault?: boolean;
23
+ };
24
+ type AIInteractionInitiatedAEP = TrackAEP<ACTION.INITIATED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
25
+ type AIInteractionDismissedAEP = TrackAEP<ACTION.DISMISSED, ACTION_SUBJECT.AI_INTERACTION, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
26
+ type AIResultViewedAEP = TrackAEP<ACTION.VIEWED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes, undefined>;
27
+ type AIResultActionedAEP = TrackAEP<ACTION.ACTIONED, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
21
28
  promptType?: string;
22
29
  refinementCount?: number;
23
30
  aiResultAction: string;
24
31
  }, undefined>;
25
- type AIResultErrorAEP = TrackAEP<ACTION.ERROR, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
32
+ type AIResultErrorAEP = TrackAEP<ACTION.ERROR, ACTION_SUBJECT.AI_RESULT, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
26
33
  aiErrorMessage?: string;
27
34
  aiErrorCode?: number;
28
35
  }, undefined>;
29
- type AIFeedbackSubmittedAEP = TrackAEP<ACTION.SUBMITTED, ACTION_SUBJECT.AI_FEEDBACK, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & {
36
+ type AIFeedbackSubmittedAEP = TrackAEP<ACTION.SUBMITTED, ACTION_SUBJECT.AI_FEEDBACK, ACTION_SUBJECT_ID.EDITOR_PLUGIN_AI, AIUnifiedCommonAttributes & AIUnifiedAgentAttributes & {
30
37
  aiFeedbackResult: 'up' | 'down';
31
38
  }, undefined>;
32
39
  export type AIUnifiedEventPayload = AIInteractionInitiatedAEP | AIResultViewedAEP | AIResultErrorAEP | AIInteractionDismissedAEP | AIResultActionedAEP | AIFeedbackSubmittedAEP;
@@ -1,8 +1,7 @@
1
- import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
1
+ import type { ResolvedPos, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
- export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
5
- export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: ContentNodeWithPos) => boolean;
3
+ export declare const isSelectionAtStartOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
4
+ export declare const isSelectionAtEndOfNode: ($pos: ResolvedPos, parentNode?: PMNode) => boolean;
6
5
  export declare function atTheEndOfDoc(state: EditorState): boolean;
7
6
  export declare function atTheBeginningOfDoc(state: EditorState): boolean;
8
7
  export declare function atTheEndOfBlock(state: EditorState): boolean;
@@ -0,0 +1,2 @@
1
+ import editorUGCToken from './get-editor-ugc-token';
2
+ export { editorUGCToken };
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
4
  import type { EventDispatcher } from '../event-dispatcher';
@@ -19,17 +18,9 @@ export type EditorActionsPrivateAccess = {
19
18
  _privateSubscribe: (cb: ContextUpdateHandler) => void;
20
19
  _privateUnsubscribe: (cb: ContextUpdateHandler) => void;
21
20
  };
22
- type EditorSharedConfigPrivateAccess = {
23
- editorView: EditorView;
24
- eventDispatcher: EventDispatcher;
25
- };
26
21
  export type PluginsConfig = {
27
22
  [name: string]: PluginKey;
28
23
  };
29
- type Context = {
30
- editorActions?: EditorActionsPrivateAccess;
31
- editorSharedConfig?: EditorSharedConfigPrivateAccess;
32
- };
33
24
  export interface Props<P extends NamedPluginKeys> {
34
25
  debounce?: boolean;
35
26
  eventDispatcher?: EventDispatcher;
@@ -107,37 +98,4 @@ export declare class WithPluginStateInner<P extends NamedPluginKeys> extends Rea
107
98
  componentWillUnmount(): void;
108
99
  render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
109
100
  }
110
- export declare class WithPluginStateOld<P extends NamedPluginKeys> extends React.Component<Props<P>, State> {
111
- static displayName: string;
112
- private listeners;
113
- private debounce;
114
- private notAppliedState;
115
- private isSubscribed;
116
- private callsCount;
117
- static contextTypes: {
118
- editorActions: PropTypes.Requireable<object>;
119
- editorSharedConfig: PropTypes.Requireable<object>;
120
- };
121
- context: Context;
122
- state: NamedPluginStates<P>;
123
- constructor(props: Props<P>, context: Context);
124
- private getEditorView;
125
- private getEventDispatcher;
126
- private handlePluginStateChange;
127
- /**
128
- * Debounces setState calls in order to reduce number of re-renders caused by several plugin state changes.
129
- */
130
- private updateState;
131
- private dispatchAnalyticsEvent;
132
- private getPluginsStates;
133
- private subscribe;
134
- private unsubscribe;
135
- private onContextUpdate;
136
- private subscribeToContextUpdates;
137
- private unsubscribeFromContextUpdates;
138
- componentDidMount(): void;
139
- UNSAFE_componentWillReceiveProps(nextProps: Props<P>): void;
140
- componentWillUnmount(): void;
141
- render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
142
- }
143
101
  export { WithPluginState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "101.1.2",
3
+ "version": "102.0.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -112,7 +112,8 @@
112
112
  "./lazy-node-view": "./src/lazy-node-view/index.ts",
113
113
  "./nesting": "./src/nesting/utilities.ts",
114
114
  "./UNSAFE_do_not_use_editor_context": "./src/ui/EditorContext/index.ts",
115
- "./median": "./src/utils/median.ts"
115
+ "./median": "./src/utils/median.ts",
116
+ "./ugc-tokens": "./src/ugc-tokens/index.ts"
116
117
  },
117
118
  "dependencies": {
118
119
  "@atlaskit/activity-provider": "^2.5.0",
@@ -129,7 +130,7 @@
129
130
  "@atlaskit/custom-steps": "^0.11.0",
130
131
  "@atlaskit/dropdown-menu": "^13.0.0",
131
132
  "@atlaskit/editor-json-transformer": "^8.24.0",
132
- "@atlaskit/editor-palette": "2.0.0",
133
+ "@atlaskit/editor-palette": "^2.0.0",
133
134
  "@atlaskit/editor-prosemirror": "7.0.0",
134
135
  "@atlaskit/editor-shared-styles": "^3.4.0",
135
136
  "@atlaskit/editor-tables": "^2.9.0",
@@ -145,7 +146,7 @@
145
146
  "@atlaskit/media-file-preview": "^0.11.0",
146
147
  "@atlaskit/media-picker": "^68.0.0",
147
148
  "@atlaskit/media-ui": "^28.0.0",
148
- "@atlaskit/media-viewer": "52.0.1",
149
+ "@atlaskit/media-viewer": "^52.0.0",
149
150
  "@atlaskit/mention": "^24.1.0",
150
151
  "@atlaskit/menu": "^3.1.0",
151
152
  "@atlaskit/onboarding": "^13.0.0",
@@ -153,7 +154,7 @@
153
154
  "@atlaskit/popper": "^7.0.0",
154
155
  "@atlaskit/primitives": "^14.1.0",
155
156
  "@atlaskit/profilecard": "^23.2.0",
156
- "@atlaskit/section-message": "^8.0.0",
157
+ "@atlaskit/section-message": "^8.1.0",
157
158
  "@atlaskit/smart-card": "^35.2.0",
158
159
  "@atlaskit/smart-user-picker": "^8.0.0",
159
160
  "@atlaskit/spinner": "^18.0.0",
@@ -197,11 +198,11 @@
197
198
  "react-intl-next": "npm:react-intl@^5.18.1"
198
199
  },
199
200
  "devDependencies": {
200
- "@af/visual-regression": "*",
201
+ "@af/visual-regression": "^1.3.0",
201
202
  "@atlaskit/media-core": "^35.0.0",
202
203
  "@atlaskit/media-test-helpers": "^35.0.0",
203
204
  "@atlaskit/util-data-test": "^18.0.0",
204
- "@atlaskit/visual-regression": "*",
205
+ "@atlaskit/visual-regression": "^0.10.0",
205
206
  "@testing-library/dom": "^10.1.0",
206
207
  "@testing-library/jest-dom": "^6.4.5",
207
208
  "@testing-library/react": "^13.4.0",
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/ugc-tokens",
3
+ "main": "../dist/cjs/ugc-tokens/index.js",
4
+ "module": "../dist/esm/ugc-tokens/index.js",
5
+ "module:es2019": "../dist/es2019/ugc-tokens/index.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/ugc-tokens/index.d.ts",
10
+ "typesVersions": {
11
+ ">=4.5 <5.4": {
12
+ "*": [
13
+ "../dist/types-ts4.5/ugc-tokens/index.d.ts"
14
+ ]
15
+ }
16
+ }
17
+ }