@atlaskit/editor-plugin-interactivity 0.1.0 → 0.2.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 (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +34 -6
  3. package/afm-cc/tsconfig.json +12 -0
  4. package/afm-products/tsconfig.json +12 -0
  5. package/dist/cjs/analytics/fire-interactivity-event.js +39 -0
  6. package/dist/cjs/analytics/interactivity-snapshot.js +1 -0
  7. package/dist/cjs/collector/bucket-boundaries.js +137 -0
  8. package/dist/cjs/collector/interaction-group.js +167 -0
  9. package/dist/cjs/collector/interaction-observer.js +114 -0
  10. package/dist/cjs/collector/interaction-tracker.js +144 -0
  11. package/dist/cjs/collector/interactivity-collector.js +289 -0
  12. package/dist/cjs/collector/interactivity-session.js +52 -0
  13. package/dist/cjs/collector/lifecycle-observer.js +66 -0
  14. package/dist/cjs/collector/snapshot-scheduler.js +70 -0
  15. package/dist/cjs/interactivityPlugin.js +81 -6
  16. package/dist/es2019/analytics/fire-interactivity-event.js +33 -0
  17. package/dist/es2019/analytics/interactivity-snapshot.js +0 -0
  18. package/dist/es2019/collector/bucket-boundaries.js +117 -0
  19. package/dist/es2019/collector/interaction-group.js +110 -0
  20. package/dist/es2019/collector/interaction-observer.js +90 -0
  21. package/dist/es2019/collector/interaction-tracker.js +116 -0
  22. package/dist/es2019/collector/interactivity-collector.js +228 -0
  23. package/dist/es2019/collector/interactivity-session.js +42 -0
  24. package/dist/es2019/collector/lifecycle-observer.js +46 -0
  25. package/dist/es2019/collector/snapshot-scheduler.js +48 -0
  26. package/dist/es2019/interactivityPlugin.js +75 -6
  27. package/dist/esm/analytics/fire-interactivity-event.js +33 -0
  28. package/dist/esm/analytics/interactivity-snapshot.js +0 -0
  29. package/dist/esm/collector/bucket-boundaries.js +130 -0
  30. package/dist/esm/collector/interaction-group.js +161 -0
  31. package/dist/esm/collector/interaction-observer.js +108 -0
  32. package/dist/esm/collector/interaction-tracker.js +137 -0
  33. package/dist/esm/collector/interactivity-collector.js +282 -0
  34. package/dist/esm/collector/interactivity-session.js +45 -0
  35. package/dist/esm/collector/lifecycle-observer.js +59 -0
  36. package/dist/esm/collector/snapshot-scheduler.js +63 -0
  37. package/dist/esm/interactivityPlugin.js +81 -6
  38. package/dist/types/analytics/fire-interactivity-event.d.ts +9 -0
  39. package/dist/types/analytics/interactivity-snapshot.d.ts +61 -0
  40. package/dist/types/collector/bucket-boundaries.d.ts +35 -0
  41. package/dist/types/collector/interaction-group.d.ts +25 -0
  42. package/dist/types/collector/interaction-observer.d.ts +39 -0
  43. package/dist/types/collector/interaction-tracker.d.ts +56 -0
  44. package/dist/types/collector/interactivity-collector.d.ts +75 -0
  45. package/dist/types/collector/interactivity-session.d.ts +39 -0
  46. package/dist/types/collector/lifecycle-observer.d.ts +25 -0
  47. package/dist/types/collector/snapshot-scheduler.d.ts +15 -0
  48. package/dist/types/interactivityPlugin.d.ts +6 -4
  49. package/dist/types/interactivityPluginType.d.ts +11 -2
  50. package/docs/0-intro.tsx +25 -7
  51. package/package.json +8 -3
@@ -1,9 +1,11 @@
1
1
  import type { InteractivityPlugin } from './interactivityPluginType';
2
2
  /**
3
- * Reports interaction latency distributions for full page editor sessions as the
4
- * `editor interactivity` operational event.
3
+ * Reports session-to-date interaction latency distributions for full page editor sessions
4
+ * as the `editor interactivity` operational event.
5
5
  *
6
- * A stub for now: the plugin only registers itself. The collector and the event land in
7
- * EDITOR-8553.
6
+ * The session runs for as long as the plugin's hook stays mounted, which is one editor
7
+ * mount: `MountPluginHooks` in editor-core keys hook fibers by plugin name, so a preset
8
+ * reconfigure — which destroys and recreates ProseMirror plugin views — leaves this hook,
9
+ * and the session, in place.
8
10
  */
9
11
  export declare const interactivityPlugin: InteractivityPlugin;
@@ -1,2 +1,11 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- export type InteractivityPlugin = NextEditorPlugin<'interactivity'>;
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics/analyticsPluginType';
3
+ import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier/contextIdentifierPluginType';
4
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode/editorViewmodePluginType';
5
+ export type InteractivityPlugin = NextEditorPlugin<'interactivity', {
6
+ dependencies: [
7
+ OptionalPlugin<AnalyticsPlugin>,
8
+ OptionalPlugin<ContextIdentifierPlugin>,
9
+ OptionalPlugin<EditorViewModePlugin>
10
+ ];
11
+ }>;
package/docs/0-intro.tsx CHANGED
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { AtlassianInternalWarning, code, md } from '@atlaskit/docs';
4
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
4
  import { createEditorUseOnlyNotice } from '@atlaskit/editor-common/doc-utils';
6
5
  import { token } from '@atlaskit/tokens';
7
6
 
@@ -24,24 +23,43 @@ ${createEditorUseOnlyNotice('Editor Plugin Interactivity', [
24
23
 
25
24
  This package includes the interactivity plugin used by \`@atlaskit/editor-core\`.
26
25
 
27
- It will report the \`editor interactivity\` operational event: how interaction latencies were
28
- spread over an editor session, as bucketed counts, per [RFC 095](https://hello.atlassian.net/wiki/spaces/EDITOR/pages/7527607488/Editor+RFC+095+Confluence+editor+responsiveness+bucketed+INP+telemetry).
29
- The plugin is a stub at this point and collects nothing.
26
+ It reports the \`editor interactivity\` operational event: session-to-date interaction latency
27
+ histograms for full page editor sessions, per [RFC 095](https://hello.atlassian.net/wiki/spaces/EDITOR/pages/7527607488/Editor+RFC+095+Confluence+editor+responsiveness+bucketed+INP+telemetry).
28
+ See the package README for the event shape, the snapshot cadence and what ends a session.
29
+
30
+ The plugin has no configuration, state, actions or commands — adding it to a preset is what turns
31
+ collection on.
30
32
 
31
33
  ## Usage
32
34
  ---
33
35
 
34
- Add the plugin to a preset. It has no configuration, state, actions or commands, so there is
36
+ Add the plugin to a preset. It reports for as long as the editor stays mounted, so there is
35
37
  nothing to call:
36
38
 
37
39
  ${code`
38
40
  import { interactivityPlugin } from '@atlaskit/editor-plugin-interactivity';
39
41
 
40
- const preset = new EditorPresetBuilder().add(interactivityPlugin);
42
+ const preset = new EditorPresetBuilder()
43
+ .add(analyticsPlugin)
44
+ .add(contextIdentifierPlugin)
45
+ .add(editorViewModePlugin)
46
+ .add(interactivityPlugin);
41
47
  `}
42
48
 
49
+ All three dependencies are optional, but the event is only fired when the analytics plugin is
50
+ present, and the session is only split per document and per mode when the other two are:
51
+
43
52
  ${code`
44
- type InteractivityPlugin = NextEditorPlugin<'interactivity'>
53
+ type InteractivityPlugin = NextEditorPlugin<
54
+ 'interactivity',
55
+ {
56
+ dependencies: [
57
+ OptionalPlugin<AnalyticsPlugin>,
58
+ OptionalPlugin<ContextIdentifierPlugin>,
59
+ OptionalPlugin<EditorViewModePlugin>,
60
+ ];
61
+ }
62
+ >
45
63
  `}
46
64
 
47
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-interactivity",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Interactivity plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -19,10 +19,15 @@
19
19
  "types": "dist/types/index.d.ts",
20
20
  "sideEffects": false,
21
21
  "dependencies": {
22
- "@babel/runtime": "^7.0.0"
22
+ "@atlaskit/browser-apis": "^1.2.0",
23
+ "@atlaskit/editor-plugin-analytics": "^15.0.0",
24
+ "@atlaskit/editor-plugin-context-identifier": "^15.0.0",
25
+ "@atlaskit/editor-plugin-editor-viewmode": "^17.0.0",
26
+ "@babel/runtime": "^7.0.0",
27
+ "bind-event-listener": "^3.0.0"
23
28
  },
24
29
  "peerDependencies": {
25
- "@atlaskit/editor-common": "^119.5.0",
30
+ "@atlaskit/editor-common": "^119.9.0",
26
31
  "react": "^18.2.0 || ^19.2.0"
27
32
  },
28
33
  "devDependencies": {